From 088d2b0b528efc59a09bcfb4d658446af0adecd6 Mon Sep 17 00:00:00 2001 From: Damien Duportal Date: Sat, 14 May 2022 20:44:11 +0200 Subject: [PATCH] fix(azure VM galleries) do not specify tags to avoid https://github.com/hashicorp/terraform-provider-azurerm/issues/16792 Signed-off-by: Damien Duportal --- packer-resources.tf | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/packer-resources.tf b/packer-resources.tf index 97447c55..d6d9444d 100644 --- a/packer-resources.tf +++ b/packer-resources.tf @@ -44,15 +44,21 @@ resource "azurerm_shared_image" "jenkins_agent_images" { specialized = false trusted_launch_enabled = false + lifecycle { + ignore_changes = [ + eula, accelerated_network_support_enabled + ] + } + identifier { publisher = format("jenkins-agent-%s", split("_", each.value)[1]) offer = format("jenkins-agent-%s", split("_", each.value)[1]) sku = format("jenkins-agent-%s", split("_", each.value)[1]) } - timeouts {} - - tags = { - scope = "terraform-managed" - } + ## No tags otherwise there is the following error when applying: + # creating/updating Shared Image: (Image Name "jenkins-agent-ubuntu-20.04" / Gallery Name "prod_packer_images" / Resource Group "prod-packer-images"): compute.GalleryImagesClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status= Code="PropertyChangeNotAllowed" Message="Changing property 'galleryImage.properties.eula' is not allowed." Target="galleryImage.properties.eula" + # tags = { + # scope = "terraform-managed" + # } }