From 43ab725b42c062de6c7ddd56b891f8db13533524 Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Fri, 28 Jun 2024 09:34:29 +0800 Subject: [PATCH 1/2] azurerm_firewall_policy - remove Computed from sku --- internal/services/firewall/firewall_policy_resource.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/services/firewall/firewall_policy_resource.go b/internal/services/firewall/firewall_policy_resource.go index 7a8c85cc0131..947d18ffdb9b 100644 --- a/internal/services/firewall/firewall_policy_resource.go +++ b/internal/services/firewall/firewall_policy_resource.go @@ -637,7 +637,7 @@ func flattenFirewallPolicyLogAnalyticsResources(input *firewallpolicies.Firewall } func resourceFirewallPolicySchema() map[string]*pluginsdk.Schema { - return map[string]*pluginsdk.Schema{ + resource := map[string]*pluginsdk.Schema{ "name": { Type: pluginsdk.TypeString, Required: true, @@ -650,7 +650,7 @@ func resourceFirewallPolicySchema() map[string]*pluginsdk.Schema { "sku": { Type: pluginsdk.TypeString, Optional: true, - Computed: true, + Default: string(firewallpolicies.FirewallPolicySkuTierStandard), ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ string(firewallpolicies.FirewallPolicySkuTierPremium), @@ -987,4 +987,6 @@ func resourceFirewallPolicySchema() map[string]*pluginsdk.Schema { "tags": commonschema.Tags(), } + + return resource } From 141a317b04d58af619ce7e68111aaea02a38f6b3 Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Fri, 28 Jun 2024 09:43:56 +0800 Subject: [PATCH 2/2] add original schema --- .../services/firewall/firewall_policy_resource.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/internal/services/firewall/firewall_policy_resource.go b/internal/services/firewall/firewall_policy_resource.go index 947d18ffdb9b..ff4ace2126f6 100644 --- a/internal/services/firewall/firewall_policy_resource.go +++ b/internal/services/firewall/firewall_policy_resource.go @@ -19,6 +19,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/firewall/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -988,5 +989,19 @@ func resourceFirewallPolicySchema() map[string]*pluginsdk.Schema { "tags": commonschema.Tags(), } + if !features.FourPointOhBeta() { + resource["sku"] = &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + string(firewallpolicies.FirewallPolicySkuTierPremium), + string(firewallpolicies.FirewallPolicySkuTierStandard), + string(firewallpolicies.FirewallPolicySkuTierBasic), + }, false), + } + } + return resource }