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

workflows: Use setup-terraform install latest #839

Merged
merged 1 commit into from
Dec 10, 2024
Merged

Conversation

darkowlzz
Copy link
Contributor

@darkowlzz darkowlzz commented Dec 10, 2024

Terraform v1.10.0 had a bug in apply when reading variables from environment, refer hashicorp/terraform#36106 for details. This resulted in all of our CI setup that uses terraform to fail with the following error:

Error: Can't change variable when applying a saved plan

The variable tags cannot be set using the -var and -var-file options when
applying a saved plan file, because a saved plan includes the variable values
that were set when it was created. The saved plan specifies
"{\"environment\"=\"github\", \"ci\"=\"true\", \"repo\"=\"pkg\",
\"createdat\"=\"x2024-12-10_12h09m54s\"}" as the value whereas during apply
the value object with 4 attributes was set by an environment variable. To
declare an ephemeral variable which is not saved in the plan file, use
ephemeral = true.

Terraform v1.10.1 fixes this. But in all of our CI, we use ubuntu-latest (22.04), which was updated to terraform v1.10.0 as of last week, refer https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md.

Use setup-terraform to install the latest version of terraform.
Unlike Go, which is used on a daily basic by all the Flux developers, the terraform code and infrastructure gets maintenance updates occasionally. Hence, keeping it on a rolling version, which would make any failure due to incompatibility more visible for now.

CI results:

The runner image ubuntu-latest is still on terraform v1.10.0, which has
a bug in terraform apply. Use setup-terraform to install the latest
version which has a fix for it.

Signed-off-by: Sunny <[email protected]>
Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

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

Thanks @darkowlzz

@stefanprodan stefanprodan merged commit 84013d4 into main Dec 10, 2024
12 checks passed
@stefanprodan stefanprodan deleted the workflow-tf-setup branch December 10, 2024 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ci CI related issues and pull requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants