broad-holiday-50009
01/31/2023, 11:07 PMerror: Duplicate resource URN 'urn:pulumi:dev::HNO1::aws:ec2/routeTableAssociation:RouteTableAssociation::rta-Calling __str__ on an Output[T] is not supported.
To get the value of an Output[T] as an Output[str] consider:
1. o.apply(lambda v: f"prefix{v}suffix")
See <https://pulumi.io/help/outputs> for more details.
This function may throw in a future version of Pulumi.-public'; try giving it a unique name
This is the code that is producing the error, I think I know what has caused it but I don't know how to fix it.
pub_rtas = []
for pub_subnet in pub_subnets:
rta_name = f"rta-{pub_subnet.id}-public"
pub_rtas.append(rta_name)
ec2.RouteTableAssociation(
rta_name,
subnet_id = pub_subnet.id,
gateway_id = igw.id,
route_table_id="HNO-route-table-public",
)
billowy-army-68599
01/31/2023, 11:14 PMrta_name = f"rta-{pub_subnet.id}-public"
You can’t concat a string with an Output[str]
broad-holiday-50009
01/31/2023, 11:15 PMpub_rtas = []
for pub_subnet in pub_subnets:
rta_name = pub_subnet.id
newCall = pub_rtas.append(f"{rta_name}-public")
ec2.RouteTableAssociation(
resource_name = newCall,
subnet_id = pub_subnet.id,
gateway_id = igw.id,
route_table_id="HNO-route-table-public",
)
billowy-army-68599
01/31/2023, 11:52 PMrta_name = pub_subnet.id
newCall = pub_rtas.append(f"{rta_name}-public")
this just assigned the value pub_subnet.id
to a string, so it’s still an Output[str]
so you still can’t concatenate
resource_name = newCall,
i din’t think that’s a valid parameterbroad-holiday-50009
01/31/2023, 11:55 PM