sparse-intern-71089
06/16/2022, 3:10 PMbillowy-army-68599
jolly-church-88521
06/16/2022, 3:14 PM"" is not a valid CIDR block
somehow it’s empty 😕billowy-army-68599
jolly-church-88521
06/16/2022, 3:18 PMtype Subnets struct {
PrivateSubnets []*ec2.Subnet (...)
and method:
func (n *Networking) createPrivateSubnets(ctx *pulumi.Context, input types.Subnets) error {
for i, private := range input.Private {
subnetName := n.subnetNameGen("private", i)
subnet, err := ec2.NewSubnet(ctx, subnetName, &ec2.SubnetArgs{
VpcId: n.VPC.ID(),
CidrBlock: private.ToStringPtrOutput(),
Tags: pulumi.StringMap{
"Name": pulumi.String(subnetName),
},
}, pulumi.Parent(n))
if err != nil {
return err
}
n.Subnets.PrivateSubnets = append(n.Subnets.PrivateSubnets, subnet)
}
return nil
}
and then I’m trying to use it like:
func (n *Networking) createPrivateRoutes(ctx *pulumi.Context) error {
for i, subnet := range n.Subnets.PrivateSubnets {
routeTable, err := ec2.NewRouteTable(ctx, n.genUniqName("route-public", i), &ec2.RouteTableArgs{
VpcId: n.VPC.ID(),
Routes: ec2.RouteTableRouteArray{
&ec2.RouteTableRouteArgs{
CidrBlock: &subnet.CidrBlock,
GatewayId: n.InternetGateway.ID(),
}, (...)
billowy-army-68599
PrivateSubnets
a pointer? it has been a long time since I did this, but this worked:
https://github.com/jaxxstorm/jen20-pulumi-aws-vpc/blob/go/go/main.go#L128-L149jolly-church-88521
06/16/2022, 3:46 PMgray-fountain-32432
11/04/2022, 3:03 PM