From a044ddbaf08e7d5bb52503989a79c55eab395f2f Mon Sep 17 00:00:00 2001 From: Xu Wu Date: Fri, 30 Jun 2023 10:48:39 +0800 Subject: [PATCH] revert migration --- .../services/firewall/firewall_resource.go | 6 - .../firewall/migration/firewall_v0_to_v1.go | 151 ------------------ 2 files changed, 157 deletions(-) delete mode 100644 internal/services/firewall/migration/firewall_v0_to_v1.go diff --git a/internal/services/firewall/firewall_resource.go b/internal/services/firewall/firewall_resource.go index 0f321547049cc..573d1e210f681 100644 --- a/internal/services/firewall/firewall_resource.go +++ b/internal/services/firewall/firewall_resource.go @@ -17,7 +17,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/firewall/azuresdkhacks" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/firewall/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/services/firewall/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/firewall/validate" networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" @@ -49,11 +48,6 @@ func resourceFirewall() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(90 * time.Minute), }, - SchemaVersion: 1, - StateUpgraders: pluginsdk.StateUpgrades(map[int]pluginsdk.StateUpgrade{ - 0: migration.FirewallV0ToV1{}, - }), - Schema: map[string]*pluginsdk.Schema{ "name": { Type: pluginsdk.TypeString, diff --git a/internal/services/firewall/migration/firewall_v0_to_v1.go b/internal/services/firewall/migration/firewall_v0_to_v1.go deleted file mode 100644 index f6b2014960503..0000000000000 --- a/internal/services/firewall/migration/firewall_v0_to_v1.go +++ /dev/null @@ -1,151 +0,0 @@ -package migration - -import ( - "context" - - pluginsdk "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" -) - -var _ pluginsdk.StateUpgrade = FirewallV0ToV1{} - -type FirewallV0ToV1 struct{} - -func (FirewallV0ToV1) Schema() map[string]*pluginsdk.Schema { - s := map[string]*pluginsdk.Schema{ - "dns_servers": { - Elem: &pluginsdk.Schema{Type: pluginsdk.TypeString}, - Optional: true, - Type: pluginsdk.TypeList, - }, - "firewall_policy_id": { - Optional: true, - Type: pluginsdk.TypeString, - }, - "ip_configuration": { - Elem: &pluginsdk.Resource{Schema: map[string]*pluginsdk.Schema{ - "name": { - Required: true, - Type: pluginsdk.TypeString, - }, - "private_ip_address": { - Computed: true, - Type: pluginsdk.TypeString, - }, - "public_ip_address_id": { - Required: true, - Type: pluginsdk.TypeString, - }, - "subnet_id": { - ForceNew: true, - Optional: true, - Type: pluginsdk.TypeString, - }, - }}, - Optional: true, - Type: pluginsdk.TypeList, - }, - "location": { - ForceNew: true, - Required: true, - Type: pluginsdk.TypeString, - }, - "management_ip_configuration": { - Elem: &pluginsdk.Resource{Schema: map[string]*pluginsdk.Schema{ - "name": { - Required: true, - Type: pluginsdk.TypeString, - }, - "private_ip_address": { - Computed: true, - Type: pluginsdk.TypeString, - }, - "public_ip_address_id": { - Required: true, - Type: pluginsdk.TypeString, - }, - "subnet_id": { - ForceNew: true, - Required: true, - Type: pluginsdk.TypeString, - }, - }}, - ForceNew: true, - Optional: true, - Type: pluginsdk.TypeList, - }, - "name": { - ForceNew: true, - Required: true, - Type: pluginsdk.TypeString, - }, - "private_ip_ranges": { - Elem: &pluginsdk.Schema{Type: pluginsdk.TypeString}, - Optional: true, - Type: pluginsdk.TypeSet, - }, - "resource_group_name": { - ForceNew: true, - Required: true, - Type: pluginsdk.TypeString, - }, - "sku_name": { - ForceNew: true, - Required: true, - Type: pluginsdk.TypeString, - }, - "sku_tier": { - Required: true, - Type: pluginsdk.TypeString, - }, - "tags": { - Elem: &pluginsdk.Schema{Type: pluginsdk.TypeString}, - Optional: true, - Type: pluginsdk.TypeMap, - }, - "threat_intel_mode": { - Computed: true, - Optional: true, - Type: pluginsdk.TypeString, - }, - "virtual_hub": { - Elem: &pluginsdk.Resource{Schema: map[string]*pluginsdk.Schema{ - "private_ip_address": { - Computed: true, - Type: pluginsdk.TypeString, - }, - "public_ip_addresses": { - Computed: true, - Elem: &pluginsdk.Schema{Type: pluginsdk.TypeString}, - Type: pluginsdk.TypeList, - }, - "public_ip_count": { - Optional: true, - Type: pluginsdk.TypeInt, - }, - "virtual_hub_id": { - Required: true, - Type: pluginsdk.TypeString, - }, - }}, - Optional: true, - Type: pluginsdk.TypeList, - }, - "zones": { - Elem: &pluginsdk.Schema{Type: pluginsdk.TypeString}, - ForceNew: true, - Optional: true, - Type: pluginsdk.TypeSet, - }, - } - return s -} - -func (FirewallV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { - return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { - servers := rawState["dns_servers"].([]interface{}) - if len(servers) > 0 { - rawState["dns_proxy_enabled"] = true - } - return rawState, nil - } -}