-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
base: main
Are you sure you want to change the base?
Conversation
3b589fa
to
0bcd433
Compare
92c559a
to
3207836
Compare
There was a problem hiding this 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 look good.
Subject: rng, | ||
}) | ||
} else { | ||
if v.Value.Equals(val) == cty.False { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cty.Values
can't be directly compared (which is why you're using Equals
). cty.Value
has True()
and False()
methods for boolean operations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note this probably works fine here due to the context so we don't ned to deal with nulls, unknowns, marks, etc. it's just that comparing a boolean in a boolean expression just looks so wrong ;)
} | ||
}, | ||
|
||
// "passing ephemeral variable through interactive prompts": func(t *testing.T, c *ApplyCommand, statePath, planPath string, done func(*testing.T) *terminal.TestOutput) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this something we intend to support?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we do, I was planning on doing it in a separate PR though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, I just tried the interactive prompt workflow, which is broken by this. Is there an easy way to disable interactive prompts in plan for now? The most common case for interactive prompts is someone simply running a combined plan+apply with terraform apply
, which fails with No value for required variable
.
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