Skip to content

Is there a way to inject variables into a Terraform apply run from another process outside of Terraform? #31

Answered by rhoboat
rhoboat asked this question in Help
Discussion options

You must be logged in to vote

Most likely you'll need to set a variable in Terraform using one of the standard ways of assigning values to root module variables. If you're using Terragrunt, you would write the value to a terragrunt.hcl file.

Some programmatic options:

  • If you are doing this for testing, then we have terratest where you can use Go to dynamically generate variables and drive terraform apply. Examples of this are at terratest.gruntwork.io (Open source: no subscription needed)
  • If you want to do a CI/CD workflow where you are updating variables to commit to git, then we have terraform-update-variable, which is a bash script that can update a tfvars or terragrunt.hcl file and commit the update to git: https…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rhoboat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant