Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to override terraform version per Workspace with environment variable #254

Closed
wants to merge 6 commits into from

Conversation

ytsarev
Copy link
Member

@ytsarev ytsarev commented Apr 4, 2024

Description of your changes

    env:
      - name: TFENV_TERRAFORM_VERSION
        value: 1.4.0 #custom version per workspace

the tenv will handle the installation and invocation of the custom version

  • Within provider pod the multiple version are stored in /.tenv and looks like this in case of multiple version usage
~ $ cd .tenv/
/.tenv $ tree
.
└── Terraform
    ├── 1.4.0
    │   └── terraform
    ├── 1.5.5
    │   └── terraform
  • /.tenv/Terraform/1.5.5/ is the current default version and prepackaged to the provider image

Fixes #84

I have:

  • Run make reviewable to ensure this PR is ready for review.

How has this code been tested

Running custom provider image with this change and invoking several workspace examples

k get workspaces.tf.upbound.io
NAME                           SYNCED   READY   AGE
sample-inline-with-env         True     True    26m
sample-inline-own-tf-version   True     True    19m

Checked the associated contents of /.tenv directory and custom terraform cli invocation in the process list - it worked as expected.

ytsarev added 6 commits April 4, 2024 22:18
* Add https://github.com/tofuutils/tenv/ to the provider image
* Manage terraform cli version with it

Signed-off-by: Yury Tsarev <[email protected]>
Signed-off-by: Yury Tsarev <[email protected]>
Signed-off-by: Yury Tsarev <[email protected]>
@ytsarev ytsarev changed the title Ability to override terraform version per Workpsace with environment variable Ability to override terraform version per Workspace with environment variable Apr 4, 2024
@bdwyertech
Copy link
Contributor

Hey this looks really cool, thanks for the shout out @ytsarev

@ytsarev
Copy link
Member Author

ytsarev commented Apr 4, 2024

/test-examples="examples/workspace-inline-aws.yaml"

@jeanduplessis jeanduplessis marked this pull request as draft April 5, 2024 16:32
@turkenf
Copy link
Contributor

turkenf commented Apr 24, 2024

/test-examples="examples/workspace-inline-aws.yaml"

FYI: This test comment was just left to make sure pipelines work.

@jeanduplessis
Copy link
Contributor

At this point in time, we will not allow overriding the Terraform binary with the possibility of one released after 1.5.x as they are released under the BSL license. This provider would violate the license terms, and we do not want to open the possibility for that even if the action was taken by a user of the provider.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for tfenv
4 participants