sparse-intern-71089
09/21/2022, 4:05 PMbored-oyster-3147
09/21/2022, 4:15 PMfancy-xylophone-7581
09/21/2022, 4:18 PMbored-oyster-3147
09/21/2022, 4:50 PMawait vpc.publicSubnets
which is where my confusion lies. But what you should be doing is using the Get Existing Subnet
function.
That is here: https://www.pulumi.com/registry/packages/aws/api-docs/ec2/subnet/#look-up
Or, you can use this function to get a list of subnets from an existing VPC: https://www.pulumi.com/registry/packages/aws/api-docs/ec2/getsubnetids/
Once you have the result of either function you can use the subnet ID to instantiate your aws.ec2.Tag
resource. This should not need to occur within an async context.
In either case, you want to make sure you are not using the aws.ec2.Tag
resource to add tags to a resource that is also being managed from the same pulumi project. Because for instance in the case of a subnet your separate aws.ec2.Tag
resource will conflict with the values you provided the aws.ec2.SubnetArgs.Tags
property.fancy-xylophone-7581
09/21/2022, 5:28 PMget publicSubnets(): Promise<x.ec2.Subnet[]>;
I am using await to resolve the Promise. This is what I want to do:
1. Create a VPC
2. Create a EKS cluster with that VPC
3. Get Public Subnets of that VPC
4. Attach Tags kubernetes.io/role/elb=1 to each public subnet
However, when I get subnet.tags, it always says the properties is null.bored-oyster-3147
09/21/2022, 5:32 PMx
? Are you using crosswalk? And if so what version of crosswalk are you using?fancy-xylophone-7581
09/21/2022, 5:32 PMfancy-xylophone-7581
09/21/2022, 5:33 PMbored-oyster-3147
09/21/2022, 5:34 PMpublicSubnets()
function coming from? Is that something you defined? Are you using EKS
provider?fancy-xylophone-7581
09/21/2022, 5:35 PMfancy-xylophone-7581
09/21/2022, 5:37 PMfancy-xylophone-7581
09/21/2022, 5:40 PMbored-oyster-3147
09/21/2022, 5:45 PMawsx
resources are ComponentResources
. Meaning they contain declarations of aws
provider resources with common settings. So if you look at the implementation of awsx.ec2.Vpc
here you'll see that it is declaring an instance of awsx.ec2.Subnet
which if you follow that you will see that that declares and instance of aws.ec2.Subnet
here. So that is where your "default" subnets are coming from. Point being that that are managed by your pulumi project.
So in your current scenario, if you want to add tags to those subnets you should do it before they are created. You should do this by passing some information to the subnets
property of awsx.ec2.VpcArgs
which is here, the awsx.ec2.VpcSubnetArgs
type has a tags
property.
If you want to add tags to a subnet that already exists, it can't be managed by the same pulumi project - and in this case you can just use the method I mentioned above already.fancy-xylophone-7581
09/21/2022, 5:47 PM