-
Notifications
You must be signed in to change notification settings - Fork 881
feat: load variables from tfvars files #11549
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
varsFiles, err = DiscoverVarsFiles(uploadFlags.directory) | ||
if err != nil { | ||
return err | ||
} |
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 could imagine a case where someone had tfvars files lying around unused before, worked around the issue, and left them there. Now we're going to auto-discover them. I'm not sure what this will break.
Should at the very least add an info message about the auto-discovered vars files?
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.
Ok, I changed the code to print a message alerting about the presence of tfvars 👍
stringData[attribute.Name] = ctyValue.AsString() | ||
} else if ctyType.Equals(cty.Number) { | ||
stringData[attribute.Name] = ctyValue.AsBigFloat().String() | ||
} else if ctyType.IsTupleType() { |
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 immediately saw this, thought 🤔 "y no switch", and then saw how annoying this is.
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.
Yes, unfortunately the API isn't too friendly :)
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.
LGTM, some comments.
Fixes: #8501
This PR expands the
template push
andtemplate create
to review.tfvars
and.tfvars.json
files while uploading next template version. CLI will support a flat variable structure:HCL
JSON
TODO: