Reputation: 2873
Problem
I am trying to retrieve the subnet cidr block range using CDKTF data_aws_subnet, but doing so gives me an output as $TfTokenTOKEN
instead of an actual cidr range (example 10.42.0.0/24)
Code
import cdktf_cdktf_provider_aws.data_aws_subnet as DataAwssubnet_
self.data_subnet = DataAwssubnet_.DataAwsSubnet(
self.scope_obj,self.id_, availability_zone = '$$-south-1a', vpc_id='vpc-0d$$$e$$$$2$$$$3')
print(self.data_subnet.cidr_block)
above code outputs some weird encrypted value instead of a string
How can I print this value using data_aws_subnet module of CDKTF?
Upvotes: 2
Views: 834
Reputation: 11921
You are looking at a Token there, to print the cidr_block
you need to use a TerraformOutput
.
import cdktf_cdktf_provider_aws.data_aws_subnet as DataAwssubnet_
from cdktf import TerraformOutput
self.data_subnet = DataAwssubnet_.DataAwsSubnet(
self.scope_obj,self.id_, availability_zone = '$$-south-1a', vpc_id='vpc-0d$$$e$$$$2$$$$3')
TerraformOutput(self, "subnet_cidr_block", value=self.data_subnet.cidr_block)
Upvotes: 2