Closed pergardebrink closed 4 years ago
private static ISubnet getSubnetFromId(Construct scope, String id) {
return Subnet.fromSubnetAttributes(scope, "subnet_" + id,
SubnetAttributes.builder()
.subnetId(id)
.availabilityZone("dummy") // https://github.com/aws/aws-cdk/issues/8301
.build()
);
}
that code works for me as well. thanks for the workaround.
This is the bare minimum code to reproduce the issue:
vpc.selectSubnets(SubnetSelection.builder()
.subnets(Arrays.asList(
Subnet.fromSubnetId(this, "S", "s-d135fa9b")
))
.build());
When I try to use the Subnet.FromSubnetId method to construct a SubnetSelection, I get an error stating that I must add the availabilityZone. This does not really make any sense since I am specifying the subnet and not trying to filter anything?
Reproduction Steps
Error Log
Environment
Other
If I use the following code, it works, but it feels a bit ugly and hacky
This is :bug: Bug Report