-
Notifications
You must be signed in to change notification settings - Fork 875
fix(provisioner/terraform/tfparse): evaluate coder_parameter defaults with variables #15800
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
Conversation
defaultsM[dataResource.Name] = strings.Trim(value, `"`) | ||
// Issue #15795: the "default" value could also be an expression we need | ||
// to evaluate. | ||
// TODO: should we support coder_parameter default values that reference other coder_parameter data sources? |
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.
Has there been an ask? If not, we can probably defer it until such a time. It's best to be careful how much we expand the scope of these expressions.
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'm not aware of any ask for this just yet. I'd much prefer to defer it as it opens up several cans of worms.
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.
It is sort of a FIXME :)
resource "foo_bar" "baz" {} | ||
variable "region" { | ||
type = string | ||
default = "us" |
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 don't remember the current bevahior, so let me ask -
how this solution will perform if we have a variable without a default value? AFAIR Coder should require to input the value for variable.
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.
Correct, if there is no default value we will fail this 'preflight' check with an error. This only happens if you're using the coder_workspace_tags
data source.
defaultsM[dataResource.Name] = strings.Trim(value, `"`) | ||
// Issue #15795: the "default" value could also be an expression we need | ||
// to evaluate. | ||
// TODO: should we support coder_parameter default values that reference other coder_parameter data sources? |
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.
It is sort of a FIXME :)
… with variables (#15800) - adds support for dynamic default values in coder_parameter data source
Relates to #15795
Previously we had not been evaluating the default value of a
coder_parameter
before extracting the tags. This PR adds support for dynamic default values from a variable.It does not add support for 'chaining' parameter default values, as I could imagine us ending up in a situation where we have a cyclic dependency.