Skip to content

Commit

Permalink
azurerm_firewall_policy - remove Computed from sku (#26499)
Browse files Browse the repository at this point in the history
* azurerm_firewall_policy - remove Computed from sku

* add original schema
  • Loading branch information
neil-yechenwei authored Jun 28, 2024
1 parent 20d6ba3 commit a6b0828
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions internal/services/firewall/firewall_policy_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand All @@ -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),
Expand Down Expand Up @@ -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
}

0 comments on commit a6b0828

Please sign in to comment.