diff --git a/pkg/cloud/services/network/subnets.go b/pkg/cloud/services/network/subnets.go index 0f6267019b..5ac8918cc1 100644 --- a/pkg/cloud/services/network/subnets.go +++ b/pkg/cloud/services/network/subnets.go @@ -133,6 +133,7 @@ func (s *Service) reconcileSubnets() error { // Update subnet spec with the existing subnet details existingSubnet.DeepCopyInto(sub) + sub.Tags = subnetTags if err := wait.WaitForWithRetryable(wait.NewBackoff(), func() (bool, error) { buildParams := s.getSubnetTagParams(unmanagedVPC, existingSubnet.GetResourceID(), existingSubnet.IsPublic, existingSubnet.AvailabilityZone, subnetTags, existingSubnet.IsEdge()) diff --git a/pkg/cloud/services/network/subnets_test.go b/pkg/cloud/services/network/subnets_test.go index 2f9bb77956..ddaf6124f2 100644 --- a/pkg/cloud/services/network/subnets_test.go +++ b/pkg/cloud/services/network/subnets_test.go @@ -676,7 +676,6 @@ func TestReconcileSubnets(t *testing.T) { AvailabilityZone: "us-east-1a", CidrBlock: "10.0.10.0/24", IsPublic: true, - Tags: infrav1.Tags{}, }, }, expect: func(m *mocks.MockEC2APIMockRecorder) { @@ -782,7 +781,6 @@ func TestReconcileSubnets(t *testing.T) { AvailabilityZone: "us-east-1a", CidrBlock: "10.0.10.0/24", IsPublic: true, - Tags: infrav1.Tags{}, }, { ID: "subnet-2", @@ -790,7 +788,6 @@ func TestReconcileSubnets(t *testing.T) { AvailabilityZone: "us-east-1b", CidrBlock: "10.0.11.0/24", IsPublic: true, - Tags: infrav1.Tags{}, }, }, expect: func(m *mocks.MockEC2APIMockRecorder) { @@ -4144,10 +4141,7 @@ func TestDiscoverSubnets(t *testing.T) { CidrBlock: "10.0.10.0/24", IsPublic: true, RouteTableID: aws.String("rtb-1"), - Tags: infrav1.Tags{ - "Name": "provided-subnet-public", - }, - ZoneType: ptr.To[infrav1.ZoneType]("availability-zone"), + ZoneType: ptr.To[infrav1.ZoneType]("availability-zone"), }, { ID: "subnet-2", @@ -4156,10 +4150,7 @@ func TestDiscoverSubnets(t *testing.T) { CidrBlock: "10.0.11.0/24", IsPublic: false, RouteTableID: aws.String("rtb-2"), - Tags: infrav1.Tags{ - "Name": "provided-subnet-private", - }, - ZoneType: ptr.To[infrav1.ZoneType]("availability-zone"), + ZoneType: ptr.To[infrav1.ZoneType]("availability-zone"), }, }, },