From 17f5ffefefccde9e163ef6315b923459d99a403a Mon Sep 17 00:00:00 2001 From: magodo Date: Wed, 16 Mar 2022 13:07:39 +0800 Subject: [PATCH] `azurerm_static_site_custom_domain` - make `validation_type` optional This is to allow the imported `azurerm_static_site_custom_domain` not suffering force replacement issue. Fixes #15837. --- internal/services/web/static_site_custom_domain_resource.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/services/web/static_site_custom_domain_resource.go b/internal/services/web/static_site_custom_domain_resource.go index 340b103528e3..73c60aaf0c3c 100644 --- a/internal/services/web/static_site_custom_domain_resource.go +++ b/internal/services/web/static_site_custom_domain_resource.go @@ -55,7 +55,7 @@ func resourceStaticSiteCustomDomain() *pluginsdk.Resource { "validation_type": { Type: pluginsdk.TypeString, - Required: true, + Optional: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ txtValidationType, @@ -102,6 +102,9 @@ func resourceStaticSiteCustomDomainCreateOrUpdate(d *pluginsdk.ResourceData, met } validationMethod := d.Get("validation_type").(string) + if validationMethod == "" { + return fmt.Errorf("`validation_type` can't be empty string") + } siteEnvelope := web.StaticSiteCustomDomainRequestPropertiesARMResource{ StaticSiteCustomDomainRequestPropertiesARMResourceProperties: &web.StaticSiteCustomDomainRequestPropertiesARMResourceProperties{