Skip to content

Commit 67930a3

Browse files
authored
Merge pull request #552 from obabec/bug-resource-tags
Fix: Update number of allowed resource tags
2 parents 0d07e87 + 3b65a4b commit 67930a3

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

.web-docs/components/builder/arm/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ Providing `temp_resource_group_name` or `location` in combination with
312312

313313
- `azure_tags` (map[string]string) - Name/value pair tags to apply to every resource deployed i.e. Resource
314314
Group, VM, NIC, VNET, Public IP, KeyVault, etc. The user can define up
315-
to 15 tags. Tag names cannot exceed 512 characters, and tag values
315+
to 50 tags. Tag names cannot exceed 512 characters, and tag values
316316
cannot exceed 256 characters.
317317

318318
- `azure_tag` ([]{name string, value string}) - Same as [`azure_tags`](#azure_tags) but defined as a singular repeatable block

builder/azure/arm/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ type Config struct {
389389
ManagedImageZoneResilient bool `mapstructure:"managed_image_zone_resilient" required:"false"`
390390
// Name/value pair tags to apply to every resource deployed i.e. Resource
391391
// Group, VM, NIC, VNET, Public IP, KeyVault, etc. The user can define up
392-
// to 15 tags. Tag names cannot exceed 512 characters, and tag values
392+
// to 50 tags. Tag names cannot exceed 512 characters, and tag values
393393
// cannot exceed 256 characters.
394394
AzureTags map[string]string `mapstructure:"azure_tags" required:"false"`
395395
// Same as [`azure_tags`](#azure_tags) but defined as a singular repeatable block
@@ -1128,8 +1128,8 @@ func provideDefaultValues(c *Config) {
11281128
}
11291129

11301130
func assertTagProperties(c *Config, errs *packersdk.MultiError) {
1131-
if len(c.AzureTags) > 15 {
1132-
errs = packersdk.MultiErrorAppend(errs, fmt.Errorf("a max of 15 tags are supported, but %d were provided", len(c.AzureTags)))
1131+
if len(c.AzureTags) > 50 {
1132+
errs = packersdk.MultiErrorAppend(errs, fmt.Errorf("a max of 50 tags are supported, but %d were provided", len(c.AzureTags)))
11331133
}
11341134

11351135
for k, v := range c.AzureTags {

builder/azure/arm/config_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -931,9 +931,9 @@ func TestConfigShouldAcceptTag(t *testing.T) {
931931
}
932932
}
933933

934-
func TestConfigShouldRejectTagsInExcessOf15AcceptTags(t *testing.T) {
934+
func TestConfigShouldRejectTagsInExcessOf50AcceptTags(t *testing.T) {
935935
tooManyTags := map[string]string{}
936-
for i := 0; i < 16; i++ {
936+
for i := 0; i < 51; i++ {
937937
tooManyTags[fmt.Sprintf("tag%.2d", i)] = "ignored"
938938
}
939939

@@ -2096,7 +2096,7 @@ func TestPlanInfoPromotionCode(t *testing.T) {
20962096
// exceeds the max tag amount, the builder should reject the configuration.
20972097
func TestPlanInfoTooManyTagsErrors(t *testing.T) {
20982098
exactMaxNumberOfTags := map[string]string{}
2099-
for i := 0; i < 15; i++ {
2099+
for i := 0; i < 50; i++ {
21002100
exactMaxNumberOfTags[fmt.Sprintf("tag%.2d", i)] = "ignored"
21012101
}
21022102

builder/azure/dtl/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,8 +573,8 @@ func provideDefaultValues(c *Config) error {
573573
}
574574

575575
func assertTagProperties(c *Config, errs *packersdk.MultiError) {
576-
if len(c.AzureTags) > 15 {
577-
errs = packersdk.MultiErrorAppend(errs, fmt.Errorf("a max of 15 tags are supported, but %d were provided", len(c.AzureTags)))
576+
if len(c.AzureTags) > 50 {
577+
errs = packersdk.MultiErrorAppend(errs, fmt.Errorf("a max of 50 tags are supported, but %d were provided", len(c.AzureTags)))
578578
}
579579

580580
for k, v := range c.AzureTags {

builder/azure/dtl/config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,9 @@ func TestConfigShouldAcceptTags(t *testing.T) {
276276
}
277277
}
278278

279-
func TestConfigShouldRejectTagsInExcessOf15AcceptTags(t *testing.T) {
279+
func TestConfigShouldRejectTagsInExcessOf50AcceptTags(t *testing.T) {
280280
tooManyTags := map[string]string{}
281-
for i := 0; i < 16; i++ {
281+
for i := 0; i < 51; i++ {
282282
tooManyTags[fmt.Sprintf("tag%.2d", i)] = "ignored"
283283
}
284284

docs-partials/builder/azure/arm/Config-not-required.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174

175175
- `azure_tags` (map[string]string) - Name/value pair tags to apply to every resource deployed i.e. Resource
176176
Group, VM, NIC, VNET, Public IP, KeyVault, etc. The user can define up
177-
to 15 tags. Tag names cannot exceed 512 characters, and tag values
177+
to 50 tags. Tag names cannot exceed 512 characters, and tag values
178178
cannot exceed 256 characters.
179179

180180
- `azure_tag` ([]{name string, value string}) - Same as [`azure_tags`](#azure_tags) but defined as a singular repeatable block

0 commit comments

Comments
 (0)