Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missed subnetSpec.tags while specifying the cidrBlocks of subnet #1233

Closed
lanfuchao opened this issue Mar 3, 2024 · 2 comments
Closed

Missed subnetSpec.tags while specifying the cidrBlocks of subnet #1233

lanfuchao opened this issue Mar 3, 2024 · 2 comments
Assignees
Labels
area/tags impact/usability Something that impacts users' ability to use the product easily and intuitively kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed

Comments

@lanfuchao
Copy link

While creating vpc with specified cidrBlocks of subnet, the subnet created will be not set the tags from SubnetArgs.

Expected "subnet-tag-public" and "subnet-tag-private" are disappeared
image

How to reproduce

package main

import (
	"github.com/pulumi/pulumi-awsx/sdk/v2/go/awsx/ec2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/tidbcloud/infra-cd-go/pkg/util"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ec2.NewVpc(ctx, "test-vpc", &ec2.VpcArgs{
			AvailabilityZoneNames: []string{"us-west-2a"},
			NatGateways: &ec2.NatGatewayConfigurationArgs{
				Strategy: ec2.NatGatewayStrategySingle,
			},
			CidrBlock:      util.Ref("10.0.0.0/16"),
			SubnetStrategy: util.Ref(ec2.SubnetAllocationStrategyAuto),
			Tags: pulumi.StringMap{
				"vpc-tag": pulumi.String("true"),
			},
			SubnetSpecs: []ec2.SubnetSpecArgs{
				{
					Type:       ec2.SubnetTypePublic,
					Name:       pulumi.StringRef("public"),
					CidrBlocks: []string{"10.0.0.0/20"},
					Tags: pulumi.ToStringMap(map[string]string{
						"subnet-tag-public": "1",
					}),
				},
				{
					Type:       ec2.SubnetTypePrivate,
					Name:       pulumi.StringRef("private"),
					CidrBlocks: []string{"10.0.128.0/20"},
					Tags: pulumi.ToStringMap(map[string]string{
						"subnet-tag-private": "1",
					}),
				},
			},
		})
		return err
	})
}

Possible issue

Missed to return tags in getSubnetSpecsExplicit function

subnets.push({
cidrBlock: subnetCidr,
type: subnetSpec.type,
azName,
subnetName: subnetName(vpcName, subnetSpec, azNum),
});

@mjeffryes mjeffryes added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Mar 5, 2024
@mjeffryes
Copy link
Contributor

thanks for reporting this @lanfuchao. I agree that's probably where the tags are being dropped.

@mjeffryes mjeffryes added impact/usability Something that impacts users' ability to use the product easily and intuitively area/tags and removed needs-triage Needs attention from the triage team labels Mar 11, 2024
@flostadler
Copy link
Contributor

This was fixed as part of: #1288 and released in v2.10.0

@flostadler flostadler added the resolution/fixed This issue was fixed label May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/tags impact/usability Something that impacts users' ability to use the product easily and intuitively kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
Development

No branches or pull requests

3 participants