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

Upgrade terraform binary to v1.5.2 #175

Merged
merged 3 commits into from
Jun 30, 2023
Merged

Conversation

ytsarev
Copy link
Member

@ytsarev ytsarev commented Jun 29, 2023

Description of your changes

Fixes #172

I have:

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

How has this code been tested

uptest below

Fixes upbound#172

Signed-off-by: Yury Tsarev <yury@upbound.io>
Newer zips are failing with
```
unzip: zip flag 8 (streaming) is not supported
```

Signed-off-by: Yury Tsarev <yury@upbound.io>
@ytsarev
Copy link
Member Author

ytsarev commented Jun 29, 2023

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

@ytsarev
Copy link
Member Author

ytsarev commented Jun 29, 2023

Reconciling	{"controller": "managed/workspace.tf.upbound.io", "request": "/sample-inline"}
2023-06-29T22:16:44.052Z	DEBUG	provider-terraform	Cannot observe external resource	{"controller": "managed/workspace.tf.upbound.io", "request": "/sample-inline", "uid": "f2118465-9835-4a66-b019-00ec566125ea", "version": "987", "external-name": "sample-inline", "error": "cannot diff (i.e. plan) Terraform configuration: Terraform encountered an error. Summary: Unsupported argument. To see the full error run: echo \"H4sIAAAAAAAA/3SPTUrEQBCF932KR+PSxPUERAQ9guuhSFcmBZ2qpqrjKOLdZRbOLuv3w/eld3fzCR8ae2vmnQvIL/vG2lMCTDG7RbRKykNz+5TCPsymi1zGvqCKMk6PEMV/ikzXyFMCcJoAxErO5Tw7F9YuVOO8SGU8Iz/8NOrruFnZK/8+0TWGWy1GUckpveodBkobF+SDswwJqHXwV+P5ZrGy84g3Kfi2PW1MejiO/JL+AAAA//8BAAD//3ZLfKkJAQAA\" | base64 -d | gunzip", "errorVerbose": "Terraform encountered an error. Summary: Unsupported argument. To see the full error run: echo \"H4sIAAAAAAAA/3SPTUrEQBCF932KR+PSxPUERAQ9guuhSFcmBZ2qpqrjKOLdZRbOLuv3w/eld3fzCR8ae2vmnQvIL/vG2lMCTDG7RbRKykNz+5TCPsymi1zGvqCKMk6PEMV/ikzXyFMCcJoAxErO5Tw7F9YuVOO8SGU8Iz/8NOrruFnZK/8+0TWGWy1GUckpveodBkobF+SDswwJqHXwV+P5ZrGy84g3Kfi2PW1MejiO/JL+AAAA//8BAAD//3ZLfKkJAQAA\" | base64 -d | gunzip\ngithub.com/upbound/provider-terraform/internal/terraform.Classify\n\tgithub.com/upbound/provider-terraform/internal/terraform/terraform.go:71\ngithub.com/upbound/provider-terraform/internal/terraform.Harness.Diff\n\tgithub.com/upbound/provider-terraform/internal/terraform/terraform.go:500\ngithub.com/upbound/provider-terraform/internal/controller/workspace.(*external).checkDiff\n\tgithub.com/upbound/provider-terraform/internal/controller/workspace/workspace.go:300\ngithub.com/upbound/provider-terraform/internal/controller/workspace.(*external).Observe\n\tgithub.com/upbound/provider-terraform/internal/controller/workspace/workspace.go:318\ngithub.com/crossplane/crossplane-runtime/pkg/reconciler/managed.(*Reconciler).Reconcile\n\tgithub.com/crossplane/crossplane-runtime@v0.20.0-rc.0.0.20230320143010-c424c4aca5b0/pkg/reconciler/managed/reconciler.go:780\ngithub.com/crossplane/crossplane-runtime/pkg/ratelimiter.(*Reconciler).Reconcile\n\tgithub.com/crossplane/crossplane-runtime@v0.20.0-rc.0.0.20230320143010-c424c4aca5b0/pkg/ratelimiter/reconciler.go:54\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile\n\tsigs.k8s.io/controller-runtime@v0.14.6/pkg/internal/controller/controller.go:122\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\tsigs.k8s.io/controller-runtime@v0.14.6/pkg/internal/controller/controller.go:323\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\tsigs.k8s.io/controller-runtime@v0.14.6/pkg/internal/controller/controller.go:274\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\tsigs.k8s.io/controller-runtime@v0.14.6/pkg/internal/controller/controller.go:235\nruntime.goexit\n\truntime/asm_amd64.s:1594\ncannot diff (i.e. plan) Terraform configuration\ngithub.com/upbound/provider-terraform/internal/controller/workspace.(*external).checkDiff\n\tgithub.com/upbound/provider-terraform/internal/controller/workspace/workspace.go:303\ngithub.com/upbound/provider-terraform/internal/controller/workspace.(*external).Observe\n\tgithub.com/upbound/provider-terraform/internal/controller/workspace/workspace.go:318\ngithub.com/crossplane/crossplane-runtime/pkg/reconciler/managed.(*Reconciler).Reconcile\n\tgithub.com/crossplane/crossplane-runtime@v0.20.0-rc.0.0.20230320143010-c424c4aca5b0/pkg/reconciler/managed/reconciler.go:780\ngithub.com/crossplane/crossplane-runtime/pkg/ratelimiter.(*Reconciler).Reconcile\n\tgithub.com/crossplane/crossplane-runtime@v0.20.0-rc.0.0.20230320143010-c424c4aca5b0/pkg/ratelimiter/reconciler.go:54\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile\n\tsigs.k8s.io/controller-runtime@v0.14.6/pkg/internal/controller/controller.go:122\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\tsigs.k8s.io/controller-runtime@v0.14.6/pkg/internal/controller/controller.go:323\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\tsigs.k8s.io/controller-runtime@v0.14.6/pkg/internal/controller/controller.go:274\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\tsigs.k8s.io/controller-runtime@v0.14.6/pkg/internal/controller/controller.go:235\nruntime.goexit\n\truntime/asm_amd64.s:1594"}

