Is there way to set a value for vars.tfvars
by passing a string parameter from Jenkins?
Jenkins sting parameter. This is groovy scripeted pipeline
cat vars.tfvars
cat variables.tf
Is there way to set a value for vars.tfvars
by passing a string parameter from Jenkins?
Jenkins sting parameter. This is groovy scripeted pipeline
cat vars.tfvars
cat variables.tf
Dynamic values should be passed through the command line. And you can make use of .tfvars
file and command-line arguments at the same time like
terraform apply -var-file=vars.tfvars -var domain_name=test
and command line value will always take precedence over the value given in .tfvars
file
so in the case of groovy, it can go like
sh 'terraform apply -var-file=vars.tfvars -var domain_name=${domain_name}'