-
-
Notifications
You must be signed in to change notification settings - Fork 998
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
Terraform cloud provider - Variables not sent #929
Comments
Terragrunt passes the variables in Try an experiment where you use |
Hi @brikis98 , I need to read more about Terraform cloud and see what's possible or not. I will update here with what I found. |
Thx for investigating @maximerenou50. I'm surprised env vars don't work, so perhaps file a bug with the HashiCorp team and see what they say? |
Environment variables won't work if you have the terraform cloud workspace configured to use 'remote' execution mode, meaning that the terraform cli will actually be invoked on a VM hosted by terraform cloud. You can read about it here and here. To pass vars when using 'remote' execution mode you have to place them into a The best solution I came up with to deal with this is to generate an
Would be replaced with this:
I'm not sure how to accomplish placing outputs from a dependent module into the generated file though. It seems that |
According to the docs on configuration parsing order, I think the dependency outputs should be available. Have you tried wrapping them in
|
I swear I had tried that and it didn't work. However, I just tried again and it did work with one modification to your suggestion. I had to place quotes around the values since the variables are string variables, like this:
|
I don't believe the work around above is an object/map. Has anyone gotten around this?
I have tried wrapping it with |
I had my scenario working at one point with a map variable. I believe I had to do it using a go templating for loop to iterate through each key/value and print each key/value into the generate block 1 at a time. Terragrunt ultimately didn't fit my use-case, so I unfortunately no longer have an example of exactly how this is done. Hopefully you can post back here if you figure it out @michaelssingh |
Are you saying |
Similar issue "Invalid template interpolation value; Cannot include the given value in a string template: string required." local.region_vars.locals.azs is a list(string) ${local.region_vars.locals.azs} = invalid template interpolation when used in a generate block heredoc Using join/split works but is not ideal |
@krisdevopsbot mind showing an example of how you would it work using join/split? or @michaelssingh did you ever sort out how to get around |
I believe all the interpolation issues around complex types can be worked around by using
|
The above (generating auto.tfvars) solves the problem of missing variable inputs with terraform cloud, however terragrunt keeps initializing on every terragrunt plan / apply. The prompt for apply/destroy is also missing and changes are going through as if --terragrunt-non-interactive is specified. Is anyone else experiencing the same? (v0.35.16) |
Hello,
My company is currently using Terragrunt with Terraform 0.12, using AWS S3 and DynamoDB as a backend. It works like a charm :)
I was looking into Terraform cloud as a new backend, it offers some interesting features.
Currently, I'm having issues when trying to use that backend, variables are not being sent to Terraform cloud, so I'm having that kind of errors:
I do see the remote plan in Terraform cloud, everything else seems to be working as expected, only the variables are not sent. Here are my files:
terragrunt.hcl
main_providers.tf
I'm using the exact same module with the exact same variables with an S3/DynamoDB backend and it's working fine (variables are being sent to the module).
Maybe I'm missing something obvious, or Terragrunt doesn't support Terraform cloud at the moment.
FYI, without Terragrunt, the following files are working:
main.tf
backend.tf
Thanks!
The text was updated successfully, but these errors were encountered: