Skip to content

Commit 7a69b84

Browse files
Agent pool Parameters: set Tags to an empty map if AdditionalTags is nil
Signed-off-by: Piotr Lewandowski <[email protected]>
1 parent 073f846 commit 7a69b84

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

azure/services/agentpools/spec.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,11 @@ func (s *AgentPoolSpec) Parameters(ctx context.Context, existing interface{}) (p
265265
if s.SKU != "" {
266266
sku = &s.SKU
267267
}
268+
tags := converters.TagsToMap(s.AdditionalTags)
269+
if tags == nil {
270+
// Make sure we send a non-nil, empty map if AdditionalTags are nil as this tells AKS to delete any existing tags.
271+
tags = make(map[string]*string, 0)
272+
}
268273
var vnetSubnetID *string
269274
if s.VnetSubnetID != "" {
270275
vnetSubnetID = &s.VnetSubnetID
@@ -352,7 +357,7 @@ func (s *AgentPoolSpec) Parameters(ctx context.Context, existing interface{}) (p
352357
VnetSubnetID: vnetSubnetID,
353358
EnableNodePublicIP: s.EnableNodePublicIP,
354359
NodePublicIPPrefixID: s.NodePublicIPPrefixID,
355-
Tags: converters.TagsToMap(s.AdditionalTags),
360+
Tags: tags,
356361
LinuxOSConfig: linuxOSConfig,
357362
},
358363
}

0 commit comments

Comments
 (0)