In this Terraform blog post, we will show to output sensitive information like passwords with the Terraform output command.
When using Terraform to configure Azure resources, there are times when we need to retrieve information like access keys using Terraform.
An excellent example of a scenario like this is when creating a storage account or an ACR account. We can use Terraform to output the secret key or the admin password.
Terraform Output
In the below example, I have an output file that outputs an ACR secret.
output "adminpassword" {
value = azurerm_container_registry.acr.adminpassword
sensitive = true
}
After the terraform apply
the command is completed, we need to use the following control to output the sensitive information.
terraform output -json