I am trying to connect multiple subnets to the same publicRoutetable, I don't know if I am doing it right, I am very new to Pulumi and AWS. Please let me know how to do that.
I am getting an error:
error: Duplicate resource URN 'urn:pulumi:Dev::Iac_pulumi::aws:ec2/routeTableAssociation:RouteTableAssociation::publicRouteTableAssociationCalling 'toString' on an 'Output\<T\>' is not supported.
This is because the value of an 'Output' is asynchronous.
To get the value of an Output\<T\> as an Output\<String\> consider either:
1: applyValue(v -\> String.format("prefix%ssuffix", v))
2: Output.format("prefix%ssuffix", o)
Here is my code snippet:
for (Subnet publicSubnet : publicSubnets) {
new RouteTableAssociation("publicRouteTableAssociation" + publicSubnet.id(), RouteTableAssociationArgs.builder()
.routeTableId(publicRouteTable.id())
.subnetId(publicSubnet.id())
.build());
}