How to Get Values from output GCP
Get terraform outputs
The terraform output command is used to extract the value of an output variable from the state file. Terraform documentation can be found here
Go into the directory with the main.tf
and terraform.tfstate
to run the terraform output command. Add -json parameter for a more readable output.
terraform output -json
Example
terraform output -json
{
"Access_Key": {
"sensitive": false,
"type": "string",
"value": "projects/gcp-project-123/hmacKeys/GOOG1EC62JWZUXHHAQ3GRARQS4G2E3DASPOBYFAKEACCESSKEYID"
},
"Secret_Key": {
"sensitive": true,
"type": "string",
"value": "7BIaBemdMkG/8zxLMcU+mgYFAKESECRETKEYID"
},
"bucket_names": {
"sensitive": false,
"type": "string",
"value": "fake-bucket-name-1"
}
}
$
- Access_Key an identifier for the resource with format projects/{{project}}/hmacKeys/{{access_id}}
- Secret_Key HMAC secret key material. Note: This property is sensitive and will not be displayed in the plan.
- bucket_names The list of names for the buckets created
Updated over 1 year ago