From 5822e57a6a7c53e4d2e3ba94ca4bc85392c7731e Mon Sep 17 00:00:00 2001 From: Jenna Goldstrich Date: Thu, 22 Aug 2024 12:03:44 -0700 Subject: [PATCH] Fix deprecated replicated_regions not using global replica count for base region --- builder/azure/arm/builder.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/builder/azure/arm/builder.go b/builder/azure/arm/builder.go index 93d06f98..836a0ab7 100644 --- a/builder/azure/arm/builder.go +++ b/builder/azure/arm/builder.go @@ -261,9 +261,16 @@ func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) for _, region := range b.config.SharedGalleryDestination.SigDestinationReplicationRegions { region := normalizeAzureRegion(region) if strings.EqualFold(region, buildLocation) { - // backwards compatibility DiskEncryptionSetId was set on the global config not on the target region. - // Users using target_region blocks are responsible for setting the DES within the block - normalizedRegions = append(normalizedRegions, TargetRegion{Name: region, DiskEncryptionSetId: b.config.DiskEncryptionSetId}) + normalizedRegions = append( + normalizedRegions, TargetRegion{ + Name: region, + // backwards compatibility DiskEncryptionSetId was set on the global config not on the target region. + // Users using target_region blocks are responsible for setting the DES within the block + DiskEncryptionSetId: b.config.DiskEncryptionSetId, + + ReplicaCount: b.config.SharedGalleryImageVersionReplicaCount, + }, + ) foundMandatoryReplicationRegion = true continue }