flaky-arm-38472
08/17/2022, 3:21 AM_, err = ec2.NewRoute(ctx, "my-route", &ec2.RouteArgs{
RouteTableId: routeTable.ID(),
DestinationCidrBlock: pulumi.String("0.0.0.0/0"),
GatewayId: pulumi.String("igw-xxxf0axxx"),
})
On the GatewayId field, to have the type T or accept a generic type?.
I am trying to don't repeat a lot of the same definitions to create routes. Some of my routes require TransitGatewayId or NatGatewayId instead. Do I have to create every single route repeating all the code and changing that field one by one?mammoth-country-64756
08/17/2022, 10:47 AMfor _, subnetType := range subnetTypes {
for _, az := range azs.Names {
var mapPublicIp pulumi.Bool
if subnetType == "private" {
mapPublicIp = pulumi.Bool(false)
} else {
mapPublicIp = pulumi.Bool(true)
}
subnetName := fmt.Sprintf("%s-%s-%s", component, subnetType, az)
subnet, err := ec2.NewSubnet(ctx, subnetName, &ec2.SubnetArgs{
AvailabilityZone: pulumi.String(az),
VpcId: vpc.ID(),
CidrBlock: pulumi.String(subnetCIDRBlocks[subnetCount].CIDR()),
MapPublicIpOnLaunch: mapPublicIp,
Tags: pulumi.StringMap{
"Name": pulumi.String(subnetName),
"<http://kubernetes.io/role/elb|kubernetes.io/role/elb>": pulumi.String("1"),
},
})
if err != nil {
return err
}
subnetIDs[subnetType] = append(subnetIDs[subnetType], subnet.ID())
subnetCount = subnetCount + 1
}
}
flaky-arm-38472
08/18/2022, 7:37 AM