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

Pass ephemeral variables to terraform apply #35903

Merged
merged 14 commits into from
Nov 7, 2024

Conversation

DanielMSchmidt
Copy link
Contributor

@DanielMSchmidt DanielMSchmidt commented Oct 25, 2024

This PR improves how we can pass values to ephemeral variables in the apply command, now CLI flags, environment variables, and vars files are supported. We will deal with interactive inputs in a separate PR to keep this one smaller.

Jira: TF-21848

Target Release

1.10.x

Draft CHANGELOG entry

ENHANCEMENTS

  • Allow apply-time ephemeral variables

@DanielMSchmidt DanielMSchmidt marked this pull request as ready for review November 4, 2024 14:35
@DanielMSchmidt DanielMSchmidt force-pushed the pass-ephemeral-variables-to-terraform-apply branch from 92c559a to 3207836 Compare November 4, 2024 14:35
@radeksimko radeksimko added the 1.10-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged label Nov 4, 2024
Copy link
Member

@jbardin jbardin left a comment

Choose a reason for hiding this comment

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

Just a couple things inline, but overall this looks good.

internal/backend/local/backend_apply.go Outdated Show resolved Hide resolved
internal/command/apply_test.go Outdated Show resolved Hide resolved
they are by definition the same as in the plan, but there is no reason to skip the validation step
Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

LGTM

internal/command/apply.go Show resolved Hide resolved
@DanielMSchmidt DanielMSchmidt merged commit 4a36348 into main Nov 7, 2024
10 checks passed
@DanielMSchmidt DanielMSchmidt deleted the pass-ephemeral-variables-to-terraform-apply branch November 7, 2024 16:42
Copy link
Contributor

github-actions bot commented Nov 7, 2024

Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch.

@roman-zilist
Copy link

roman-zilist commented Dec 4, 2024

This change broke a lot of our pipelines with the following error:
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 ................................................................................................................................... │ as the value whereas during apply the value object with 9 attributes was │ set by an environment variable. To declare an ephemeral variable which is │ not saved in the plan file, use ephemeral = true.

It would be great if new TF versions were backward compatible!

@jbardin
Copy link
Member

jbardin commented Dec 4, 2024

@roman-zilist, the regression was a bug which was fixed by #36121. Are you still seeing this with the current 1.10.1 release?

@roman-zilist
Copy link

@jbardin Yes, we're still experiencing the same issue. I assume we're using the latest version because of
required_version = ">= 1.7.5"

@jbardin
Copy link
Member

jbardin commented Dec 4, 2024

@roman-zilist, if you can confirm that you are using v1.10.1 please file a new issue. #36106 was closed with the v1.10.1 release, and comments on an old PR are not going to be triaged.

Thanks!

@roman-zilist
Copy link

@jbardin We've decided to rollback to the most recent stable version 1.9.8 and pin all our terraform templates to use it. This is neither the first, nor the second time we get burned by dealing with newest terraform/terraform provider versions which introduce bugs that break our pipelines and derail prod deployments. We use Terraform to build and deploy many of our products, and we're extremely disappointed with reliability of Hashicorp Terraform platform

Copy link
Contributor

github-actions bot commented Jan 4, 2025

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1.10-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants