From b06cfb61f782eed537aa327cda642eff5ebc6700 Mon Sep 17 00:00:00 2001 From: Yichun Ma Date: Thu, 19 May 2022 16:54:30 +0800 Subject: [PATCH] `r\shared_image`: Fix update issue related to unchanged `eula` --- internal/services/compute/shared_image_resource.go | 6 +++++- website/docs/r/shared_image.html.markdown | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/services/compute/shared_image_resource.go b/internal/services/compute/shared_image_resource.go index 3e348fbb8585..66a6bd78ad40 100644 --- a/internal/services/compute/shared_image_resource.go +++ b/internal/services/compute/shared_image_resource.go @@ -109,6 +109,7 @@ func resourceSharedImage() *pluginsdk.Resource { "eula": { Type: pluginsdk.TypeString, Optional: true, + ForceNew: true, }, "purchase_plan": { @@ -212,7 +213,6 @@ func resourceSharedImageCreateUpdate(d *pluginsdk.ResourceData, meta interface{} Location: utils.String(azure.NormalizeLocation(d.Get("location").(string))), GalleryImageProperties: &compute.GalleryImageProperties{ Description: utils.String(d.Get("description").(string)), - Eula: utils.String(d.Get("eula").(string)), Identifier: expandGalleryImageIdentifier(d), PrivacyStatementURI: utils.String(d.Get("privacy_statement_uri").(string)), ReleaseNoteURI: utils.String(d.Get("release_note_uri").(string)), @@ -224,6 +224,10 @@ func resourceSharedImageCreateUpdate(d *pluginsdk.ResourceData, meta interface{} Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } + if v, ok := d.GetOk("eula"); ok { + image.GalleryImageProperties.Eula = utils.String(v.(string)) + } + if d.Get("specialized").(bool) { image.GalleryImageProperties.OsState = compute.OperatingSystemStateTypesSpecialized } else { diff --git a/website/docs/r/shared_image.html.markdown b/website/docs/r/shared_image.html.markdown index bacdc9f75bc9..c260e5c688ba 100644 --- a/website/docs/r/shared_image.html.markdown +++ b/website/docs/r/shared_image.html.markdown @@ -68,7 +68,7 @@ The following arguments are supported: * `description` - (Optional) A description of this Shared Image. -* `eula` - (Optional) The End User Licence Agreement for the Shared Image. +* `eula` - (Optional) The End User Licence Agreement for the Shared Image. Changing this forces a new resource to be created. * `specialized` - (Optional) Specifies that the Operating System used inside this Image has not been Generalized (for example, `sysprep` on Windows has not been run). Defaults to `false`. Changing this forces a new resource to be created.