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

Fix regression in replicated_regions attribute #379

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions builder/azure/arm/step_publish_to_shared_image_gallery.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,13 @@ func buildAzureImageTargetRegions(regions []TargetRegion) []galleryimageversions
name := r.Name
tr := galleryimageversions.TargetRegion{Name: name}

id := r.DiskEncryptionSetId
tr.Encryption = &galleryimageversions.EncryptionImages{
OsDiskImage: &galleryimageversions.OSDiskImageEncryption{
DiskEncryptionSetId: &id,
},
if r.DiskEncryptionSetId != "" {
id := r.DiskEncryptionSetId
tr.Encryption = &galleryimageversions.EncryptionImages{
OsDiskImage: &galleryimageversions.OSDiskImageEncryption{
DiskEncryptionSetId: &id,
},
}
}
targetRegions = append(targetRegions, tr)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,10 @@ func TestPublishToSharedImageGalleryBuildAzureImageTargetRegions(t *testing.T) {
t.Errorf("expected configured region to contain same name as input %q but got %q", inputRegion.Name, tr.Name)
}

if (inputRegion.DiskEncryptionSetId == "") && (tr.Encryption != nil) {
t.Errorf("[%q]: expected configured region with no DES id to not contain encryption %q but got %v", tc.name, inputRegion.DiskEncryptionSetId, *tr.Encryption)
}

if (inputRegion.DiskEncryptionSetId != "") && (*tr.Encryption.OsDiskImage.DiskEncryptionSetId != inputRegion.DiskEncryptionSetId) {
t.Errorf("[%q]: expected configured region to contain set DES Id %q but got %q", tc.name, inputRegion.DiskEncryptionSetId, *tr.Encryption.OsDiskImage.DiskEncryptionSetId)
}
Expand Down
Loading