-
Notifications
You must be signed in to change notification settings - Fork 242
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
Missing documentation on how to pass variables to terraform #35
Comments
What would you like to see in the documentation regarding variables? Also, I am unable to reproduce the issue where setting
|
The problem related to TF_VAR environment variables was due to Terraform Cloud not supporting environment variables, I completely forgot it was not supported and I spent a good amount of hours before realizing that was the issue by looking again at the docs. This could be something worth mentioning also in this GitHub Action as it is not the expected behavior. As for what I would like to see in the documentation is an example of variables passed via CLI and The following example works for Terraform Cloud:
There is a more elegant way to achieve the same result, but that's what we are working with right now. I would also be expecting:
A few snippets and samples are more than enough to help newcomers. A disclaimer could also save other people quite some time. Thanks! |
I would also like to know when should the environment variable passed:
I am sure this is not strictly related to the GitHub Action but rather Terraform itself, but some documentation pointing that out would be useful. |
Following the suggestion from @christian-roggia does not appear to be working for me either. If anyone has any other tips, it would be greatly appreciated. |
@mibeyene It did worked for me. I've done almost what it was suggested by @christian-roggia Added the following step in my yml file - name: Setup Terraform variables
id: vars
run: |-
cat > pipeline.auto.tfvars <<EOF
environment = "${{ fromJSON('["pr", "main"]')[github.ref == 'refs/heads/main'] }}"
EOF Define the variable in variables.tf
|
Weird. I currently have:
My variables.tf file goes one step further (as a temporary WTF-is-happening solution):
And it should all come together here:
But instead of the plan speaking against "aws-default-SENSITIVE-nomad-s3-snapshot", it looks against "aws-default--nomad-s3-snapshot" ¯_(ツ)_/¯
I'll continue poking at this today, and update this thread accordingly. |
@mibeyene The only difference I see is this - name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
cli_config_credentials_token: ${{ secrets.TF_TOKEN }} output Run hashicorp/setup-terraform@v1
with:
cli_config_credentials_token: ***
cli_config_credentials_hostname: app.terraform.io
terraform_version: latest
terraform_wrapper: true
Latest version is 0.14.2 |
The answer was in terraform state. A previous apply created a vault_aws_secret_backend_role resource with the incorrect name. Thank you so much for taking the time to look @adeel41, and apologies to @christian-roggia |
If anyone is up for the task, it would be really beneficial to include some examples and an explanation to the docs. |
The documentation in #79 assisted me in passing the image version in my github actions workflow to terraform. Appreciate it! |
There is currently no documentation on how to pass variables to terraform.
Additionally, it seems like setting environment variables TF_VAR have no effect:
The text was updated successfully, but these errors were encountered: