From a6b0828eab724e94a5e67cb03c2e26008b92987b Mon Sep 17 00:00:00 2001 From: Neil Ye Date: Fri, 28 Jun 2024 19:07:28 +0800 Subject: [PATCH] `azurerm_firewall_policy` - remove `Computed` from `sku` (#26499) * azurerm_firewall_policy - remove Computed from sku * add original schema --- .../firewall/firewall_policy_resource.go | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/internal/services/firewall/firewall_policy_resource.go b/internal/services/firewall/firewall_policy_resource.go index 7a8c85cc0131..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" @@ -637,7 +638,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 +651,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 +988,20 @@ 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 }