Terraform: Display Outputs
Description:
By default, Terraform will display outputs during a terraform plan or apply, but follow this step if you need it to display a secret variable’s output.
To Resolve:
-
Let’s say you have a private key you need to connect to a linux server after creation.
- inside
outputs.tf
you have:
1 2 3 4
output "tls_private_key" { value = tls_private_key.vm_ssh_key.private_key_pem sensitive = true }
- inside
-
Then in your pipeline, just add this step after the terraform apply command:
1 2
- script: terraform output -raw tls_private_key displayName: 'terraform display key'
Comments