hi everyone, I created a vpc with awsx.ec2.Vpc and...
# aws
c
hi everyone, I created a vpc with awsx.ec2.Vpc and I let it create the subnets for me. I now need to add some tags to those subnets. Is importing the subnets the way to go for this? Been trying to get that to work, but not there yet, but would like to know I'm on the right track.
Trying this directly after the awsx.ec2.vpc creation: for (var subnet of vpc.getSubnets("private")) { new aws.ec2.Subnet(subnet.subnetName, { vpcId: vpc.id, cidrBlock: subnet.subnet.cidrBlock }, { import: subnet.id }) } There's at least a typing issue between the subnet.id and import, which I cannot seem to fix even though I know both of the types (ts noob). Casting to any however results in subnet replacement. Am I doing this right?
This faired a little better: for (var subnet of vpc.getSubnets("private")) { subnet.id.apply(id => new aws.ec2.Subnet(subnet.subnetName, { vpcId: vpc.id, cidrBlock: subnet.subnet.cidrBlock }, { import: id })) } But preview gives me the error: 'Duplicate resource URN'.. which doesn't seem right on an import. I also get the warning: "inputs to import do not match the existing resource; importing this resource will fail"
in the hops that the warning would go away, i've added the rest of subnetargs... but it's still warning that 'tags' will be changed, so must not be specifying those correctly. I'm trying to bring them over from the other subnet just like 'cidrBlock' in the last code sample.
this typescript noob couldn't figure out how to get the tags over from the existing subnet cleanly, but specified them by hand and that made everything match up.