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

Tfenv support #82

Closed
wants to merge 3 commits into from
Closed

Tfenv support #82

wants to merge 3 commits into from

Conversation

bdwyertech
Copy link
Contributor

@bdwyertech bdwyertech commented Feb 8, 2023

Description of your changes

Adds support for tfenv. The addition of tfenv allows a user to optionally decouple the version of Terraform from the provider image, if we choose or need to do so. If left alone, the previous behavior is preserved (you get the version which ships with the image)

This allows flexibility in that: we can choose the version of Terraform, and the version of the provider independently, should we choose to do so.

  • Decoupling of versions: The Terraform Interface is "relatively" stable now - tfenv would allow us to no longer require a specific version of the provider if we want to use a newer/older version of Terraform in my environment. HC decoupled the execution layer (TF) from the control layer very long ago and it dramatically improved the developer experience and the speed of development.

  • Enterprise requirements: we test our TF code & modules against specific versions of Terraform and specific versions of TF providers, we want to ensure that we can implement these requirements on the execution layer (Crossplane TF provider).

@DanielRis

@bobh66 bobh66 mentioned this pull request Feb 9, 2023
Copy link
Member

@ytsarev ytsarev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for this contribution.

Overall looks like a great addition; I've left a couple of comments.

@@ -568,7 +568,7 @@ func TestConnect(t *testing.T) {
},
usage: resource.TrackerFn(func(_ context.Context, _ resource.Managed) error { return nil }),
fs: afero.Afero{Fs: afero.NewMemMapFs()},
terraform: func(_ string) tfclient {
terraform: func(_ string, _ ...string) tfclient {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a dedicated test that would check the environment propagation?

&& chmod +x /usr/local/bin/terraform \
RUN git clone https://github.com/tfutils/tfenv.git /opt/tfenv \
&& ln -s /opt/tfenv/bin/* /usr/local/bin \
&& tfenv use 1.3.7 \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it intentional we use this exact hardcoded version here?

@Upbound-CLA
Copy link

Upbound-CLA commented Mar 29, 2023

CLA assistant check
All committers have signed the CLA.

@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.

4 participants