From 0e6b7008b2a271f4e9e1fd85c40116528e1134fc Mon Sep 17 00:00:00 2001 From: teowa <104055472+teowa@users.noreply.github.com> Date: Wed, 29 Nov 2023 10:46:31 +0000 Subject: [PATCH 1/2] fix update template_spec_version_id --- .../resource/resource_group_template_deployment_resource.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/services/resource/resource_group_template_deployment_resource.go b/internal/services/resource/resource_group_template_deployment_resource.go index 8e934b660523..676340f6c561 100644 --- a/internal/services/resource/resource_group_template_deployment_resource.go +++ b/internal/services/resource/resource_group_template_deployment_resource.go @@ -242,6 +242,10 @@ func resourceGroupTemplateDeploymentResourceUpdate(d *pluginsdk.ResourceData, me deployment.Properties.TemplateLink = &resources.TemplateLink{ ID: utils.String(d.Get("template_spec_version_id").(string)), } + + if d.Get("template_spec_version_id").(string) != "" { + deployment.Properties.Template = nil + } } if d.HasChange("tags") { From ae8904f27e595666379c05349bcf6cd54f3dcc9e Mon Sep 17 00:00:00 2001 From: teowa <104055472+teowa@users.noreply.github.com> Date: Thu, 30 Nov 2023 02:31:33 +0000 Subject: [PATCH 2/2] fix for similar resources --- .../resource/management_group_template_deployment_resource.go | 4 ++++ .../resource/subscription_template_deployment_resource.go | 4 ++++ .../services/resource/tenant_template_deployment_resource.go | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/internal/services/resource/management_group_template_deployment_resource.go b/internal/services/resource/management_group_template_deployment_resource.go index 01efe96562e8..1388895880e5 100644 --- a/internal/services/resource/management_group_template_deployment_resource.go +++ b/internal/services/resource/management_group_template_deployment_resource.go @@ -247,6 +247,10 @@ func managementGroupTemplateDeploymentResourceUpdate(d *pluginsdk.ResourceData, deployment.Properties.TemplateLink = &resources.TemplateLink{ ID: utils.String(d.Get("template_spec_version_id").(string)), } + + if d.Get("template_spec_version_id").(string) != "" { + deployment.Properties.Template = nil + } } if d.HasChange("tags") { diff --git a/internal/services/resource/subscription_template_deployment_resource.go b/internal/services/resource/subscription_template_deployment_resource.go index 9fbc57746831..1a51da65246c 100644 --- a/internal/services/resource/subscription_template_deployment_resource.go +++ b/internal/services/resource/subscription_template_deployment_resource.go @@ -232,6 +232,10 @@ func subscriptionTemplateDeploymentResourceUpdate(d *pluginsdk.ResourceData, met deployment.Properties.TemplateLink = &resources.TemplateLink{ ID: utils.String(d.Get("template_spec_version_id").(string)), } + + if d.Get("template_spec_version_id").(string) != "" { + deployment.Properties.Template = nil + } } if d.HasChange("tags") { diff --git a/internal/services/resource/tenant_template_deployment_resource.go b/internal/services/resource/tenant_template_deployment_resource.go index 646bdaa19207..7d7f18fe32c3 100644 --- a/internal/services/resource/tenant_template_deployment_resource.go +++ b/internal/services/resource/tenant_template_deployment_resource.go @@ -233,6 +233,10 @@ func tenantTemplateDeploymentResourceUpdate(d *pluginsdk.ResourceData, meta inte deployment.Properties.TemplateLink = &resources.TemplateLink{ ID: utils.String(d.Get("template_spec_version_id").(string)), } + + if d.Get("template_spec_version_id").(string) != "" { + deployment.Properties.Template = nil + } } if d.HasChange("tags") {