Let's say I have the following Terraform script:
locals {
provisioned_product_vpc_name = "provision-vpc-product"
}
resource "aws_cloudformation_stack" "provisioned_product_vpc" {
name = local.provisioned_product_vpc_name
template_body = "<foobar>"
}
data "aws_cloudformation_stack" "product_vpc" {
name = local.provisioned_product_vpc_name
depends_on = [aws_cloudformation_stack.provisioned_product_vpc]
}
How can I interactively see all the fields that aws_cloudformation_stack.product_vpc
has including the values. At the moment I have to manually open the AWS console and look for the correct values there.
Or is this not possible
There are few ways. You can just output
when you deploy:
output "product_vpc" {
value = data.aws_cloudformation_stack.product_vpc
}
You can also use TF console . Once you enter the console you just type:
data.aws_cloudformation_stack.product_vpc
You can also query the sate directly using sate show , though this will provide a bit different info then the other ones:
terraform state show data.aws_cloudformation_stack.product_vpc
But its not clear why would you use data source for that if you can directly access your resource aws_cloudformation_stack.provisioned_product_vpc
in the same way. No need for data source.
I'd like to add when making changes to the data sources, to also run terrafrom refresh
to pull the latest info before running terraform console
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.