so I've been at this for a couple hours now at least. I've tried passing in two variables using the TF_VAR prefix. I've verified the pipeline is importing the var groups correctly in the logs. I'm thoroughly stumped and could really use some help haha.
references - How to pass Variables with Secrets (User, Password) in Terraform
https://developer.hashicorp.com/terraform/cli/config/environment-variables
Steps -
For DevOps secret variables, they won’t get mapped to environment variables for security reasons. You have to pass them as variables.
var.admin_password
and var.admin_user
in main.tf
.variable "admin_password" {
type = string
}
variable "admin_user" {
type = string
}
admin_password
and admin_user
to the terraform task using -var
argument.- task:TerraformTaskV3@3
displayName: 'Terraform Plan'
inputs:
command: 'plan'
workingDirectory: '$(Build.SourcesDirectory)'
environmentServiceName: '<service_connection_name>'
commandOptions:' -input=false -var "admin_password=$(TF_VAR_admin_password)" -var "admin_user=$(TF_VAR_admin_user)" '