Getting this feedback from uptest, it looks like this upgrade will need more love than just the version bump :)

@mbbush
Copy link

mbbush commented Jun 29, 2023

Error: Unsupported argument

  on crossplane-provider-config.tf line 9, in provider "aws":
   9:   shared_credentials_file = "${path.module}/aws-creds.ini"

An argument named "shared_credentials_file" is not expected here. Did you
mean "shared_credentials_files"?

This is a difference between the aws terraform provider version 4.x and 5.x.
https://registry.terraform.io/providers/hashicorp/aws/4.67.0/docs#aws-configuration-reference
vs
https://registry.terraform.io/providers/hashicorp/aws/latest/docs#aws-configuration-reference

What's not obvious to me (but hopefully is to you) is why upgrading the terraform version would automatically update the version of the aws provider.

@bobh66
Copy link
Collaborator

bobh66 commented Jun 29, 2023

What's not obvious to me (but hopefully is to you) is why upgrading the terraform version would automatically update the version of the aws provider.

If you don't pin the provider version it will often/usually upgrade to the latest provider on a new deployment (cache is empty) as it always pulls the latest version unless you tell it to pull a specific version

@ytsarev
Copy link
Member Author

ytsarev commented Jun 30, 2023

@mbbush @bobh66 Thanks for the feedback, folks. I am updating examples/providerconfig-aws.yaml that is involved in uptest setup with pinning to the newer version and updating the spec

@ytsarev
Copy link
Member Author

ytsarev commented Jun 30, 2023

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

Signed-off-by: Yury Tsarev <yury@upbound.io>
@ytsarev
Copy link
Member Author

ytsarev commented Jun 30, 2023

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

@ytsarev
Copy link
Member Author

ytsarev commented Jun 30, 2023

@bobh66 it seems that stuff got green, please review :)

Copy link
Collaborator

@bobh66 bobh66 left a comment

Choose a reason for hiding this comment

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

LGTM - thanks!

ENV TF_IN_AUTOMATION=1
ENV TF_PLUGIN_CACHE_DIR=/tf/plugin-cache

ADD "bin/${TARGETOS}_${TARGETARCH}/provider" /usr/local/bin/crossplane-terraform-provider
ADD .gitconfig .gitconfig

RUN curl -s -L https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_${TARGETOS}_${TARGETARCH}.zip | \
unzip -d /usr/local/bin - \
RUN curl -s -L https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_${TARGETOS}_${TARGETARCH}.zip -o terraform.zip \
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just curious why this change is needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

unzip from the pipe stream is failing with the new terraform zips

unzip: zip flag 8 (streaming) is not supported

so it breaks the build.

The closest issue upstream I found is richgel999/miniz#180 .

Instead of diving into unzip specifics, I just decided to unzip it simple file-based way :)

@ytsarev ytsarev merged commit 49a0ee0 into upbound:main Jun 30, 2023
10 checks passed
@ytsarev ytsarev deleted the terraform-up branch June 30, 2023 14:26
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.

Upgrade terraform to latest version
3 participants