diff --git a/patches/0001-Client-options.patch b/patches/0001-Set-user-agent-in-client-options.patch similarity index 94% rename from patches/0001-Client-options.patch rename to patches/0001-Set-user-agent-in-client-options.patch index 52ead60b2a..6a7b81e2f8 100644 --- a/patches/0001-Client-options.patch +++ b/patches/0001-Set-user-agent-in-client-options.patch @@ -1,8 +1,9 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: aq17 Date: Thu, 25 May 2023 10:33:38 -0700 -Subject: [PATCH] Client-options +Subject: [PATCH] Set user agent in client options +Use Pulumi-specific user agent which includes the current provider version number. diff --git a/internal/common/client_options.go b/internal/common/client_options.go index 4b2d3a5a5b..451c27f7f2 100644 diff --git a/patches/0008-expose-provider.patch b/patches/0002-Expose-provider-via-shim.patch similarity index 70% rename from patches/0008-expose-provider.patch rename to patches/0002-Expose-provider-via-shim.patch index 762c34fce4..8b4d6b42b7 100644 --- a/patches/0008-expose-provider.patch +++ b/patches/0002-Expose-provider-via-shim.patch @@ -1,8 +1,9 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: aq17 Date: Thu, 25 May 2023 10:33:39 -0700 -Subject: [PATCH] expose-provider +Subject: [PATCH] Expose provider via shim +Add shim module containing a public method which constructs a new instance of the internal provider class so we're able to access the provider class directly in order to bridge it. diff --git a/shim/shim.go b/shim/shim.go new file mode 100644 diff --git a/patches/0003-Add-new-resources.patch b/patches/0003-Add-new-resources.patch deleted file mode 100644 index 5e93a75841..0000000000 --- a/patches/0003-Add-new-resources.patch +++ /dev/null @@ -1,4717 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: aq17 -Date: Thu, 25 May 2023 10:33:38 -0700 -Subject: [PATCH] Add-new-resources - - -diff --git a/internal/services/compute/parse/proximity_placement_group.go b/internal/services/compute/parse/proximity_placement_group.go -new file mode 100644 -index 0000000000..abb24fffd4 ---- /dev/null -+++ b/internal/services/compute/parse/proximity_placement_group.go -@@ -0,0 +1,69 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ "strings" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+type ProximityPlacementGroupId struct { -+ SubscriptionId string -+ ResourceGroup string -+ Name string -+} -+ -+func NewProximityPlacementGroupID(subscriptionId, resourceGroup, name string) ProximityPlacementGroupId { -+ return ProximityPlacementGroupId{ -+ SubscriptionId: subscriptionId, -+ ResourceGroup: resourceGroup, -+ Name: name, -+ } -+} -+ -+func (id ProximityPlacementGroupId) String() string { -+ segments := []string{ -+ fmt.Sprintf("Name %q", id.Name), -+ fmt.Sprintf("Resource Group %q", id.ResourceGroup), -+ } -+ segmentsStr := strings.Join(segments, " / ") -+ return fmt.Sprintf("%s: (%s)", "Proximity Placement Group", segmentsStr) -+} -+ -+func (id ProximityPlacementGroupId) ID() string { -+ fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/proximityPlacementGroups/%s" -+ return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -+} -+ -+// ProximityPlacementGroupID parses a ProximityPlacementGroup ID into an ProximityPlacementGroupId struct -+func ProximityPlacementGroupID(input string) (*ProximityPlacementGroupId, error) { -+ id, err := resourceids.ParseAzureResourceID(input) -+ if err != nil { -+ return nil, err -+ } -+ -+ resourceId := ProximityPlacementGroupId{ -+ SubscriptionId: id.SubscriptionID, -+ ResourceGroup: id.ResourceGroup, -+ } -+ -+ if resourceId.SubscriptionId == "" { -+ return nil, fmt.Errorf("ID was missing the 'subscriptions' element") -+ } -+ -+ if resourceId.ResourceGroup == "" { -+ return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") -+ } -+ -+ if resourceId.Name, err = id.PopSegment("proximityPlacementGroups"); err != nil { -+ return nil, err -+ } -+ -+ if err := id.ValidateNoEmptySegments(input); err != nil { -+ return nil, err -+ } -+ -+ return &resourceId, nil -+} -diff --git a/internal/services/compute/parse/proximity_placement_group_test.go b/internal/services/compute/parse/proximity_placement_group_test.go -new file mode 100644 -index 0000000000..a5069aefd4 ---- /dev/null -+++ b/internal/services/compute/parse/proximity_placement_group_test.go -@@ -0,0 +1,112 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "testing" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+var _ resourceids.Id = ProximityPlacementGroupId{} -+ -+func TestProximityPlacementGroupIDFormatter(t *testing.T) { -+ actual := NewProximityPlacementGroupID("12345678-1234-9876-4563-123456789012", "group1", "proximityPlacementGroup1").ID() -+ expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Compute/proximityPlacementGroups/proximityPlacementGroup1" -+ if actual != expected { -+ t.Fatalf("Expected %q but got %q", expected, actual) -+ } -+} -+ -+func TestProximityPlacementGroupID(t *testing.T) { -+ testData := []struct { -+ Input string -+ Error bool -+ Expected *ProximityPlacementGroupId -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Error: true, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Error: true, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Error: true, -+ }, -+ -+ { -+ // missing Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Compute/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Compute/proximityPlacementGroups/", -+ Error: true, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Compute/proximityPlacementGroups/proximityPlacementGroup1", -+ Expected: &ProximityPlacementGroupId{ -+ SubscriptionId: "12345678-1234-9876-4563-123456789012", -+ ResourceGroup: "group1", -+ Name: "proximityPlacementGroup1", -+ }, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.COMPUTE/PROXIMITYPLACEMENTGROUPS/PROXIMITYPLACEMENTGROUP1", -+ Error: true, -+ }, -+ } -+ -+ for _, v := range testData { -+ t.Logf("[DEBUG] Testing %q", v.Input) -+ -+ actual, err := ProximityPlacementGroupID(v.Input) -+ if err != nil { -+ if v.Error { -+ continue -+ } -+ -+ t.Fatalf("Expect a value but got an error: %s", err) -+ } -+ if v.Error { -+ t.Fatal("Expect an error but didn't get one") -+ } -+ -+ if actual.SubscriptionId != v.Expected.SubscriptionId { -+ t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) -+ } -+ if actual.ResourceGroup != v.Expected.ResourceGroup { -+ t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) -+ } -+ if actual.Name != v.Expected.Name { -+ t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) -+ } -+ } -+} -diff --git a/internal/services/compute/validate/proximity_placement_group_id.go b/internal/services/compute/validate/proximity_placement_group_id.go -new file mode 100644 -index 0000000000..2c48bb9ad7 ---- /dev/null -+++ b/internal/services/compute/validate/proximity_placement_group_id.go -@@ -0,0 +1,23 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ -+ "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" -+) -+ -+func ProximityPlacementGroupID(input interface{}, key string) (warnings []string, errors []error) { -+ v, ok := input.(string) -+ if !ok { -+ errors = append(errors, fmt.Errorf("expected %q to be a string", key)) -+ return -+ } -+ -+ if _, err := parse.ProximityPlacementGroupID(v); err != nil { -+ errors = append(errors, err) -+ } -+ -+ return -+} -diff --git a/internal/services/compute/validate/proximity_placement_group_id_test.go b/internal/services/compute/validate/proximity_placement_group_id_test.go -new file mode 100644 -index 0000000000..413553dba3 ---- /dev/null -+++ b/internal/services/compute/validate/proximity_placement_group_id_test.go -@@ -0,0 +1,76 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import "testing" -+ -+func TestProximityPlacementGroupID(t *testing.T) { -+ cases := []struct { -+ Input string -+ Valid bool -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Valid: false, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Valid: false, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Valid: false, -+ }, -+ -+ { -+ // missing Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Compute/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Compute/proximityPlacementGroups/", -+ Valid: false, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Compute/proximityPlacementGroups/proximityPlacementGroup1", -+ Valid: true, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.COMPUTE/PROXIMITYPLACEMENTGROUPS/PROXIMITYPLACEMENTGROUP1", -+ Valid: false, -+ }, -+ } -+ for _, tc := range cases { -+ t.Logf("[DEBUG] Testing Value %s", tc.Input) -+ _, errors := ProximityPlacementGroupID(tc.Input, "test") -+ valid := len(errors) == 0 -+ -+ if tc.Valid != valid { -+ t.Fatalf("Expected %t but got %t", tc.Valid, valid) -+ } -+ } -+} -diff --git a/internal/services/postgres/parse/configuration.go b/internal/services/postgres/parse/configuration.go -new file mode 100644 -index 0000000000..69dee5a0be ---- /dev/null -+++ b/internal/services/postgres/parse/configuration.go -@@ -0,0 +1,75 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ "strings" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+type ConfigurationId struct { -+ SubscriptionId string -+ ResourceGroup string -+ ServerName string -+ Name string -+} -+ -+func NewConfigurationID(subscriptionId, resourceGroup, serverName, name string) ConfigurationId { -+ return ConfigurationId{ -+ SubscriptionId: subscriptionId, -+ ResourceGroup: resourceGroup, -+ ServerName: serverName, -+ Name: name, -+ } -+} -+ -+func (id ConfigurationId) String() string { -+ segments := []string{ -+ fmt.Sprintf("Name %q", id.Name), -+ fmt.Sprintf("Server Name %q", id.ServerName), -+ fmt.Sprintf("Resource Group %q", id.ResourceGroup), -+ } -+ segmentsStr := strings.Join(segments, " / ") -+ return fmt.Sprintf("%s: (%s)", "Configuration", segmentsStr) -+} -+ -+func (id ConfigurationId) ID() string { -+ fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/servers/%s/configurations/%s" -+ return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ServerName, id.Name) -+} -+ -+// ConfigurationID parses a Configuration ID into an ConfigurationId struct -+func ConfigurationID(input string) (*ConfigurationId, error) { -+ id, err := resourceids.ParseAzureResourceID(input) -+ if err != nil { -+ return nil, err -+ } -+ -+ resourceId := ConfigurationId{ -+ SubscriptionId: id.SubscriptionID, -+ ResourceGroup: id.ResourceGroup, -+ } -+ -+ if resourceId.SubscriptionId == "" { -+ return nil, fmt.Errorf("ID was missing the 'subscriptions' element") -+ } -+ -+ if resourceId.ResourceGroup == "" { -+ return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") -+ } -+ -+ if resourceId.ServerName, err = id.PopSegment("servers"); err != nil { -+ return nil, err -+ } -+ if resourceId.Name, err = id.PopSegment("configurations"); err != nil { -+ return nil, err -+ } -+ -+ if err := id.ValidateNoEmptySegments(input); err != nil { -+ return nil, err -+ } -+ -+ return &resourceId, nil -+} -diff --git a/internal/services/postgres/parse/configuration_test.go b/internal/services/postgres/parse/configuration_test.go -new file mode 100644 -index 0000000000..cc5d864704 ---- /dev/null -+++ b/internal/services/postgres/parse/configuration_test.go -@@ -0,0 +1,128 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "testing" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+var _ resourceids.Id = ConfigurationId{} -+ -+func TestConfigurationIDFormatter(t *testing.T) { -+ actual := NewConfigurationID("12345678-1234-9876-4563-123456789012", "resGroup1", "server1", "configuration1").ID() -+ expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/configurations/configuration1" -+ if actual != expected { -+ t.Fatalf("Expected %q but got %q", expected, actual) -+ } -+} -+ -+func TestConfigurationID(t *testing.T) { -+ testData := []struct { -+ Input string -+ Error bool -+ Expected *ConfigurationId -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Error: true, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Error: true, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Error: true, -+ }, -+ -+ { -+ // missing ServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for ServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/", -+ Error: true, -+ }, -+ -+ { -+ // missing Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/configurations/", -+ Error: true, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/configurations/configuration1", -+ Expected: &ConfigurationId{ -+ SubscriptionId: "12345678-1234-9876-4563-123456789012", -+ ResourceGroup: "resGroup1", -+ ServerName: "server1", -+ Name: "configuration1", -+ }, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORPOSTGRESQL/SERVERS/SERVER1/CONFIGURATIONS/CONFIGURATION1", -+ Error: true, -+ }, -+ } -+ -+ for _, v := range testData { -+ t.Logf("[DEBUG] Testing %q", v.Input) -+ -+ actual, err := ConfigurationID(v.Input) -+ if err != nil { -+ if v.Error { -+ continue -+ } -+ -+ t.Fatalf("Expect a value but got an error: %s", err) -+ } -+ if v.Error { -+ t.Fatal("Expect an error but didn't get one") -+ } -+ -+ if actual.SubscriptionId != v.Expected.SubscriptionId { -+ t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) -+ } -+ if actual.ResourceGroup != v.Expected.ResourceGroup { -+ t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) -+ } -+ if actual.ServerName != v.Expected.ServerName { -+ t.Fatalf("Expected %q but got %q for ServerName", v.Expected.ServerName, actual.ServerName) -+ } -+ if actual.Name != v.Expected.Name { -+ t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) -+ } -+ } -+} -diff --git a/internal/services/postgres/parse/database.go b/internal/services/postgres/parse/database.go -new file mode 100644 -index 0000000000..33e2dbf57a ---- /dev/null -+++ b/internal/services/postgres/parse/database.go -@@ -0,0 +1,75 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ "strings" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+type DatabaseId struct { -+ SubscriptionId string -+ ResourceGroup string -+ ServerName string -+ Name string -+} -+ -+func NewDatabaseID(subscriptionId, resourceGroup, serverName, name string) DatabaseId { -+ return DatabaseId{ -+ SubscriptionId: subscriptionId, -+ ResourceGroup: resourceGroup, -+ ServerName: serverName, -+ Name: name, -+ } -+} -+ -+func (id DatabaseId) String() string { -+ segments := []string{ -+ fmt.Sprintf("Name %q", id.Name), -+ fmt.Sprintf("Server Name %q", id.ServerName), -+ fmt.Sprintf("Resource Group %q", id.ResourceGroup), -+ } -+ segmentsStr := strings.Join(segments, " / ") -+ return fmt.Sprintf("%s: (%s)", "Database", segmentsStr) -+} -+ -+func (id DatabaseId) ID() string { -+ fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/servers/%s/databases/%s" -+ return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ServerName, id.Name) -+} -+ -+// DatabaseID parses a Database ID into an DatabaseId struct -+func DatabaseID(input string) (*DatabaseId, error) { -+ id, err := resourceids.ParseAzureResourceID(input) -+ if err != nil { -+ return nil, err -+ } -+ -+ resourceId := DatabaseId{ -+ SubscriptionId: id.SubscriptionID, -+ ResourceGroup: id.ResourceGroup, -+ } -+ -+ if resourceId.SubscriptionId == "" { -+ return nil, fmt.Errorf("ID was missing the 'subscriptions' element") -+ } -+ -+ if resourceId.ResourceGroup == "" { -+ return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") -+ } -+ -+ if resourceId.ServerName, err = id.PopSegment("servers"); err != nil { -+ return nil, err -+ } -+ if resourceId.Name, err = id.PopSegment("databases"); err != nil { -+ return nil, err -+ } -+ -+ if err := id.ValidateNoEmptySegments(input); err != nil { -+ return nil, err -+ } -+ -+ return &resourceId, nil -+} -diff --git a/internal/services/postgres/parse/database_test.go b/internal/services/postgres/parse/database_test.go -new file mode 100644 -index 0000000000..944f54622b ---- /dev/null -+++ b/internal/services/postgres/parse/database_test.go -@@ -0,0 +1,128 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "testing" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+var _ resourceids.Id = DatabaseId{} -+ -+func TestDatabaseIDFormatter(t *testing.T) { -+ actual := NewDatabaseID("12345678-1234-9876-4563-123456789012", "resGroup1", "server1", "database1").ID() -+ expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/databases/database1" -+ if actual != expected { -+ t.Fatalf("Expected %q but got %q", expected, actual) -+ } -+} -+ -+func TestDatabaseID(t *testing.T) { -+ testData := []struct { -+ Input string -+ Error bool -+ Expected *DatabaseId -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Error: true, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Error: true, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Error: true, -+ }, -+ -+ { -+ // missing ServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for ServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/", -+ Error: true, -+ }, -+ -+ { -+ // missing Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/databases/", -+ Error: true, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/databases/database1", -+ Expected: &DatabaseId{ -+ SubscriptionId: "12345678-1234-9876-4563-123456789012", -+ ResourceGroup: "resGroup1", -+ ServerName: "server1", -+ Name: "database1", -+ }, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORPOSTGRESQL/SERVERS/SERVER1/DATABASES/DATABASE1", -+ Error: true, -+ }, -+ } -+ -+ for _, v := range testData { -+ t.Logf("[DEBUG] Testing %q", v.Input) -+ -+ actual, err := DatabaseID(v.Input) -+ if err != nil { -+ if v.Error { -+ continue -+ } -+ -+ t.Fatalf("Expect a value but got an error: %s", err) -+ } -+ if v.Error { -+ t.Fatal("Expect an error but didn't get one") -+ } -+ -+ if actual.SubscriptionId != v.Expected.SubscriptionId { -+ t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) -+ } -+ if actual.ResourceGroup != v.Expected.ResourceGroup { -+ t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) -+ } -+ if actual.ServerName != v.Expected.ServerName { -+ t.Fatalf("Expected %q but got %q for ServerName", v.Expected.ServerName, actual.ServerName) -+ } -+ if actual.Name != v.Expected.Name { -+ t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) -+ } -+ } -+} -diff --git a/internal/services/postgres/parse/firewall_rule.go b/internal/services/postgres/parse/firewall_rule.go -new file mode 100644 -index 0000000000..d18754cb95 ---- /dev/null -+++ b/internal/services/postgres/parse/firewall_rule.go -@@ -0,0 +1,75 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ "strings" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+type FirewallRuleId struct { -+ SubscriptionId string -+ ResourceGroup string -+ ServerName string -+ Name string -+} -+ -+func NewFirewallRuleID(subscriptionId, resourceGroup, serverName, name string) FirewallRuleId { -+ return FirewallRuleId{ -+ SubscriptionId: subscriptionId, -+ ResourceGroup: resourceGroup, -+ ServerName: serverName, -+ Name: name, -+ } -+} -+ -+func (id FirewallRuleId) String() string { -+ segments := []string{ -+ fmt.Sprintf("Name %q", id.Name), -+ fmt.Sprintf("Server Name %q", id.ServerName), -+ fmt.Sprintf("Resource Group %q", id.ResourceGroup), -+ } -+ segmentsStr := strings.Join(segments, " / ") -+ return fmt.Sprintf("%s: (%s)", "Firewall Rule", segmentsStr) -+} -+ -+func (id FirewallRuleId) ID() string { -+ fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/servers/%s/firewallRules/%s" -+ return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ServerName, id.Name) -+} -+ -+// FirewallRuleID parses a FirewallRule ID into an FirewallRuleId struct -+func FirewallRuleID(input string) (*FirewallRuleId, error) { -+ id, err := resourceids.ParseAzureResourceID(input) -+ if err != nil { -+ return nil, err -+ } -+ -+ resourceId := FirewallRuleId{ -+ SubscriptionId: id.SubscriptionID, -+ ResourceGroup: id.ResourceGroup, -+ } -+ -+ if resourceId.SubscriptionId == "" { -+ return nil, fmt.Errorf("ID was missing the 'subscriptions' element") -+ } -+ -+ if resourceId.ResourceGroup == "" { -+ return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") -+ } -+ -+ if resourceId.ServerName, err = id.PopSegment("servers"); err != nil { -+ return nil, err -+ } -+ if resourceId.Name, err = id.PopSegment("firewallRules"); err != nil { -+ return nil, err -+ } -+ -+ if err := id.ValidateNoEmptySegments(input); err != nil { -+ return nil, err -+ } -+ -+ return &resourceId, nil -+} -diff --git a/internal/services/postgres/parse/firewall_rule_test.go b/internal/services/postgres/parse/firewall_rule_test.go -new file mode 100644 -index 0000000000..9f8e0caf19 ---- /dev/null -+++ b/internal/services/postgres/parse/firewall_rule_test.go -@@ -0,0 +1,128 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "testing" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+var _ resourceids.Id = FirewallRuleId{} -+ -+func TestFirewallRuleIDFormatter(t *testing.T) { -+ actual := NewFirewallRuleID("12345678-1234-9876-4563-123456789012", "resGroup1", "server1", "firewallRule1").ID() -+ expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/firewallRules/firewallRule1" -+ if actual != expected { -+ t.Fatalf("Expected %q but got %q", expected, actual) -+ } -+} -+ -+func TestFirewallRuleID(t *testing.T) { -+ testData := []struct { -+ Input string -+ Error bool -+ Expected *FirewallRuleId -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Error: true, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Error: true, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Error: true, -+ }, -+ -+ { -+ // missing ServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for ServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/", -+ Error: true, -+ }, -+ -+ { -+ // missing Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/firewallRules/", -+ Error: true, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/firewallRules/firewallRule1", -+ Expected: &FirewallRuleId{ -+ SubscriptionId: "12345678-1234-9876-4563-123456789012", -+ ResourceGroup: "resGroup1", -+ ServerName: "server1", -+ Name: "firewallRule1", -+ }, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORPOSTGRESQL/SERVERS/SERVER1/FIREWALLRULES/FIREWALLRULE1", -+ Error: true, -+ }, -+ } -+ -+ for _, v := range testData { -+ t.Logf("[DEBUG] Testing %q", v.Input) -+ -+ actual, err := FirewallRuleID(v.Input) -+ if err != nil { -+ if v.Error { -+ continue -+ } -+ -+ t.Fatalf("Expect a value but got an error: %s", err) -+ } -+ if v.Error { -+ t.Fatal("Expect an error but didn't get one") -+ } -+ -+ if actual.SubscriptionId != v.Expected.SubscriptionId { -+ t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) -+ } -+ if actual.ResourceGroup != v.Expected.ResourceGroup { -+ t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) -+ } -+ if actual.ServerName != v.Expected.ServerName { -+ t.Fatalf("Expected %q but got %q for ServerName", v.Expected.ServerName, actual.ServerName) -+ } -+ if actual.Name != v.Expected.Name { -+ t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) -+ } -+ } -+} -diff --git a/internal/services/postgres/parse/flexible_server.go b/internal/services/postgres/parse/flexible_server.go -new file mode 100644 -index 0000000000..ae13a5c53a ---- /dev/null -+++ b/internal/services/postgres/parse/flexible_server.go -@@ -0,0 +1,69 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ "strings" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+type FlexibleServerId struct { -+ SubscriptionId string -+ ResourceGroup string -+ Name string -+} -+ -+func NewFlexibleServerID(subscriptionId, resourceGroup, name string) FlexibleServerId { -+ return FlexibleServerId{ -+ SubscriptionId: subscriptionId, -+ ResourceGroup: resourceGroup, -+ Name: name, -+ } -+} -+ -+func (id FlexibleServerId) String() string { -+ segments := []string{ -+ fmt.Sprintf("Name %q", id.Name), -+ fmt.Sprintf("Resource Group %q", id.ResourceGroup), -+ } -+ segmentsStr := strings.Join(segments, " / ") -+ return fmt.Sprintf("%s: (%s)", "Flexible Server", segmentsStr) -+} -+ -+func (id FlexibleServerId) ID() string { -+ fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s" -+ return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -+} -+ -+// FlexibleServerID parses a FlexibleServer ID into an FlexibleServerId struct -+func FlexibleServerID(input string) (*FlexibleServerId, error) { -+ id, err := resourceids.ParseAzureResourceID(input) -+ if err != nil { -+ return nil, err -+ } -+ -+ resourceId := FlexibleServerId{ -+ SubscriptionId: id.SubscriptionID, -+ ResourceGroup: id.ResourceGroup, -+ } -+ -+ if resourceId.SubscriptionId == "" { -+ return nil, fmt.Errorf("ID was missing the 'subscriptions' element") -+ } -+ -+ if resourceId.ResourceGroup == "" { -+ return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") -+ } -+ -+ if resourceId.Name, err = id.PopSegment("flexibleServers"); err != nil { -+ return nil, err -+ } -+ -+ if err := id.ValidateNoEmptySegments(input); err != nil { -+ return nil, err -+ } -+ -+ return &resourceId, nil -+} -diff --git a/internal/services/postgres/parse/flexible_server_configuration.go b/internal/services/postgres/parse/flexible_server_configuration.go -new file mode 100644 -index 0000000000..8667dc68fa ---- /dev/null -+++ b/internal/services/postgres/parse/flexible_server_configuration.go -@@ -0,0 +1,75 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ "strings" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+type FlexibleServerConfigurationId struct { -+ SubscriptionId string -+ ResourceGroup string -+ FlexibleServerName string -+ ConfigurationName string -+} -+ -+func NewFlexibleServerConfigurationID(subscriptionId, resourceGroup, flexibleServerName, configurationName string) FlexibleServerConfigurationId { -+ return FlexibleServerConfigurationId{ -+ SubscriptionId: subscriptionId, -+ ResourceGroup: resourceGroup, -+ FlexibleServerName: flexibleServerName, -+ ConfigurationName: configurationName, -+ } -+} -+ -+func (id FlexibleServerConfigurationId) String() string { -+ segments := []string{ -+ fmt.Sprintf("Configuration Name %q", id.ConfigurationName), -+ fmt.Sprintf("Flexible Server Name %q", id.FlexibleServerName), -+ fmt.Sprintf("Resource Group %q", id.ResourceGroup), -+ } -+ segmentsStr := strings.Join(segments, " / ") -+ return fmt.Sprintf("%s: (%s)", "Flexible Server Configuration", segmentsStr) -+} -+ -+func (id FlexibleServerConfigurationId) ID() string { -+ fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s/configurations/%s" -+ return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.FlexibleServerName, id.ConfigurationName) -+} -+ -+// FlexibleServerConfigurationID parses a FlexibleServerConfiguration ID into an FlexibleServerConfigurationId struct -+func FlexibleServerConfigurationID(input string) (*FlexibleServerConfigurationId, error) { -+ id, err := resourceids.ParseAzureResourceID(input) -+ if err != nil { -+ return nil, err -+ } -+ -+ resourceId := FlexibleServerConfigurationId{ -+ SubscriptionId: id.SubscriptionID, -+ ResourceGroup: id.ResourceGroup, -+ } -+ -+ if resourceId.SubscriptionId == "" { -+ return nil, fmt.Errorf("ID was missing the 'subscriptions' element") -+ } -+ -+ if resourceId.ResourceGroup == "" { -+ return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") -+ } -+ -+ if resourceId.FlexibleServerName, err = id.PopSegment("flexibleServers"); err != nil { -+ return nil, err -+ } -+ if resourceId.ConfigurationName, err = id.PopSegment("configurations"); err != nil { -+ return nil, err -+ } -+ -+ if err := id.ValidateNoEmptySegments(input); err != nil { -+ return nil, err -+ } -+ -+ return &resourceId, nil -+} -diff --git a/internal/services/postgres/parse/flexible_server_configuration_test.go b/internal/services/postgres/parse/flexible_server_configuration_test.go -new file mode 100644 -index 0000000000..bd0adcadb0 ---- /dev/null -+++ b/internal/services/postgres/parse/flexible_server_configuration_test.go -@@ -0,0 +1,128 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "testing" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+var _ resourceids.Id = FlexibleServerConfigurationId{} -+ -+func TestFlexibleServerConfigurationIDFormatter(t *testing.T) { -+ actual := NewFlexibleServerConfigurationID("12345678-1234-9876-4563-123456789012", "resGroup1", "flexibleServer1", "configuration1").ID() -+ expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/flexibleServer1/configurations/configuration1" -+ if actual != expected { -+ t.Fatalf("Expected %q but got %q", expected, actual) -+ } -+} -+ -+func TestFlexibleServerConfigurationID(t *testing.T) { -+ testData := []struct { -+ Input string -+ Error bool -+ Expected *FlexibleServerConfigurationId -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Error: true, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Error: true, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Error: true, -+ }, -+ -+ { -+ // missing FlexibleServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for FlexibleServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/", -+ Error: true, -+ }, -+ -+ { -+ // missing ConfigurationName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/flexibleServer1/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for ConfigurationName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/flexibleServer1/configurations/", -+ Error: true, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/flexibleServer1/configurations/configuration1", -+ Expected: &FlexibleServerConfigurationId{ -+ SubscriptionId: "12345678-1234-9876-4563-123456789012", -+ ResourceGroup: "resGroup1", -+ FlexibleServerName: "flexibleServer1", -+ ConfigurationName: "configuration1", -+ }, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORPOSTGRESQL/FLEXIBLESERVERS/FLEXIBLESERVER1/CONFIGURATIONS/CONFIGURATION1", -+ Error: true, -+ }, -+ } -+ -+ for _, v := range testData { -+ t.Logf("[DEBUG] Testing %q", v.Input) -+ -+ actual, err := FlexibleServerConfigurationID(v.Input) -+ if err != nil { -+ if v.Error { -+ continue -+ } -+ -+ t.Fatalf("Expect a value but got an error: %s", err) -+ } -+ if v.Error { -+ t.Fatal("Expect an error but didn't get one") -+ } -+ -+ if actual.SubscriptionId != v.Expected.SubscriptionId { -+ t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) -+ } -+ if actual.ResourceGroup != v.Expected.ResourceGroup { -+ t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) -+ } -+ if actual.FlexibleServerName != v.Expected.FlexibleServerName { -+ t.Fatalf("Expected %q but got %q for FlexibleServerName", v.Expected.FlexibleServerName, actual.FlexibleServerName) -+ } -+ if actual.ConfigurationName != v.Expected.ConfigurationName { -+ t.Fatalf("Expected %q but got %q for ConfigurationName", v.Expected.ConfigurationName, actual.ConfigurationName) -+ } -+ } -+} -diff --git a/internal/services/postgres/parse/flexible_server_database.go b/internal/services/postgres/parse/flexible_server_database.go -new file mode 100644 -index 0000000000..3551579578 ---- /dev/null -+++ b/internal/services/postgres/parse/flexible_server_database.go -@@ -0,0 +1,75 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ "strings" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+type FlexibleServerDatabaseId struct { -+ SubscriptionId string -+ ResourceGroup string -+ FlexibleServerName string -+ DatabaseName string -+} -+ -+func NewFlexibleServerDatabaseID(subscriptionId, resourceGroup, flexibleServerName, databaseName string) FlexibleServerDatabaseId { -+ return FlexibleServerDatabaseId{ -+ SubscriptionId: subscriptionId, -+ ResourceGroup: resourceGroup, -+ FlexibleServerName: flexibleServerName, -+ DatabaseName: databaseName, -+ } -+} -+ -+func (id FlexibleServerDatabaseId) String() string { -+ segments := []string{ -+ fmt.Sprintf("Database Name %q", id.DatabaseName), -+ fmt.Sprintf("Flexible Server Name %q", id.FlexibleServerName), -+ fmt.Sprintf("Resource Group %q", id.ResourceGroup), -+ } -+ segmentsStr := strings.Join(segments, " / ") -+ return fmt.Sprintf("%s: (%s)", "Flexible Server Database", segmentsStr) -+} -+ -+func (id FlexibleServerDatabaseId) ID() string { -+ fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s/databases/%s" -+ return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.FlexibleServerName, id.DatabaseName) -+} -+ -+// FlexibleServerDatabaseID parses a FlexibleServerDatabase ID into an FlexibleServerDatabaseId struct -+func FlexibleServerDatabaseID(input string) (*FlexibleServerDatabaseId, error) { -+ id, err := resourceids.ParseAzureResourceID(input) -+ if err != nil { -+ return nil, err -+ } -+ -+ resourceId := FlexibleServerDatabaseId{ -+ SubscriptionId: id.SubscriptionID, -+ ResourceGroup: id.ResourceGroup, -+ } -+ -+ if resourceId.SubscriptionId == "" { -+ return nil, fmt.Errorf("ID was missing the 'subscriptions' element") -+ } -+ -+ if resourceId.ResourceGroup == "" { -+ return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") -+ } -+ -+ if resourceId.FlexibleServerName, err = id.PopSegment("flexibleServers"); err != nil { -+ return nil, err -+ } -+ if resourceId.DatabaseName, err = id.PopSegment("databases"); err != nil { -+ return nil, err -+ } -+ -+ if err := id.ValidateNoEmptySegments(input); err != nil { -+ return nil, err -+ } -+ -+ return &resourceId, nil -+} -diff --git a/internal/services/postgres/parse/flexible_server_database_test.go b/internal/services/postgres/parse/flexible_server_database_test.go -new file mode 100644 -index 0000000000..ca6f4d64eb ---- /dev/null -+++ b/internal/services/postgres/parse/flexible_server_database_test.go -@@ -0,0 +1,128 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "testing" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+var _ resourceids.Id = FlexibleServerDatabaseId{} -+ -+func TestFlexibleServerDatabaseIDFormatter(t *testing.T) { -+ actual := NewFlexibleServerDatabaseID("12345678-1234-9876-4563-123456789012", "resGroup1", "flexibleServer1", "database1").ID() -+ expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/flexibleServer1/databases/database1" -+ if actual != expected { -+ t.Fatalf("Expected %q but got %q", expected, actual) -+ } -+} -+ -+func TestFlexibleServerDatabaseID(t *testing.T) { -+ testData := []struct { -+ Input string -+ Error bool -+ Expected *FlexibleServerDatabaseId -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Error: true, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Error: true, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Error: true, -+ }, -+ -+ { -+ // missing FlexibleServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for FlexibleServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/", -+ Error: true, -+ }, -+ -+ { -+ // missing DatabaseName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/flexibleServer1/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for DatabaseName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/flexibleServer1/databases/", -+ Error: true, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/flexibleServer1/databases/database1", -+ Expected: &FlexibleServerDatabaseId{ -+ SubscriptionId: "12345678-1234-9876-4563-123456789012", -+ ResourceGroup: "resGroup1", -+ FlexibleServerName: "flexibleServer1", -+ DatabaseName: "database1", -+ }, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORPOSTGRESQL/FLEXIBLESERVERS/FLEXIBLESERVER1/DATABASES/DATABASE1", -+ Error: true, -+ }, -+ } -+ -+ for _, v := range testData { -+ t.Logf("[DEBUG] Testing %q", v.Input) -+ -+ actual, err := FlexibleServerDatabaseID(v.Input) -+ if err != nil { -+ if v.Error { -+ continue -+ } -+ -+ t.Fatalf("Expect a value but got an error: %s", err) -+ } -+ if v.Error { -+ t.Fatal("Expect an error but didn't get one") -+ } -+ -+ if actual.SubscriptionId != v.Expected.SubscriptionId { -+ t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) -+ } -+ if actual.ResourceGroup != v.Expected.ResourceGroup { -+ t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) -+ } -+ if actual.FlexibleServerName != v.Expected.FlexibleServerName { -+ t.Fatalf("Expected %q but got %q for FlexibleServerName", v.Expected.FlexibleServerName, actual.FlexibleServerName) -+ } -+ if actual.DatabaseName != v.Expected.DatabaseName { -+ t.Fatalf("Expected %q but got %q for DatabaseName", v.Expected.DatabaseName, actual.DatabaseName) -+ } -+ } -+} -diff --git a/internal/services/postgres/parse/flexible_server_firewall_rule.go b/internal/services/postgres/parse/flexible_server_firewall_rule.go -new file mode 100644 -index 0000000000..7a3d935c4c ---- /dev/null -+++ b/internal/services/postgres/parse/flexible_server_firewall_rule.go -@@ -0,0 +1,75 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ "strings" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+type FlexibleServerFirewallRuleId struct { -+ SubscriptionId string -+ ResourceGroup string -+ FlexibleServerName string -+ FirewallRuleName string -+} -+ -+func NewFlexibleServerFirewallRuleID(subscriptionId, resourceGroup, flexibleServerName, firewallRuleName string) FlexibleServerFirewallRuleId { -+ return FlexibleServerFirewallRuleId{ -+ SubscriptionId: subscriptionId, -+ ResourceGroup: resourceGroup, -+ FlexibleServerName: flexibleServerName, -+ FirewallRuleName: firewallRuleName, -+ } -+} -+ -+func (id FlexibleServerFirewallRuleId) String() string { -+ segments := []string{ -+ fmt.Sprintf("Firewall Rule Name %q", id.FirewallRuleName), -+ fmt.Sprintf("Flexible Server Name %q", id.FlexibleServerName), -+ fmt.Sprintf("Resource Group %q", id.ResourceGroup), -+ } -+ segmentsStr := strings.Join(segments, " / ") -+ return fmt.Sprintf("%s: (%s)", "Flexible Server Firewall Rule", segmentsStr) -+} -+ -+func (id FlexibleServerFirewallRuleId) ID() string { -+ fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s/firewallRules/%s" -+ return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.FlexibleServerName, id.FirewallRuleName) -+} -+ -+// FlexibleServerFirewallRuleID parses a FlexibleServerFirewallRule ID into an FlexibleServerFirewallRuleId struct -+func FlexibleServerFirewallRuleID(input string) (*FlexibleServerFirewallRuleId, error) { -+ id, err := resourceids.ParseAzureResourceID(input) -+ if err != nil { -+ return nil, err -+ } -+ -+ resourceId := FlexibleServerFirewallRuleId{ -+ SubscriptionId: id.SubscriptionID, -+ ResourceGroup: id.ResourceGroup, -+ } -+ -+ if resourceId.SubscriptionId == "" { -+ return nil, fmt.Errorf("ID was missing the 'subscriptions' element") -+ } -+ -+ if resourceId.ResourceGroup == "" { -+ return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") -+ } -+ -+ if resourceId.FlexibleServerName, err = id.PopSegment("flexibleServers"); err != nil { -+ return nil, err -+ } -+ if resourceId.FirewallRuleName, err = id.PopSegment("firewallRules"); err != nil { -+ return nil, err -+ } -+ -+ if err := id.ValidateNoEmptySegments(input); err != nil { -+ return nil, err -+ } -+ -+ return &resourceId, nil -+} -diff --git a/internal/services/postgres/parse/flexible_server_firewall_rule_test.go b/internal/services/postgres/parse/flexible_server_firewall_rule_test.go -new file mode 100644 -index 0000000000..0f938c5b30 ---- /dev/null -+++ b/internal/services/postgres/parse/flexible_server_firewall_rule_test.go -@@ -0,0 +1,128 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "testing" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+var _ resourceids.Id = FlexibleServerFirewallRuleId{} -+ -+func TestFlexibleServerFirewallRuleIDFormatter(t *testing.T) { -+ actual := NewFlexibleServerFirewallRuleID("12345678-1234-9876-4563-123456789012", "resGroup1", "flexibleServer1", "firewallRule1").ID() -+ expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/flexibleServer1/firewallRules/firewallRule1" -+ if actual != expected { -+ t.Fatalf("Expected %q but got %q", expected, actual) -+ } -+} -+ -+func TestFlexibleServerFirewallRuleID(t *testing.T) { -+ testData := []struct { -+ Input string -+ Error bool -+ Expected *FlexibleServerFirewallRuleId -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Error: true, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Error: true, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Error: true, -+ }, -+ -+ { -+ // missing FlexibleServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for FlexibleServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/", -+ Error: true, -+ }, -+ -+ { -+ // missing FirewallRuleName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/flexibleServer1/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for FirewallRuleName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/flexibleServer1/firewallRules/", -+ Error: true, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/flexibleServer1/firewallRules/firewallRule1", -+ Expected: &FlexibleServerFirewallRuleId{ -+ SubscriptionId: "12345678-1234-9876-4563-123456789012", -+ ResourceGroup: "resGroup1", -+ FlexibleServerName: "flexibleServer1", -+ FirewallRuleName: "firewallRule1", -+ }, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORPOSTGRESQL/FLEXIBLESERVERS/FLEXIBLESERVER1/FIREWALLRULES/FIREWALLRULE1", -+ Error: true, -+ }, -+ } -+ -+ for _, v := range testData { -+ t.Logf("[DEBUG] Testing %q", v.Input) -+ -+ actual, err := FlexibleServerFirewallRuleID(v.Input) -+ if err != nil { -+ if v.Error { -+ continue -+ } -+ -+ t.Fatalf("Expect a value but got an error: %s", err) -+ } -+ if v.Error { -+ t.Fatal("Expect an error but didn't get one") -+ } -+ -+ if actual.SubscriptionId != v.Expected.SubscriptionId { -+ t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) -+ } -+ if actual.ResourceGroup != v.Expected.ResourceGroup { -+ t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) -+ } -+ if actual.FlexibleServerName != v.Expected.FlexibleServerName { -+ t.Fatalf("Expected %q but got %q for FlexibleServerName", v.Expected.FlexibleServerName, actual.FlexibleServerName) -+ } -+ if actual.FirewallRuleName != v.Expected.FirewallRuleName { -+ t.Fatalf("Expected %q but got %q for FirewallRuleName", v.Expected.FirewallRuleName, actual.FirewallRuleName) -+ } -+ } -+} -diff --git a/internal/services/postgres/parse/flexible_server_test.go b/internal/services/postgres/parse/flexible_server_test.go -new file mode 100644 -index 0000000000..9902bf014f ---- /dev/null -+++ b/internal/services/postgres/parse/flexible_server_test.go -@@ -0,0 +1,112 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "testing" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+var _ resourceids.Id = FlexibleServerId{} -+ -+func TestFlexibleServerIDFormatter(t *testing.T) { -+ actual := NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "resGroup1", "flexibleServer1").ID() -+ expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/flexibleServer1" -+ if actual != expected { -+ t.Fatalf("Expected %q but got %q", expected, actual) -+ } -+} -+ -+func TestFlexibleServerID(t *testing.T) { -+ testData := []struct { -+ Input string -+ Error bool -+ Expected *FlexibleServerId -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Error: true, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Error: true, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Error: true, -+ }, -+ -+ { -+ // missing Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/", -+ Error: true, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/flexibleServer1", -+ Expected: &FlexibleServerId{ -+ SubscriptionId: "12345678-1234-9876-4563-123456789012", -+ ResourceGroup: "resGroup1", -+ Name: "flexibleServer1", -+ }, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORPOSTGRESQL/FLEXIBLESERVERS/FLEXIBLESERVER1", -+ Error: true, -+ }, -+ } -+ -+ for _, v := range testData { -+ t.Logf("[DEBUG] Testing %q", v.Input) -+ -+ actual, err := FlexibleServerID(v.Input) -+ if err != nil { -+ if v.Error { -+ continue -+ } -+ -+ t.Fatalf("Expect a value but got an error: %s", err) -+ } -+ if v.Error { -+ t.Fatal("Expect an error but didn't get one") -+ } -+ -+ if actual.SubscriptionId != v.Expected.SubscriptionId { -+ t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) -+ } -+ if actual.ResourceGroup != v.Expected.ResourceGroup { -+ t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) -+ } -+ if actual.Name != v.Expected.Name { -+ t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) -+ } -+ } -+} -diff --git a/internal/services/postgres/parse/server.go b/internal/services/postgres/parse/server.go -new file mode 100644 -index 0000000000..17dc8a9e70 ---- /dev/null -+++ b/internal/services/postgres/parse/server.go -@@ -0,0 +1,69 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ "strings" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+type ServerId struct { -+ SubscriptionId string -+ ResourceGroup string -+ Name string -+} -+ -+func NewServerID(subscriptionId, resourceGroup, name string) ServerId { -+ return ServerId{ -+ SubscriptionId: subscriptionId, -+ ResourceGroup: resourceGroup, -+ Name: name, -+ } -+} -+ -+func (id ServerId) String() string { -+ segments := []string{ -+ fmt.Sprintf("Name %q", id.Name), -+ fmt.Sprintf("Resource Group %q", id.ResourceGroup), -+ } -+ segmentsStr := strings.Join(segments, " / ") -+ return fmt.Sprintf("%s: (%s)", "Server", segmentsStr) -+} -+ -+func (id ServerId) ID() string { -+ fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/servers/%s" -+ return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -+} -+ -+// ServerID parses a Server ID into an ServerId struct -+func ServerID(input string) (*ServerId, error) { -+ id, err := resourceids.ParseAzureResourceID(input) -+ if err != nil { -+ return nil, err -+ } -+ -+ resourceId := ServerId{ -+ SubscriptionId: id.SubscriptionID, -+ ResourceGroup: id.ResourceGroup, -+ } -+ -+ if resourceId.SubscriptionId == "" { -+ return nil, fmt.Errorf("ID was missing the 'subscriptions' element") -+ } -+ -+ if resourceId.ResourceGroup == "" { -+ return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") -+ } -+ -+ if resourceId.Name, err = id.PopSegment("servers"); err != nil { -+ return nil, err -+ } -+ -+ if err := id.ValidateNoEmptySegments(input); err != nil { -+ return nil, err -+ } -+ -+ return &resourceId, nil -+} -diff --git a/internal/services/postgres/parse/server_key.go b/internal/services/postgres/parse/server_key.go -new file mode 100644 -index 0000000000..31da5fcb0e ---- /dev/null -+++ b/internal/services/postgres/parse/server_key.go -@@ -0,0 +1,75 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ "strings" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+type ServerKeyId struct { -+ SubscriptionId string -+ ResourceGroup string -+ ServerName string -+ KeyName string -+} -+ -+func NewServerKeyID(subscriptionId, resourceGroup, serverName, keyName string) ServerKeyId { -+ return ServerKeyId{ -+ SubscriptionId: subscriptionId, -+ ResourceGroup: resourceGroup, -+ ServerName: serverName, -+ KeyName: keyName, -+ } -+} -+ -+func (id ServerKeyId) String() string { -+ segments := []string{ -+ fmt.Sprintf("Key Name %q", id.KeyName), -+ fmt.Sprintf("Server Name %q", id.ServerName), -+ fmt.Sprintf("Resource Group %q", id.ResourceGroup), -+ } -+ segmentsStr := strings.Join(segments, " / ") -+ return fmt.Sprintf("%s: (%s)", "Server Key", segmentsStr) -+} -+ -+func (id ServerKeyId) ID() string { -+ fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/servers/%s/keys/%s" -+ return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ServerName, id.KeyName) -+} -+ -+// ServerKeyID parses a ServerKey ID into an ServerKeyId struct -+func ServerKeyID(input string) (*ServerKeyId, error) { -+ id, err := resourceids.ParseAzureResourceID(input) -+ if err != nil { -+ return nil, err -+ } -+ -+ resourceId := ServerKeyId{ -+ SubscriptionId: id.SubscriptionID, -+ ResourceGroup: id.ResourceGroup, -+ } -+ -+ if resourceId.SubscriptionId == "" { -+ return nil, fmt.Errorf("ID was missing the 'subscriptions' element") -+ } -+ -+ if resourceId.ResourceGroup == "" { -+ return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") -+ } -+ -+ if resourceId.ServerName, err = id.PopSegment("servers"); err != nil { -+ return nil, err -+ } -+ if resourceId.KeyName, err = id.PopSegment("keys"); err != nil { -+ return nil, err -+ } -+ -+ if err := id.ValidateNoEmptySegments(input); err != nil { -+ return nil, err -+ } -+ -+ return &resourceId, nil -+} -diff --git a/internal/services/postgres/parse/server_key_test.go b/internal/services/postgres/parse/server_key_test.go -new file mode 100644 -index 0000000000..4e4a93c469 ---- /dev/null -+++ b/internal/services/postgres/parse/server_key_test.go -@@ -0,0 +1,128 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "testing" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+var _ resourceids.Id = ServerKeyId{} -+ -+func TestServerKeyIDFormatter(t *testing.T) { -+ actual := NewServerKeyID("12345678-1234-9876-4563-123456789012", "resGroup1", "server1", "key1").ID() -+ expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/keys/key1" -+ if actual != expected { -+ t.Fatalf("Expected %q but got %q", expected, actual) -+ } -+} -+ -+func TestServerKeyID(t *testing.T) { -+ testData := []struct { -+ Input string -+ Error bool -+ Expected *ServerKeyId -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Error: true, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Error: true, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Error: true, -+ }, -+ -+ { -+ // missing ServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for ServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/", -+ Error: true, -+ }, -+ -+ { -+ // missing KeyName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for KeyName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/keys/", -+ Error: true, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/keys/key1", -+ Expected: &ServerKeyId{ -+ SubscriptionId: "12345678-1234-9876-4563-123456789012", -+ ResourceGroup: "resGroup1", -+ ServerName: "server1", -+ KeyName: "key1", -+ }, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORPOSTGRESQL/SERVERS/SERVER1/KEYS/KEY1", -+ Error: true, -+ }, -+ } -+ -+ for _, v := range testData { -+ t.Logf("[DEBUG] Testing %q", v.Input) -+ -+ actual, err := ServerKeyID(v.Input) -+ if err != nil { -+ if v.Error { -+ continue -+ } -+ -+ t.Fatalf("Expect a value but got an error: %s", err) -+ } -+ if v.Error { -+ t.Fatal("Expect an error but didn't get one") -+ } -+ -+ if actual.SubscriptionId != v.Expected.SubscriptionId { -+ t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) -+ } -+ if actual.ResourceGroup != v.Expected.ResourceGroup { -+ t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) -+ } -+ if actual.ServerName != v.Expected.ServerName { -+ t.Fatalf("Expected %q but got %q for ServerName", v.Expected.ServerName, actual.ServerName) -+ } -+ if actual.KeyName != v.Expected.KeyName { -+ t.Fatalf("Expected %q but got %q for KeyName", v.Expected.KeyName, actual.KeyName) -+ } -+ } -+} -diff --git a/internal/services/postgres/parse/server_test.go b/internal/services/postgres/parse/server_test.go -new file mode 100644 -index 0000000000..7b13b5a049 ---- /dev/null -+++ b/internal/services/postgres/parse/server_test.go -@@ -0,0 +1,112 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "testing" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+var _ resourceids.Id = ServerId{} -+ -+func TestServerIDFormatter(t *testing.T) { -+ actual := NewServerID("12345678-1234-9876-4563-123456789012", "resGroup1", "server1").ID() -+ expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1" -+ if actual != expected { -+ t.Fatalf("Expected %q but got %q", expected, actual) -+ } -+} -+ -+func TestServerID(t *testing.T) { -+ testData := []struct { -+ Input string -+ Error bool -+ Expected *ServerId -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Error: true, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Error: true, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Error: true, -+ }, -+ -+ { -+ // missing Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/", -+ Error: true, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1", -+ Expected: &ServerId{ -+ SubscriptionId: "12345678-1234-9876-4563-123456789012", -+ ResourceGroup: "resGroup1", -+ Name: "server1", -+ }, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORPOSTGRESQL/SERVERS/SERVER1", -+ Error: true, -+ }, -+ } -+ -+ for _, v := range testData { -+ t.Logf("[DEBUG] Testing %q", v.Input) -+ -+ actual, err := ServerID(v.Input) -+ if err != nil { -+ if v.Error { -+ continue -+ } -+ -+ t.Fatalf("Expect a value but got an error: %s", err) -+ } -+ if v.Error { -+ t.Fatal("Expect an error but didn't get one") -+ } -+ -+ if actual.SubscriptionId != v.Expected.SubscriptionId { -+ t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) -+ } -+ if actual.ResourceGroup != v.Expected.ResourceGroup { -+ t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) -+ } -+ if actual.Name != v.Expected.Name { -+ t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) -+ } -+ } -+} -diff --git a/internal/services/postgres/parse/virtual_network_rule.go b/internal/services/postgres/parse/virtual_network_rule.go -new file mode 100644 -index 0000000000..f080046b23 ---- /dev/null -+++ b/internal/services/postgres/parse/virtual_network_rule.go -@@ -0,0 +1,75 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ "strings" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+type VirtualNetworkRuleId struct { -+ SubscriptionId string -+ ResourceGroup string -+ ServerName string -+ Name string -+} -+ -+func NewVirtualNetworkRuleID(subscriptionId, resourceGroup, serverName, name string) VirtualNetworkRuleId { -+ return VirtualNetworkRuleId{ -+ SubscriptionId: subscriptionId, -+ ResourceGroup: resourceGroup, -+ ServerName: serverName, -+ Name: name, -+ } -+} -+ -+func (id VirtualNetworkRuleId) String() string { -+ segments := []string{ -+ fmt.Sprintf("Name %q", id.Name), -+ fmt.Sprintf("Server Name %q", id.ServerName), -+ fmt.Sprintf("Resource Group %q", id.ResourceGroup), -+ } -+ segmentsStr := strings.Join(segments, " / ") -+ return fmt.Sprintf("%s: (%s)", "Virtual Network Rule", segmentsStr) -+} -+ -+func (id VirtualNetworkRuleId) ID() string { -+ fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/servers/%s/virtualNetworkRules/%s" -+ return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ServerName, id.Name) -+} -+ -+// VirtualNetworkRuleID parses a VirtualNetworkRule ID into an VirtualNetworkRuleId struct -+func VirtualNetworkRuleID(input string) (*VirtualNetworkRuleId, error) { -+ id, err := resourceids.ParseAzureResourceID(input) -+ if err != nil { -+ return nil, err -+ } -+ -+ resourceId := VirtualNetworkRuleId{ -+ SubscriptionId: id.SubscriptionID, -+ ResourceGroup: id.ResourceGroup, -+ } -+ -+ if resourceId.SubscriptionId == "" { -+ return nil, fmt.Errorf("ID was missing the 'subscriptions' element") -+ } -+ -+ if resourceId.ResourceGroup == "" { -+ return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") -+ } -+ -+ if resourceId.ServerName, err = id.PopSegment("servers"); err != nil { -+ return nil, err -+ } -+ if resourceId.Name, err = id.PopSegment("virtualNetworkRules"); err != nil { -+ return nil, err -+ } -+ -+ if err := id.ValidateNoEmptySegments(input); err != nil { -+ return nil, err -+ } -+ -+ return &resourceId, nil -+} -diff --git a/internal/services/postgres/parse/virtual_network_rule_test.go b/internal/services/postgres/parse/virtual_network_rule_test.go -new file mode 100644 -index 0000000000..e0a631283c ---- /dev/null -+++ b/internal/services/postgres/parse/virtual_network_rule_test.go -@@ -0,0 +1,128 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "testing" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+var _ resourceids.Id = VirtualNetworkRuleId{} -+ -+func TestVirtualNetworkRuleIDFormatter(t *testing.T) { -+ actual := NewVirtualNetworkRuleID("12345678-1234-9876-4563-123456789012", "resGroup1", "server1", "virtualNetworkRule1").ID() -+ expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/virtualNetworkRules/virtualNetworkRule1" -+ if actual != expected { -+ t.Fatalf("Expected %q but got %q", expected, actual) -+ } -+} -+ -+func TestVirtualNetworkRuleID(t *testing.T) { -+ testData := []struct { -+ Input string -+ Error bool -+ Expected *VirtualNetworkRuleId -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Error: true, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Error: true, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Error: true, -+ }, -+ -+ { -+ // missing ServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for ServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/", -+ Error: true, -+ }, -+ -+ { -+ // missing Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/virtualNetworkRules/", -+ Error: true, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/virtualNetworkRules/virtualNetworkRule1", -+ Expected: &VirtualNetworkRuleId{ -+ SubscriptionId: "12345678-1234-9876-4563-123456789012", -+ ResourceGroup: "resGroup1", -+ ServerName: "server1", -+ Name: "virtualNetworkRule1", -+ }, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORPOSTGRESQL/SERVERS/SERVER1/VIRTUALNETWORKRULES/VIRTUALNETWORKRULE1", -+ Error: true, -+ }, -+ } -+ -+ for _, v := range testData { -+ t.Logf("[DEBUG] Testing %q", v.Input) -+ -+ actual, err := VirtualNetworkRuleID(v.Input) -+ if err != nil { -+ if v.Error { -+ continue -+ } -+ -+ t.Fatalf("Expect a value but got an error: %s", err) -+ } -+ if v.Error { -+ t.Fatal("Expect an error but didn't get one") -+ } -+ -+ if actual.SubscriptionId != v.Expected.SubscriptionId { -+ t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) -+ } -+ if actual.ResourceGroup != v.Expected.ResourceGroup { -+ t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) -+ } -+ if actual.ServerName != v.Expected.ServerName { -+ t.Fatalf("Expected %q but got %q for ServerName", v.Expected.ServerName, actual.ServerName) -+ } -+ if actual.Name != v.Expected.Name { -+ t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) -+ } -+ } -+} -diff --git a/internal/services/postgres/validate/configuration_id.go b/internal/services/postgres/validate/configuration_id.go -new file mode 100644 -index 0000000000..5fbc75f538 ---- /dev/null -+++ b/internal/services/postgres/validate/configuration_id.go -@@ -0,0 +1,23 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ -+ "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" -+) -+ -+func ConfigurationID(input interface{}, key string) (warnings []string, errors []error) { -+ v, ok := input.(string) -+ if !ok { -+ errors = append(errors, fmt.Errorf("expected %q to be a string", key)) -+ return -+ } -+ -+ if _, err := parse.ConfigurationID(v); err != nil { -+ errors = append(errors, err) -+ } -+ -+ return -+} -diff --git a/internal/services/postgres/validate/configuration_id_test.go b/internal/services/postgres/validate/configuration_id_test.go -new file mode 100644 -index 0000000000..098402a2fa ---- /dev/null -+++ b/internal/services/postgres/validate/configuration_id_test.go -@@ -0,0 +1,88 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import "testing" -+ -+func TestConfigurationID(t *testing.T) { -+ cases := []struct { -+ Input string -+ Valid bool -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Valid: false, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Valid: false, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Valid: false, -+ }, -+ -+ { -+ // missing ServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for ServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/", -+ Valid: false, -+ }, -+ -+ { -+ // missing Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/configurations/", -+ Valid: false, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/configurations/configuration1", -+ Valid: true, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORPOSTGRESQL/SERVERS/SERVER1/CONFIGURATIONS/CONFIGURATION1", -+ Valid: false, -+ }, -+ } -+ for _, tc := range cases { -+ t.Logf("[DEBUG] Testing Value %s", tc.Input) -+ _, errors := ConfigurationID(tc.Input, "test") -+ valid := len(errors) == 0 -+ -+ if tc.Valid != valid { -+ t.Fatalf("Expected %t but got %t", tc.Valid, valid) -+ } -+ } -+} -diff --git a/internal/services/postgres/validate/database_id.go b/internal/services/postgres/validate/database_id.go -new file mode 100644 -index 0000000000..24a8ecbddc ---- /dev/null -+++ b/internal/services/postgres/validate/database_id.go -@@ -0,0 +1,23 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ -+ "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" -+) -+ -+func DatabaseID(input interface{}, key string) (warnings []string, errors []error) { -+ v, ok := input.(string) -+ if !ok { -+ errors = append(errors, fmt.Errorf("expected %q to be a string", key)) -+ return -+ } -+ -+ if _, err := parse.DatabaseID(v); err != nil { -+ errors = append(errors, err) -+ } -+ -+ return -+} -diff --git a/internal/services/postgres/validate/database_id_test.go b/internal/services/postgres/validate/database_id_test.go -new file mode 100644 -index 0000000000..8744c37128 ---- /dev/null -+++ b/internal/services/postgres/validate/database_id_test.go -@@ -0,0 +1,88 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import "testing" -+ -+func TestDatabaseID(t *testing.T) { -+ cases := []struct { -+ Input string -+ Valid bool -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Valid: false, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Valid: false, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Valid: false, -+ }, -+ -+ { -+ // missing ServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for ServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/", -+ Valid: false, -+ }, -+ -+ { -+ // missing Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/databases/", -+ Valid: false, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/databases/database1", -+ Valid: true, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORPOSTGRESQL/SERVERS/SERVER1/DATABASES/DATABASE1", -+ Valid: false, -+ }, -+ } -+ for _, tc := range cases { -+ t.Logf("[DEBUG] Testing Value %s", tc.Input) -+ _, errors := DatabaseID(tc.Input, "test") -+ valid := len(errors) == 0 -+ -+ if tc.Valid != valid { -+ t.Fatalf("Expected %t but got %t", tc.Valid, valid) -+ } -+ } -+} -diff --git a/internal/services/postgres/validate/firewall_rule_id.go b/internal/services/postgres/validate/firewall_rule_id.go -new file mode 100644 -index 0000000000..e0ded2db61 ---- /dev/null -+++ b/internal/services/postgres/validate/firewall_rule_id.go -@@ -0,0 +1,23 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ -+ "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" -+) -+ -+func FirewallRuleID(input interface{}, key string) (warnings []string, errors []error) { -+ v, ok := input.(string) -+ if !ok { -+ errors = append(errors, fmt.Errorf("expected %q to be a string", key)) -+ return -+ } -+ -+ if _, err := parse.FirewallRuleID(v); err != nil { -+ errors = append(errors, err) -+ } -+ -+ return -+} -diff --git a/internal/services/postgres/validate/firewall_rule_id_test.go b/internal/services/postgres/validate/firewall_rule_id_test.go -new file mode 100644 -index 0000000000..77777ead15 ---- /dev/null -+++ b/internal/services/postgres/validate/firewall_rule_id_test.go -@@ -0,0 +1,88 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import "testing" -+ -+func TestFirewallRuleID(t *testing.T) { -+ cases := []struct { -+ Input string -+ Valid bool -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Valid: false, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Valid: false, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Valid: false, -+ }, -+ -+ { -+ // missing ServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for ServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/", -+ Valid: false, -+ }, -+ -+ { -+ // missing Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/firewallRules/", -+ Valid: false, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/firewallRules/firewallRule1", -+ Valid: true, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORPOSTGRESQL/SERVERS/SERVER1/FIREWALLRULES/FIREWALLRULE1", -+ Valid: false, -+ }, -+ } -+ for _, tc := range cases { -+ t.Logf("[DEBUG] Testing Value %s", tc.Input) -+ _, errors := FirewallRuleID(tc.Input, "test") -+ valid := len(errors) == 0 -+ -+ if tc.Valid != valid { -+ t.Fatalf("Expected %t but got %t", tc.Valid, valid) -+ } -+ } -+} -diff --git a/internal/services/postgres/validate/flexible_server_configuration_id.go b/internal/services/postgres/validate/flexible_server_configuration_id.go -new file mode 100644 -index 0000000000..fc654717d9 ---- /dev/null -+++ b/internal/services/postgres/validate/flexible_server_configuration_id.go -@@ -0,0 +1,23 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ -+ "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" -+) -+ -+func FlexibleServerConfigurationID(input interface{}, key string) (warnings []string, errors []error) { -+ v, ok := input.(string) -+ if !ok { -+ errors = append(errors, fmt.Errorf("expected %q to be a string", key)) -+ return -+ } -+ -+ if _, err := parse.FlexibleServerConfigurationID(v); err != nil { -+ errors = append(errors, err) -+ } -+ -+ return -+} -diff --git a/internal/services/postgres/validate/flexible_server_configuration_id_test.go b/internal/services/postgres/validate/flexible_server_configuration_id_test.go -new file mode 100644 -index 0000000000..682bd62c85 ---- /dev/null -+++ b/internal/services/postgres/validate/flexible_server_configuration_id_test.go -@@ -0,0 +1,88 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import "testing" -+ -+func TestFlexibleServerConfigurationID(t *testing.T) { -+ cases := []struct { -+ Input string -+ Valid bool -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Valid: false, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Valid: false, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Valid: false, -+ }, -+ -+ { -+ // missing FlexibleServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for FlexibleServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/", -+ Valid: false, -+ }, -+ -+ { -+ // missing ConfigurationName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/flexibleServer1/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for ConfigurationName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/flexibleServer1/configurations/", -+ Valid: false, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/flexibleServer1/configurations/configuration1", -+ Valid: true, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORPOSTGRESQL/FLEXIBLESERVERS/FLEXIBLESERVER1/CONFIGURATIONS/CONFIGURATION1", -+ Valid: false, -+ }, -+ } -+ for _, tc := range cases { -+ t.Logf("[DEBUG] Testing Value %s", tc.Input) -+ _, errors := FlexibleServerConfigurationID(tc.Input, "test") -+ valid := len(errors) == 0 -+ -+ if tc.Valid != valid { -+ t.Fatalf("Expected %t but got %t", tc.Valid, valid) -+ } -+ } -+} -diff --git a/internal/services/postgres/validate/flexible_server_database_id.go b/internal/services/postgres/validate/flexible_server_database_id.go -new file mode 100644 -index 0000000000..c899f3d7fc ---- /dev/null -+++ b/internal/services/postgres/validate/flexible_server_database_id.go -@@ -0,0 +1,23 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ -+ "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" -+) -+ -+func FlexibleServerDatabaseID(input interface{}, key string) (warnings []string, errors []error) { -+ v, ok := input.(string) -+ if !ok { -+ errors = append(errors, fmt.Errorf("expected %q to be a string", key)) -+ return -+ } -+ -+ if _, err := parse.FlexibleServerDatabaseID(v); err != nil { -+ errors = append(errors, err) -+ } -+ -+ return -+} -diff --git a/internal/services/postgres/validate/flexible_server_database_id_test.go b/internal/services/postgres/validate/flexible_server_database_id_test.go -new file mode 100644 -index 0000000000..9ee1cd6859 ---- /dev/null -+++ b/internal/services/postgres/validate/flexible_server_database_id_test.go -@@ -0,0 +1,88 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import "testing" -+ -+func TestFlexibleServerDatabaseID(t *testing.T) { -+ cases := []struct { -+ Input string -+ Valid bool -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Valid: false, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Valid: false, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Valid: false, -+ }, -+ -+ { -+ // missing FlexibleServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for FlexibleServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/", -+ Valid: false, -+ }, -+ -+ { -+ // missing DatabaseName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/flexibleServer1/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for DatabaseName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/flexibleServer1/databases/", -+ Valid: false, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/flexibleServer1/databases/database1", -+ Valid: true, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORPOSTGRESQL/FLEXIBLESERVERS/FLEXIBLESERVER1/DATABASES/DATABASE1", -+ Valid: false, -+ }, -+ } -+ for _, tc := range cases { -+ t.Logf("[DEBUG] Testing Value %s", tc.Input) -+ _, errors := FlexibleServerDatabaseID(tc.Input, "test") -+ valid := len(errors) == 0 -+ -+ if tc.Valid != valid { -+ t.Fatalf("Expected %t but got %t", tc.Valid, valid) -+ } -+ } -+} -diff --git a/internal/services/postgres/validate/flexible_server_firewall_rule_id.go b/internal/services/postgres/validate/flexible_server_firewall_rule_id.go -new file mode 100644 -index 0000000000..62063f69a9 ---- /dev/null -+++ b/internal/services/postgres/validate/flexible_server_firewall_rule_id.go -@@ -0,0 +1,23 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ -+ "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" -+) -+ -+func FlexibleServerFirewallRuleID(input interface{}, key string) (warnings []string, errors []error) { -+ v, ok := input.(string) -+ if !ok { -+ errors = append(errors, fmt.Errorf("expected %q to be a string", key)) -+ return -+ } -+ -+ if _, err := parse.FlexibleServerFirewallRuleID(v); err != nil { -+ errors = append(errors, err) -+ } -+ -+ return -+} -diff --git a/internal/services/postgres/validate/flexible_server_firewall_rule_id_test.go b/internal/services/postgres/validate/flexible_server_firewall_rule_id_test.go -new file mode 100644 -index 0000000000..8eed3cdd11 ---- /dev/null -+++ b/internal/services/postgres/validate/flexible_server_firewall_rule_id_test.go -@@ -0,0 +1,88 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import "testing" -+ -+func TestFlexibleServerFirewallRuleID(t *testing.T) { -+ cases := []struct { -+ Input string -+ Valid bool -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Valid: false, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Valid: false, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Valid: false, -+ }, -+ -+ { -+ // missing FlexibleServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for FlexibleServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/", -+ Valid: false, -+ }, -+ -+ { -+ // missing FirewallRuleName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/flexibleServer1/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for FirewallRuleName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/flexibleServer1/firewallRules/", -+ Valid: false, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/flexibleServer1/firewallRules/firewallRule1", -+ Valid: true, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORPOSTGRESQL/FLEXIBLESERVERS/FLEXIBLESERVER1/FIREWALLRULES/FIREWALLRULE1", -+ Valid: false, -+ }, -+ } -+ for _, tc := range cases { -+ t.Logf("[DEBUG] Testing Value %s", tc.Input) -+ _, errors := FlexibleServerFirewallRuleID(tc.Input, "test") -+ valid := len(errors) == 0 -+ -+ if tc.Valid != valid { -+ t.Fatalf("Expected %t but got %t", tc.Valid, valid) -+ } -+ } -+} -diff --git a/internal/services/postgres/validate/flexible_server_id.go b/internal/services/postgres/validate/flexible_server_id.go -new file mode 100644 -index 0000000000..1b998295da ---- /dev/null -+++ b/internal/services/postgres/validate/flexible_server_id.go -@@ -0,0 +1,23 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ -+ "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" -+) -+ -+func FlexibleServerID(input interface{}, key string) (warnings []string, errors []error) { -+ v, ok := input.(string) -+ if !ok { -+ errors = append(errors, fmt.Errorf("expected %q to be a string", key)) -+ return -+ } -+ -+ if _, err := parse.FlexibleServerID(v); err != nil { -+ errors = append(errors, err) -+ } -+ -+ return -+} -diff --git a/internal/services/postgres/validate/flexible_server_id_test.go b/internal/services/postgres/validate/flexible_server_id_test.go -new file mode 100644 -index 0000000000..b0f0eae7d8 ---- /dev/null -+++ b/internal/services/postgres/validate/flexible_server_id_test.go -@@ -0,0 +1,76 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import "testing" -+ -+func TestFlexibleServerID(t *testing.T) { -+ cases := []struct { -+ Input string -+ Valid bool -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Valid: false, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Valid: false, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Valid: false, -+ }, -+ -+ { -+ // missing Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/", -+ Valid: false, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/flexibleServers/flexibleServer1", -+ Valid: true, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORPOSTGRESQL/FLEXIBLESERVERS/FLEXIBLESERVER1", -+ Valid: false, -+ }, -+ } -+ for _, tc := range cases { -+ t.Logf("[DEBUG] Testing Value %s", tc.Input) -+ _, errors := FlexibleServerID(tc.Input, "test") -+ valid := len(errors) == 0 -+ -+ if tc.Valid != valid { -+ t.Fatalf("Expected %t but got %t", tc.Valid, valid) -+ } -+ } -+} -diff --git a/internal/services/postgres/validate/server_id.go b/internal/services/postgres/validate/server_id.go -new file mode 100644 -index 0000000000..a7864ea196 ---- /dev/null -+++ b/internal/services/postgres/validate/server_id.go -@@ -0,0 +1,23 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ -+ "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" -+) -+ -+func ServerID(input interface{}, key string) (warnings []string, errors []error) { -+ v, ok := input.(string) -+ if !ok { -+ errors = append(errors, fmt.Errorf("expected %q to be a string", key)) -+ return -+ } -+ -+ if _, err := parse.ServerID(v); err != nil { -+ errors = append(errors, err) -+ } -+ -+ return -+} -diff --git a/internal/services/postgres/validate/server_id_test.go b/internal/services/postgres/validate/server_id_test.go -new file mode 100644 -index 0000000000..1fcf76082f ---- /dev/null -+++ b/internal/services/postgres/validate/server_id_test.go -@@ -0,0 +1,76 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import "testing" -+ -+func TestServerID(t *testing.T) { -+ cases := []struct { -+ Input string -+ Valid bool -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Valid: false, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Valid: false, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Valid: false, -+ }, -+ -+ { -+ // missing Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/", -+ Valid: false, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1", -+ Valid: true, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORPOSTGRESQL/SERVERS/SERVER1", -+ Valid: false, -+ }, -+ } -+ for _, tc := range cases { -+ t.Logf("[DEBUG] Testing Value %s", tc.Input) -+ _, errors := ServerID(tc.Input, "test") -+ valid := len(errors) == 0 -+ -+ if tc.Valid != valid { -+ t.Fatalf("Expected %t but got %t", tc.Valid, valid) -+ } -+ } -+} -diff --git a/internal/services/postgres/validate/server_key_id.go b/internal/services/postgres/validate/server_key_id.go -new file mode 100644 -index 0000000000..fda821517d ---- /dev/null -+++ b/internal/services/postgres/validate/server_key_id.go -@@ -0,0 +1,23 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ -+ "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" -+) -+ -+func ServerKeyID(input interface{}, key string) (warnings []string, errors []error) { -+ v, ok := input.(string) -+ if !ok { -+ errors = append(errors, fmt.Errorf("expected %q to be a string", key)) -+ return -+ } -+ -+ if _, err := parse.ServerKeyID(v); err != nil { -+ errors = append(errors, err) -+ } -+ -+ return -+} -diff --git a/internal/services/postgres/validate/server_key_id_test.go b/internal/services/postgres/validate/server_key_id_test.go -new file mode 100644 -index 0000000000..c63b0d673a ---- /dev/null -+++ b/internal/services/postgres/validate/server_key_id_test.go -@@ -0,0 +1,88 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import "testing" -+ -+func TestServerKeyID(t *testing.T) { -+ cases := []struct { -+ Input string -+ Valid bool -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Valid: false, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Valid: false, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Valid: false, -+ }, -+ -+ { -+ // missing ServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for ServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/", -+ Valid: false, -+ }, -+ -+ { -+ // missing KeyName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for KeyName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/keys/", -+ Valid: false, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/keys/key1", -+ Valid: true, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORPOSTGRESQL/SERVERS/SERVER1/KEYS/KEY1", -+ Valid: false, -+ }, -+ } -+ for _, tc := range cases { -+ t.Logf("[DEBUG] Testing Value %s", tc.Input) -+ _, errors := ServerKeyID(tc.Input, "test") -+ valid := len(errors) == 0 -+ -+ if tc.Valid != valid { -+ t.Fatalf("Expected %t but got %t", tc.Valid, valid) -+ } -+ } -+} -diff --git a/internal/services/postgres/validate/virtual_network_rule_id.go b/internal/services/postgres/validate/virtual_network_rule_id.go -new file mode 100644 -index 0000000000..550db479d5 ---- /dev/null -+++ b/internal/services/postgres/validate/virtual_network_rule_id.go -@@ -0,0 +1,23 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ -+ "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" -+) -+ -+func VirtualNetworkRuleID(input interface{}, key string) (warnings []string, errors []error) { -+ v, ok := input.(string) -+ if !ok { -+ errors = append(errors, fmt.Errorf("expected %q to be a string", key)) -+ return -+ } -+ -+ if _, err := parse.VirtualNetworkRuleID(v); err != nil { -+ errors = append(errors, err) -+ } -+ -+ return -+} -diff --git a/internal/services/postgres/validate/virtual_network_rule_id_test.go b/internal/services/postgres/validate/virtual_network_rule_id_test.go -new file mode 100644 -index 0000000000..bb3af88774 ---- /dev/null -+++ b/internal/services/postgres/validate/virtual_network_rule_id_test.go -@@ -0,0 +1,88 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import "testing" -+ -+func TestVirtualNetworkRuleID(t *testing.T) { -+ cases := []struct { -+ Input string -+ Valid bool -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Valid: false, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Valid: false, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Valid: false, -+ }, -+ -+ { -+ // missing ServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for ServerName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/", -+ Valid: false, -+ }, -+ -+ { -+ // missing Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/virtualNetworkRules/", -+ Valid: false, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/virtualNetworkRules/virtualNetworkRule1", -+ Valid: true, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORPOSTGRESQL/SERVERS/SERVER1/VIRTUALNETWORKRULES/VIRTUALNETWORKRULE1", -+ Valid: false, -+ }, -+ } -+ for _, tc := range cases { -+ t.Logf("[DEBUG] Testing Value %s", tc.Input) -+ _, errors := VirtualNetworkRuleID(tc.Input, "test") -+ valid := len(errors) == 0 -+ -+ if tc.Valid != valid { -+ t.Fatalf("Expected %t but got %t", tc.Valid, valid) -+ } -+ } -+} -diff --git a/internal/services/privatedns/validate/a_record_id.go b/internal/services/privatedns/validate/a_record_id.go -new file mode 100644 -index 0000000000..82a9bc6240 ---- /dev/null -+++ b/internal/services/privatedns/validate/a_record_id.go -@@ -0,0 +1,23 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ -+ "github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/parse" -+) -+ -+func ARecordID(input interface{}, key string) (warnings []string, errors []error) { -+ v, ok := input.(string) -+ if !ok { -+ errors = append(errors, fmt.Errorf("expected %q to be a string", key)) -+ return -+ } -+ -+ if _, err := parse.ARecordID(v); err != nil { -+ errors = append(errors, err) -+ } -+ -+ return -+} -diff --git a/internal/services/privatedns/validate/a_record_id_test.go b/internal/services/privatedns/validate/a_record_id_test.go -new file mode 100644 -index 0000000000..137de55ed2 ---- /dev/null -+++ b/internal/services/privatedns/validate/a_record_id_test.go -@@ -0,0 +1,88 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import "testing" -+ -+func TestARecordID(t *testing.T) { -+ cases := []struct { -+ Input string -+ Valid bool -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Valid: false, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Valid: false, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Valid: false, -+ }, -+ -+ { -+ // missing PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/", -+ Valid: false, -+ }, -+ -+ { -+ // missing AName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for AName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/A/", -+ Valid: false, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/A/eh1", -+ Valid: true, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/PRIVATEDNSZONES/PRIVATEDNSZONE1/A/EH1", -+ Valid: false, -+ }, -+ } -+ for _, tc := range cases { -+ t.Logf("[DEBUG] Testing Value %s", tc.Input) -+ _, errors := ARecordID(tc.Input, "test") -+ valid := len(errors) == 0 -+ -+ if tc.Valid != valid { -+ t.Fatalf("Expected %t but got %t", tc.Valid, valid) -+ } -+ } -+} -diff --git a/internal/services/privatedns/validate/aaaa_record_id.go b/internal/services/privatedns/validate/aaaa_record_id.go -new file mode 100644 -index 0000000000..4a793181f7 ---- /dev/null -+++ b/internal/services/privatedns/validate/aaaa_record_id.go -@@ -0,0 +1,23 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ -+ "github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/parse" -+) -+ -+func AaaaRecordID(input interface{}, key string) (warnings []string, errors []error) { -+ v, ok := input.(string) -+ if !ok { -+ errors = append(errors, fmt.Errorf("expected %q to be a string", key)) -+ return -+ } -+ -+ if _, err := parse.AaaaRecordID(v); err != nil { -+ errors = append(errors, err) -+ } -+ -+ return -+} -diff --git a/internal/services/privatedns/validate/aaaa_record_id_test.go b/internal/services/privatedns/validate/aaaa_record_id_test.go -new file mode 100644 -index 0000000000..722ad2db77 ---- /dev/null -+++ b/internal/services/privatedns/validate/aaaa_record_id_test.go -@@ -0,0 +1,88 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import "testing" -+ -+func TestAaaaRecordID(t *testing.T) { -+ cases := []struct { -+ Input string -+ Valid bool -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Valid: false, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Valid: false, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Valid: false, -+ }, -+ -+ { -+ // missing PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/", -+ Valid: false, -+ }, -+ -+ { -+ // missing AAAAName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for AAAAName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/AAAA/", -+ Valid: false, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/AAAA/eheh1", -+ Valid: true, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/PRIVATEDNSZONES/PRIVATEDNSZONE1/AAAA/EHEH1", -+ Valid: false, -+ }, -+ } -+ for _, tc := range cases { -+ t.Logf("[DEBUG] Testing Value %s", tc.Input) -+ _, errors := AaaaRecordID(tc.Input, "test") -+ valid := len(errors) == 0 -+ -+ if tc.Valid != valid { -+ t.Fatalf("Expected %t but got %t", tc.Valid, valid) -+ } -+ } -+} -diff --git a/internal/services/privatedns/validate/cname_record_id.go b/internal/services/privatedns/validate/cname_record_id.go -new file mode 100644 -index 0000000000..e7ba85b949 ---- /dev/null -+++ b/internal/services/privatedns/validate/cname_record_id.go -@@ -0,0 +1,23 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ -+ "github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/parse" -+) -+ -+func CnameRecordID(input interface{}, key string) (warnings []string, errors []error) { -+ v, ok := input.(string) -+ if !ok { -+ errors = append(errors, fmt.Errorf("expected %q to be a string", key)) -+ return -+ } -+ -+ if _, err := parse.CnameRecordID(v); err != nil { -+ errors = append(errors, err) -+ } -+ -+ return -+} -diff --git a/internal/services/privatedns/validate/cname_record_id_test.go b/internal/services/privatedns/validate/cname_record_id_test.go -new file mode 100644 -index 0000000000..0a36d0a361 ---- /dev/null -+++ b/internal/services/privatedns/validate/cname_record_id_test.go -@@ -0,0 +1,88 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import "testing" -+ -+func TestCnameRecordID(t *testing.T) { -+ cases := []struct { -+ Input string -+ Valid bool -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Valid: false, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Valid: false, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Valid: false, -+ }, -+ -+ { -+ // missing PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/", -+ Valid: false, -+ }, -+ -+ { -+ // missing CNAMEName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for CNAMEName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/CNAME/", -+ Valid: false, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/CNAME/name1", -+ Valid: true, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/PRIVATEDNSZONES/PRIVATEDNSZONE1/CNAME/NAME1", -+ Valid: false, -+ }, -+ } -+ for _, tc := range cases { -+ t.Logf("[DEBUG] Testing Value %s", tc.Input) -+ _, errors := CnameRecordID(tc.Input, "test") -+ valid := len(errors) == 0 -+ -+ if tc.Valid != valid { -+ t.Fatalf("Expected %t but got %t", tc.Valid, valid) -+ } -+ } -+} -diff --git a/internal/services/privatedns/validate/mx_record_id.go b/internal/services/privatedns/validate/mx_record_id.go -new file mode 100644 -index 0000000000..101ee7ae36 ---- /dev/null -+++ b/internal/services/privatedns/validate/mx_record_id.go -@@ -0,0 +1,23 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ -+ "github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/parse" -+) -+ -+func MxRecordID(input interface{}, key string) (warnings []string, errors []error) { -+ v, ok := input.(string) -+ if !ok { -+ errors = append(errors, fmt.Errorf("expected %q to be a string", key)) -+ return -+ } -+ -+ if _, err := parse.MxRecordID(v); err != nil { -+ errors = append(errors, err) -+ } -+ -+ return -+} -diff --git a/internal/services/privatedns/validate/mx_record_id_test.go b/internal/services/privatedns/validate/mx_record_id_test.go -new file mode 100644 -index 0000000000..3856df0dd6 ---- /dev/null -+++ b/internal/services/privatedns/validate/mx_record_id_test.go -@@ -0,0 +1,88 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import "testing" -+ -+func TestMxRecordID(t *testing.T) { -+ cases := []struct { -+ Input string -+ Valid bool -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Valid: false, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Valid: false, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Valid: false, -+ }, -+ -+ { -+ // missing PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/", -+ Valid: false, -+ }, -+ -+ { -+ // missing MXName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for MXName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/MX/", -+ Valid: false, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/MX/mx1", -+ Valid: true, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/PRIVATEDNSZONES/PRIVATEDNSZONE1/MX/MX1", -+ Valid: false, -+ }, -+ } -+ for _, tc := range cases { -+ t.Logf("[DEBUG] Testing Value %s", tc.Input) -+ _, errors := MxRecordID(tc.Input, "test") -+ valid := len(errors) == 0 -+ -+ if tc.Valid != valid { -+ t.Fatalf("Expected %t but got %t", tc.Valid, valid) -+ } -+ } -+} -diff --git a/internal/services/privatedns/validate/private_dns_zone_id.go b/internal/services/privatedns/validate/private_dns_zone_id.go -new file mode 100644 -index 0000000000..fc812dc9d7 ---- /dev/null -+++ b/internal/services/privatedns/validate/private_dns_zone_id.go -@@ -0,0 +1,23 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ -+ "github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/parse" -+) -+ -+func PrivateDnsZoneID(input interface{}, key string) (warnings []string, errors []error) { -+ v, ok := input.(string) -+ if !ok { -+ errors = append(errors, fmt.Errorf("expected %q to be a string", key)) -+ return -+ } -+ -+ if _, err := parse.PrivateDnsZoneID(v); err != nil { -+ errors = append(errors, err) -+ } -+ -+ return -+} -diff --git a/internal/services/privatedns/validate/private_dns_zone_id_test.go b/internal/services/privatedns/validate/private_dns_zone_id_test.go -new file mode 100644 -index 0000000000..273feaa285 ---- /dev/null -+++ b/internal/services/privatedns/validate/private_dns_zone_id_test.go -@@ -0,0 +1,76 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import "testing" -+ -+func TestPrivateDnsZoneID(t *testing.T) { -+ cases := []struct { -+ Input string -+ Valid bool -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Valid: false, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Valid: false, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Valid: false, -+ }, -+ -+ { -+ // missing Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/", -+ Valid: false, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1", -+ Valid: true, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/PRIVATEDNSZONES/PRIVATEDNSZONE1", -+ Valid: false, -+ }, -+ } -+ for _, tc := range cases { -+ t.Logf("[DEBUG] Testing Value %s", tc.Input) -+ _, errors := PrivateDnsZoneID(tc.Input, "test") -+ valid := len(errors) == 0 -+ -+ if tc.Valid != valid { -+ t.Fatalf("Expected %t but got %t", tc.Valid, valid) -+ } -+ } -+} -diff --git a/internal/services/privatedns/validate/ptr_record_id.go b/internal/services/privatedns/validate/ptr_record_id.go -new file mode 100644 -index 0000000000..b135102f82 ---- /dev/null -+++ b/internal/services/privatedns/validate/ptr_record_id.go -@@ -0,0 +1,23 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ -+ "github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/parse" -+) -+ -+func PtrRecordID(input interface{}, key string) (warnings []string, errors []error) { -+ v, ok := input.(string) -+ if !ok { -+ errors = append(errors, fmt.Errorf("expected %q to be a string", key)) -+ return -+ } -+ -+ if _, err := parse.PtrRecordID(v); err != nil { -+ errors = append(errors, err) -+ } -+ -+ return -+} -diff --git a/internal/services/privatedns/validate/ptr_record_id_test.go b/internal/services/privatedns/validate/ptr_record_id_test.go -new file mode 100644 -index 0000000000..8170964a3b ---- /dev/null -+++ b/internal/services/privatedns/validate/ptr_record_id_test.go -@@ -0,0 +1,88 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import "testing" -+ -+func TestPtrRecordID(t *testing.T) { -+ cases := []struct { -+ Input string -+ Valid bool -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Valid: false, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Valid: false, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Valid: false, -+ }, -+ -+ { -+ // missing PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/", -+ Valid: false, -+ }, -+ -+ { -+ // missing PTRName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for PTRName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/PTR/", -+ Valid: false, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/PTR/ptr1", -+ Valid: true, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/PRIVATEDNSZONES/PRIVATEDNSZONE1/PTR/PTR1", -+ Valid: false, -+ }, -+ } -+ for _, tc := range cases { -+ t.Logf("[DEBUG] Testing Value %s", tc.Input) -+ _, errors := PtrRecordID(tc.Input, "test") -+ valid := len(errors) == 0 -+ -+ if tc.Valid != valid { -+ t.Fatalf("Expected %t but got %t", tc.Valid, valid) -+ } -+ } -+} -diff --git a/internal/services/privatedns/validate/srv_record_id.go b/internal/services/privatedns/validate/srv_record_id.go -new file mode 100644 -index 0000000000..0ee85e416d ---- /dev/null -+++ b/internal/services/privatedns/validate/srv_record_id.go -@@ -0,0 +1,23 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ -+ "github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/parse" -+) -+ -+func SrvRecordID(input interface{}, key string) (warnings []string, errors []error) { -+ v, ok := input.(string) -+ if !ok { -+ errors = append(errors, fmt.Errorf("expected %q to be a string", key)) -+ return -+ } -+ -+ if _, err := parse.SrvRecordID(v); err != nil { -+ errors = append(errors, err) -+ } -+ -+ return -+} -diff --git a/internal/services/privatedns/validate/srv_record_id_test.go b/internal/services/privatedns/validate/srv_record_id_test.go -new file mode 100644 -index 0000000000..cc109ab8cf ---- /dev/null -+++ b/internal/services/privatedns/validate/srv_record_id_test.go -@@ -0,0 +1,88 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import "testing" -+ -+func TestSrvRecordID(t *testing.T) { -+ cases := []struct { -+ Input string -+ Valid bool -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Valid: false, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Valid: false, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Valid: false, -+ }, -+ -+ { -+ // missing PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/", -+ Valid: false, -+ }, -+ -+ { -+ // missing SRVName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for SRVName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/SRV/", -+ Valid: false, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/SRV/srv1", -+ Valid: true, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/PRIVATEDNSZONES/PRIVATEDNSZONE1/SRV/SRV1", -+ Valid: false, -+ }, -+ } -+ for _, tc := range cases { -+ t.Logf("[DEBUG] Testing Value %s", tc.Input) -+ _, errors := SrvRecordID(tc.Input, "test") -+ valid := len(errors) == 0 -+ -+ if tc.Valid != valid { -+ t.Fatalf("Expected %t but got %t", tc.Valid, valid) -+ } -+ } -+} -diff --git a/internal/services/privatedns/validate/txt_record_id.go b/internal/services/privatedns/validate/txt_record_id.go -new file mode 100644 -index 0000000000..8e9b0c9dfc ---- /dev/null -+++ b/internal/services/privatedns/validate/txt_record_id.go -@@ -0,0 +1,23 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ -+ "github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/parse" -+) -+ -+func TxtRecordID(input interface{}, key string) (warnings []string, errors []error) { -+ v, ok := input.(string) -+ if !ok { -+ errors = append(errors, fmt.Errorf("expected %q to be a string", key)) -+ return -+ } -+ -+ if _, err := parse.TxtRecordID(v); err != nil { -+ errors = append(errors, err) -+ } -+ -+ return -+} -diff --git a/internal/services/privatedns/validate/txt_record_id_test.go b/internal/services/privatedns/validate/txt_record_id_test.go -new file mode 100644 -index 0000000000..390bbcc051 ---- /dev/null -+++ b/internal/services/privatedns/validate/txt_record_id_test.go -@@ -0,0 +1,88 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import "testing" -+ -+func TestTxtRecordID(t *testing.T) { -+ cases := []struct { -+ Input string -+ Valid bool -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Valid: false, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Valid: false, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Valid: false, -+ }, -+ -+ { -+ // missing PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/", -+ Valid: false, -+ }, -+ -+ { -+ // missing TXTName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for TXTName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/TXT/", -+ Valid: false, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/TXT/txt1", -+ Valid: true, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/PRIVATEDNSZONES/PRIVATEDNSZONE1/TXT/TXT1", -+ Valid: false, -+ }, -+ } -+ for _, tc := range cases { -+ t.Logf("[DEBUG] Testing Value %s", tc.Input) -+ _, errors := TxtRecordID(tc.Input, "test") -+ valid := len(errors) == 0 -+ -+ if tc.Valid != valid { -+ t.Fatalf("Expected %t but got %t", tc.Valid, valid) -+ } -+ } -+} -diff --git a/internal/services/privatedns/validate/virtual_network_link_id.go b/internal/services/privatedns/validate/virtual_network_link_id.go -new file mode 100644 -index 0000000000..f538ea86ef ---- /dev/null -+++ b/internal/services/privatedns/validate/virtual_network_link_id.go -@@ -0,0 +1,23 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ -+ "github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/parse" -+) -+ -+func VirtualNetworkLinkID(input interface{}, key string) (warnings []string, errors []error) { -+ v, ok := input.(string) -+ if !ok { -+ errors = append(errors, fmt.Errorf("expected %q to be a string", key)) -+ return -+ } -+ -+ if _, err := parse.VirtualNetworkLinkID(v); err != nil { -+ errors = append(errors, err) -+ } -+ -+ return -+} -diff --git a/internal/services/privatedns/validate/virtual_network_link_id_test.go b/internal/services/privatedns/validate/virtual_network_link_id_test.go -new file mode 100644 -index 0000000000..ad87350b81 ---- /dev/null -+++ b/internal/services/privatedns/validate/virtual_network_link_id_test.go -@@ -0,0 +1,88 @@ -+package validate -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import "testing" -+ -+func TestVirtualNetworkLinkID(t *testing.T) { -+ cases := []struct { -+ Input string -+ Valid bool -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Valid: false, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Valid: false, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Valid: false, -+ }, -+ -+ { -+ // missing PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/", -+ Valid: false, -+ }, -+ -+ { -+ // missing Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/", -+ Valid: false, -+ }, -+ -+ { -+ // missing value for Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/virtualNetworkLinks/", -+ Valid: false, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/virtualNetworkLinks/virtualNetworkLink1", -+ Valid: true, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/PRIVATEDNSZONES/PRIVATEDNSZONE1/VIRTUALNETWORKLINKS/VIRTUALNETWORKLINK1", -+ Valid: false, -+ }, -+ } -+ for _, tc := range cases { -+ t.Logf("[DEBUG] Testing Value %s", tc.Input) -+ _, errors := VirtualNetworkLinkID(tc.Input, "test") -+ valid := len(errors) == 0 -+ -+ if tc.Valid != valid { -+ t.Fatalf("Expected %t but got %t", tc.Valid, valid) -+ } -+ } -+} diff --git a/patches/0009-remove-defaults-backup-retention-policies.patch b/patches/0003-Remove-defaults-backup-retention-policies.patch similarity index 96% rename from patches/0009-remove-defaults-backup-retention-policies.patch rename to patches/0003-Remove-defaults-backup-retention-policies.patch index 2a2a1b0529..064b97d508 100644 --- a/patches/0009-remove-defaults-backup-retention-policies.patch +++ b/patches/0003-Remove-defaults-backup-retention-policies.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Ramon Quitales Date: Wed, 9 Aug 2023 13:05:13 -1000 -Subject: [PATCH] remove defaults backup retention policies +Subject: [PATCH] Remove defaults backup retention policies Fixes #1318 diff --git a/patches/0010-Update-provider-version-in-deprecation-notices.patch b/patches/0004-Update-provider-version-in-deprecation-notices.patch similarity index 97% rename from patches/0010-Update-provider-version-in-deprecation-notices.patch rename to patches/0004-Update-provider-version-in-deprecation-notices.patch index 2eb2fd975a..80f7b3cba3 100644 --- a/patches/0010-Update-provider-version-in-deprecation-notices.patch +++ b/patches/0004-Update-provider-version-in-deprecation-notices.patch @@ -3,9 +3,10 @@ From: Thomas Kappler Date: Thu, 2 May 2024 10:01:37 +0200 Subject: [PATCH] Update provider version in deprecation notices +We want to include the deprecation notices, but need them to match our version number which is not the same at the upstream version number. diff --git a/website/docs/r/app_service.html.markdown b/website/docs/r/app_service.html.markdown -index b2f7684482..feff83d72e 100644 +index 25e53059a0..e22526a383 100644 --- a/website/docs/r/app_service.html.markdown +++ b/website/docs/r/app_service.html.markdown @@ -11,7 +11,7 @@ description: |- @@ -57,7 +58,7 @@ index 42c3fd2783..a0c2593b2e 100644 ## Example Usage (Dedicated) diff --git a/website/docs/r/app_service_slot.html.markdown b/website/docs/r/app_service_slot.html.markdown -index 90f4a28915..54c68c9c9c 100644 +index 4d2a801464..cbda06e6a6 100644 --- a/website/docs/r/app_service_slot.html.markdown +++ b/website/docs/r/app_service_slot.html.markdown @@ -11,7 +11,7 @@ description: |- @@ -83,7 +84,7 @@ index 957314cfe5..9a5f9adac7 100644 ~> **NOTE:** Source Control Tokens are configured at the subscription level, not on each App Service - as such this can only be configured Subscription-wide diff --git a/website/docs/r/function_app.html.markdown b/website/docs/r/function_app.html.markdown -index ec393da25c..6ac7206ed5 100644 +index 4fad99cea6..138d8e5b99 100644 --- a/website/docs/r/function_app.html.markdown +++ b/website/docs/r/function_app.html.markdown @@ -11,7 +11,7 @@ description: |- @@ -96,7 +97,7 @@ index ec393da25c..6ac7206ed5 100644 ~> **Note:** To connect an Azure Function App and a subnet within the same region `azurerm_app_service_virtual_network_swift_connection` can be used. For an example, check the `azurerm_app_service_virtual_network_swift_connection` documentation. diff --git a/website/docs/r/function_app_slot.html.markdown b/website/docs/r/function_app_slot.html.markdown -index 575b9a8f57..090510bb2d 100644 +index 39b679a016..b88cc5d709 100644 --- a/website/docs/r/function_app_slot.html.markdown +++ b/website/docs/r/function_app_slot.html.markdown @@ -11,7 +11,7 @@ description: |- diff --git a/patches/0004-fixup-Shared-features.patch b/patches/0004-fixup-Shared-features.patch deleted file mode 100644 index 063bc46d28..0000000000 --- a/patches/0004-fixup-Shared-features.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: aq17 -Date: Thu, 25 May 2023 10:33:38 -0700 -Subject: [PATCH] fixup-Shared-features - - -diff --git a/internal/tf/suppress/deprecated_soon.go b/internal/tf/suppress/deprecated_soon.go -index 926f57f880..815f6e3006 100644 ---- a/internal/tf/suppress/deprecated_soon.go -+++ b/internal/tf/suppress/deprecated_soon.go -@@ -17,3 +17,9 @@ func CaseDifference(_, old, new string, _ *schema.ResourceData) bool { - // fields should be case-sensitive, normalize the Azure Resource ID in the Read if required - return strings.EqualFold(old, new) - } -+ -+// CaseDifferenceV2Only only suppress case difference for v2.0. -+func CaseDifferenceV2Only(_, old, new string, _ *schema.ResourceData) bool { -+ // FORK: Force attributes to maintain case-insensitivity to avoid breaking changes in Pulumi programs. -+ return strings.EqualFold(old, new) -+} diff --git a/patches/0011-set-frontdoor-backend-pool-settings-to-computed.patch b/patches/0005-Set-frontdoor-backend_pool_settings-to-computed.patch similarity index 91% rename from patches/0011-set-frontdoor-backend-pool-settings-to-computed.patch rename to patches/0005-Set-frontdoor-backend_pool_settings-to-computed.patch index 6b73c3a525..e9677f262d 100644 --- a/patches/0011-set-frontdoor-backend-pool-settings-to-computed.patch +++ b/patches/0005-Set-frontdoor-backend_pool_settings-to-computed.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Venelin Date: Wed, 8 May 2024 18:25:30 +0100 -Subject: [PATCH] set frontdoor backend pool settings to computed +Subject: [PATCH] Set frontdoor backend_pool_settings to computed diff --git a/internal/services/frontdoor/frontdoor_resource.go b/internal/services/frontdoor/frontdoor_resource.go diff --git a/patches/0006-Add-privatedns-parse.patch b/patches/0006-Add-privatedns-parse.patch deleted file mode 100644 index c161b88a6c..0000000000 --- a/patches/0006-Add-privatedns-parse.patch +++ /dev/null @@ -1,1919 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: aq17 -Date: Thu, 25 May 2023 10:33:39 -0700 -Subject: [PATCH] Add-privatedns-parse - - -diff --git a/internal/services/privatedns/parse/a_record.go b/internal/services/privatedns/parse/a_record.go -new file mode 100644 -index 0000000000..1ff34aa6cc ---- /dev/null -+++ b/internal/services/privatedns/parse/a_record.go -@@ -0,0 +1,75 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ "strings" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+type ARecordId struct { -+ SubscriptionId string -+ ResourceGroup string -+ PrivateDnsZoneName string -+ AName string -+} -+ -+func NewARecordID(subscriptionId, resourceGroup, privateDnsZoneName, aName string) ARecordId { -+ return ARecordId{ -+ SubscriptionId: subscriptionId, -+ ResourceGroup: resourceGroup, -+ PrivateDnsZoneName: privateDnsZoneName, -+ AName: aName, -+ } -+} -+ -+func (id ARecordId) String() string { -+ segments := []string{ -+ fmt.Sprintf("A Name %q", id.AName), -+ fmt.Sprintf("Private Dns Zone Name %q", id.PrivateDnsZoneName), -+ fmt.Sprintf("Resource Group %q", id.ResourceGroup), -+ } -+ segmentsStr := strings.Join(segments, " / ") -+ return fmt.Sprintf("%s: (%s)", "A Record", segmentsStr) -+} -+ -+func (id ARecordId) ID() string { -+ fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/privateDnsZones/%s/A/%s" -+ return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.PrivateDnsZoneName, id.AName) -+} -+ -+// ARecordID parses a ARecord ID into an ARecordId struct -+func ARecordID(input string) (*ARecordId, error) { -+ id, err := resourceids.ParseAzureResourceID(input) -+ if err != nil { -+ return nil, err -+ } -+ -+ resourceId := ARecordId{ -+ SubscriptionId: id.SubscriptionID, -+ ResourceGroup: id.ResourceGroup, -+ } -+ -+ if resourceId.SubscriptionId == "" { -+ return nil, fmt.Errorf("ID was missing the 'subscriptions' element") -+ } -+ -+ if resourceId.ResourceGroup == "" { -+ return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") -+ } -+ -+ if resourceId.PrivateDnsZoneName, err = id.PopSegment("privateDnsZones"); err != nil { -+ return nil, err -+ } -+ if resourceId.AName, err = id.PopSegment("A"); err != nil { -+ return nil, err -+ } -+ -+ if err := id.ValidateNoEmptySegments(input); err != nil { -+ return nil, err -+ } -+ -+ return &resourceId, nil -+} -diff --git a/internal/services/privatedns/parse/a_record_test.go b/internal/services/privatedns/parse/a_record_test.go -new file mode 100644 -index 0000000000..4077882d24 ---- /dev/null -+++ b/internal/services/privatedns/parse/a_record_test.go -@@ -0,0 +1,128 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "testing" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+var _ resourceids.Id = ARecordId{} -+ -+func TestARecordIDFormatter(t *testing.T) { -+ actual := NewARecordID("12345678-1234-9876-4563-123456789012", "resGroup1", "privateDnsZone1", "eh1").ID() -+ expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/A/eh1" -+ if actual != expected { -+ t.Fatalf("Expected %q but got %q", expected, actual) -+ } -+} -+ -+func TestARecordID(t *testing.T) { -+ testData := []struct { -+ Input string -+ Error bool -+ Expected *ARecordId -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Error: true, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Error: true, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Error: true, -+ }, -+ -+ { -+ // missing PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/", -+ Error: true, -+ }, -+ -+ { -+ // missing AName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for AName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/A/", -+ Error: true, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/A/eh1", -+ Expected: &ARecordId{ -+ SubscriptionId: "12345678-1234-9876-4563-123456789012", -+ ResourceGroup: "resGroup1", -+ PrivateDnsZoneName: "privateDnsZone1", -+ AName: "eh1", -+ }, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/PRIVATEDNSZONES/PRIVATEDNSZONE1/A/EH1", -+ Error: true, -+ }, -+ } -+ -+ for _, v := range testData { -+ t.Logf("[DEBUG] Testing %q", v.Input) -+ -+ actual, err := ARecordID(v.Input) -+ if err != nil { -+ if v.Error { -+ continue -+ } -+ -+ t.Fatalf("Expect a value but got an error: %s", err) -+ } -+ if v.Error { -+ t.Fatal("Expect an error but didn't get one") -+ } -+ -+ if actual.SubscriptionId != v.Expected.SubscriptionId { -+ t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) -+ } -+ if actual.ResourceGroup != v.Expected.ResourceGroup { -+ t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) -+ } -+ if actual.PrivateDnsZoneName != v.Expected.PrivateDnsZoneName { -+ t.Fatalf("Expected %q but got %q for PrivateDnsZoneName", v.Expected.PrivateDnsZoneName, actual.PrivateDnsZoneName) -+ } -+ if actual.AName != v.Expected.AName { -+ t.Fatalf("Expected %q but got %q for AName", v.Expected.AName, actual.AName) -+ } -+ } -+} -diff --git a/internal/services/privatedns/parse/aaaa_record.go b/internal/services/privatedns/parse/aaaa_record.go -new file mode 100644 -index 0000000000..c44c0d268b ---- /dev/null -+++ b/internal/services/privatedns/parse/aaaa_record.go -@@ -0,0 +1,75 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ "strings" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+type AaaaRecordId struct { -+ SubscriptionId string -+ ResourceGroup string -+ PrivateDnsZoneName string -+ AAAAName string -+} -+ -+func NewAaaaRecordID(subscriptionId, resourceGroup, privateDnsZoneName, aAAAName string) AaaaRecordId { -+ return AaaaRecordId{ -+ SubscriptionId: subscriptionId, -+ ResourceGroup: resourceGroup, -+ PrivateDnsZoneName: privateDnsZoneName, -+ AAAAName: aAAAName, -+ } -+} -+ -+func (id AaaaRecordId) String() string { -+ segments := []string{ -+ fmt.Sprintf("A A A A Name %q", id.AAAAName), -+ fmt.Sprintf("Private Dns Zone Name %q", id.PrivateDnsZoneName), -+ fmt.Sprintf("Resource Group %q", id.ResourceGroup), -+ } -+ segmentsStr := strings.Join(segments, " / ") -+ return fmt.Sprintf("%s: (%s)", "Aaaa Record", segmentsStr) -+} -+ -+func (id AaaaRecordId) ID() string { -+ fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/privateDnsZones/%s/AAAA/%s" -+ return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.PrivateDnsZoneName, id.AAAAName) -+} -+ -+// AaaaRecordID parses a AaaaRecord ID into an AaaaRecordId struct -+func AaaaRecordID(input string) (*AaaaRecordId, error) { -+ id, err := resourceids.ParseAzureResourceID(input) -+ if err != nil { -+ return nil, err -+ } -+ -+ resourceId := AaaaRecordId{ -+ SubscriptionId: id.SubscriptionID, -+ ResourceGroup: id.ResourceGroup, -+ } -+ -+ if resourceId.SubscriptionId == "" { -+ return nil, fmt.Errorf("ID was missing the 'subscriptions' element") -+ } -+ -+ if resourceId.ResourceGroup == "" { -+ return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") -+ } -+ -+ if resourceId.PrivateDnsZoneName, err = id.PopSegment("privateDnsZones"); err != nil { -+ return nil, err -+ } -+ if resourceId.AAAAName, err = id.PopSegment("AAAA"); err != nil { -+ return nil, err -+ } -+ -+ if err := id.ValidateNoEmptySegments(input); err != nil { -+ return nil, err -+ } -+ -+ return &resourceId, nil -+} -diff --git a/internal/services/privatedns/parse/aaaa_record_test.go b/internal/services/privatedns/parse/aaaa_record_test.go -new file mode 100644 -index 0000000000..3d61bf94fe ---- /dev/null -+++ b/internal/services/privatedns/parse/aaaa_record_test.go -@@ -0,0 +1,128 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "testing" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+var _ resourceids.Id = AaaaRecordId{} -+ -+func TestAaaaRecordIDFormatter(t *testing.T) { -+ actual := NewAaaaRecordID("12345678-1234-9876-4563-123456789012", "resGroup1", "privateDnsZone1", "eheh1").ID() -+ expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/AAAA/eheh1" -+ if actual != expected { -+ t.Fatalf("Expected %q but got %q", expected, actual) -+ } -+} -+ -+func TestAaaaRecordID(t *testing.T) { -+ testData := []struct { -+ Input string -+ Error bool -+ Expected *AaaaRecordId -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Error: true, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Error: true, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Error: true, -+ }, -+ -+ { -+ // missing PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/", -+ Error: true, -+ }, -+ -+ { -+ // missing AAAAName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for AAAAName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/AAAA/", -+ Error: true, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/AAAA/eheh1", -+ Expected: &AaaaRecordId{ -+ SubscriptionId: "12345678-1234-9876-4563-123456789012", -+ ResourceGroup: "resGroup1", -+ PrivateDnsZoneName: "privateDnsZone1", -+ AAAAName: "eheh1", -+ }, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/PRIVATEDNSZONES/PRIVATEDNSZONE1/AAAA/EHEH1", -+ Error: true, -+ }, -+ } -+ -+ for _, v := range testData { -+ t.Logf("[DEBUG] Testing %q", v.Input) -+ -+ actual, err := AaaaRecordID(v.Input) -+ if err != nil { -+ if v.Error { -+ continue -+ } -+ -+ t.Fatalf("Expect a value but got an error: %s", err) -+ } -+ if v.Error { -+ t.Fatal("Expect an error but didn't get one") -+ } -+ -+ if actual.SubscriptionId != v.Expected.SubscriptionId { -+ t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) -+ } -+ if actual.ResourceGroup != v.Expected.ResourceGroup { -+ t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) -+ } -+ if actual.PrivateDnsZoneName != v.Expected.PrivateDnsZoneName { -+ t.Fatalf("Expected %q but got %q for PrivateDnsZoneName", v.Expected.PrivateDnsZoneName, actual.PrivateDnsZoneName) -+ } -+ if actual.AAAAName != v.Expected.AAAAName { -+ t.Fatalf("Expected %q but got %q for AAAAName", v.Expected.AAAAName, actual.AAAAName) -+ } -+ } -+} -diff --git a/internal/services/privatedns/parse/cname_record.go b/internal/services/privatedns/parse/cname_record.go -new file mode 100644 -index 0000000000..52de00de2a ---- /dev/null -+++ b/internal/services/privatedns/parse/cname_record.go -@@ -0,0 +1,75 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ "strings" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+type CnameRecordId struct { -+ SubscriptionId string -+ ResourceGroup string -+ PrivateDnsZoneName string -+ CNAMEName string -+} -+ -+func NewCnameRecordID(subscriptionId, resourceGroup, privateDnsZoneName, cNAMEName string) CnameRecordId { -+ return CnameRecordId{ -+ SubscriptionId: subscriptionId, -+ ResourceGroup: resourceGroup, -+ PrivateDnsZoneName: privateDnsZoneName, -+ CNAMEName: cNAMEName, -+ } -+} -+ -+func (id CnameRecordId) String() string { -+ segments := []string{ -+ fmt.Sprintf("C N A M E Name %q", id.CNAMEName), -+ fmt.Sprintf("Private Dns Zone Name %q", id.PrivateDnsZoneName), -+ fmt.Sprintf("Resource Group %q", id.ResourceGroup), -+ } -+ segmentsStr := strings.Join(segments, " / ") -+ return fmt.Sprintf("%s: (%s)", "Cname Record", segmentsStr) -+} -+ -+func (id CnameRecordId) ID() string { -+ fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/privateDnsZones/%s/CNAME/%s" -+ return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.PrivateDnsZoneName, id.CNAMEName) -+} -+ -+// CnameRecordID parses a CnameRecord ID into an CnameRecordId struct -+func CnameRecordID(input string) (*CnameRecordId, error) { -+ id, err := resourceids.ParseAzureResourceID(input) -+ if err != nil { -+ return nil, err -+ } -+ -+ resourceId := CnameRecordId{ -+ SubscriptionId: id.SubscriptionID, -+ ResourceGroup: id.ResourceGroup, -+ } -+ -+ if resourceId.SubscriptionId == "" { -+ return nil, fmt.Errorf("ID was missing the 'subscriptions' element") -+ } -+ -+ if resourceId.ResourceGroup == "" { -+ return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") -+ } -+ -+ if resourceId.PrivateDnsZoneName, err = id.PopSegment("privateDnsZones"); err != nil { -+ return nil, err -+ } -+ if resourceId.CNAMEName, err = id.PopSegment("CNAME"); err != nil { -+ return nil, err -+ } -+ -+ if err := id.ValidateNoEmptySegments(input); err != nil { -+ return nil, err -+ } -+ -+ return &resourceId, nil -+} -diff --git a/internal/services/privatedns/parse/cname_record_test.go b/internal/services/privatedns/parse/cname_record_test.go -new file mode 100644 -index 0000000000..5d18f58e25 ---- /dev/null -+++ b/internal/services/privatedns/parse/cname_record_test.go -@@ -0,0 +1,128 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "testing" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+var _ resourceids.Id = CnameRecordId{} -+ -+func TestCnameRecordIDFormatter(t *testing.T) { -+ actual := NewCnameRecordID("12345678-1234-9876-4563-123456789012", "resGroup1", "privateDnsZone1", "name1").ID() -+ expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/CNAME/name1" -+ if actual != expected { -+ t.Fatalf("Expected %q but got %q", expected, actual) -+ } -+} -+ -+func TestCnameRecordID(t *testing.T) { -+ testData := []struct { -+ Input string -+ Error bool -+ Expected *CnameRecordId -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Error: true, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Error: true, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Error: true, -+ }, -+ -+ { -+ // missing PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/", -+ Error: true, -+ }, -+ -+ { -+ // missing CNAMEName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for CNAMEName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/CNAME/", -+ Error: true, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/CNAME/name1", -+ Expected: &CnameRecordId{ -+ SubscriptionId: "12345678-1234-9876-4563-123456789012", -+ ResourceGroup: "resGroup1", -+ PrivateDnsZoneName: "privateDnsZone1", -+ CNAMEName: "name1", -+ }, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/PRIVATEDNSZONES/PRIVATEDNSZONE1/CNAME/NAME1", -+ Error: true, -+ }, -+ } -+ -+ for _, v := range testData { -+ t.Logf("[DEBUG] Testing %q", v.Input) -+ -+ actual, err := CnameRecordID(v.Input) -+ if err != nil { -+ if v.Error { -+ continue -+ } -+ -+ t.Fatalf("Expect a value but got an error: %s", err) -+ } -+ if v.Error { -+ t.Fatal("Expect an error but didn't get one") -+ } -+ -+ if actual.SubscriptionId != v.Expected.SubscriptionId { -+ t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) -+ } -+ if actual.ResourceGroup != v.Expected.ResourceGroup { -+ t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) -+ } -+ if actual.PrivateDnsZoneName != v.Expected.PrivateDnsZoneName { -+ t.Fatalf("Expected %q but got %q for PrivateDnsZoneName", v.Expected.PrivateDnsZoneName, actual.PrivateDnsZoneName) -+ } -+ if actual.CNAMEName != v.Expected.CNAMEName { -+ t.Fatalf("Expected %q but got %q for CNAMEName", v.Expected.CNAMEName, actual.CNAMEName) -+ } -+ } -+} -diff --git a/internal/services/privatedns/parse/mx_record.go b/internal/services/privatedns/parse/mx_record.go -new file mode 100644 -index 0000000000..b753efdf2b ---- /dev/null -+++ b/internal/services/privatedns/parse/mx_record.go -@@ -0,0 +1,75 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ "strings" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+type MxRecordId struct { -+ SubscriptionId string -+ ResourceGroup string -+ PrivateDnsZoneName string -+ MXName string -+} -+ -+func NewMxRecordID(subscriptionId, resourceGroup, privateDnsZoneName, mXName string) MxRecordId { -+ return MxRecordId{ -+ SubscriptionId: subscriptionId, -+ ResourceGroup: resourceGroup, -+ PrivateDnsZoneName: privateDnsZoneName, -+ MXName: mXName, -+ } -+} -+ -+func (id MxRecordId) String() string { -+ segments := []string{ -+ fmt.Sprintf("M X Name %q", id.MXName), -+ fmt.Sprintf("Private Dns Zone Name %q", id.PrivateDnsZoneName), -+ fmt.Sprintf("Resource Group %q", id.ResourceGroup), -+ } -+ segmentsStr := strings.Join(segments, " / ") -+ return fmt.Sprintf("%s: (%s)", "Mx Record", segmentsStr) -+} -+ -+func (id MxRecordId) ID() string { -+ fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/privateDnsZones/%s/MX/%s" -+ return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.PrivateDnsZoneName, id.MXName) -+} -+ -+// MxRecordID parses a MxRecord ID into an MxRecordId struct -+func MxRecordID(input string) (*MxRecordId, error) { -+ id, err := resourceids.ParseAzureResourceID(input) -+ if err != nil { -+ return nil, err -+ } -+ -+ resourceId := MxRecordId{ -+ SubscriptionId: id.SubscriptionID, -+ ResourceGroup: id.ResourceGroup, -+ } -+ -+ if resourceId.SubscriptionId == "" { -+ return nil, fmt.Errorf("ID was missing the 'subscriptions' element") -+ } -+ -+ if resourceId.ResourceGroup == "" { -+ return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") -+ } -+ -+ if resourceId.PrivateDnsZoneName, err = id.PopSegment("privateDnsZones"); err != nil { -+ return nil, err -+ } -+ if resourceId.MXName, err = id.PopSegment("MX"); err != nil { -+ return nil, err -+ } -+ -+ if err := id.ValidateNoEmptySegments(input); err != nil { -+ return nil, err -+ } -+ -+ return &resourceId, nil -+} -diff --git a/internal/services/privatedns/parse/mx_record_test.go b/internal/services/privatedns/parse/mx_record_test.go -new file mode 100644 -index 0000000000..3bd9befb82 ---- /dev/null -+++ b/internal/services/privatedns/parse/mx_record_test.go -@@ -0,0 +1,128 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "testing" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+var _ resourceids.Id = MxRecordId{} -+ -+func TestMxRecordIDFormatter(t *testing.T) { -+ actual := NewMxRecordID("12345678-1234-9876-4563-123456789012", "resGroup1", "privateDnsZone1", "mx1").ID() -+ expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/MX/mx1" -+ if actual != expected { -+ t.Fatalf("Expected %q but got %q", expected, actual) -+ } -+} -+ -+func TestMxRecordID(t *testing.T) { -+ testData := []struct { -+ Input string -+ Error bool -+ Expected *MxRecordId -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Error: true, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Error: true, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Error: true, -+ }, -+ -+ { -+ // missing PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/", -+ Error: true, -+ }, -+ -+ { -+ // missing MXName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for MXName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/MX/", -+ Error: true, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/MX/mx1", -+ Expected: &MxRecordId{ -+ SubscriptionId: "12345678-1234-9876-4563-123456789012", -+ ResourceGroup: "resGroup1", -+ PrivateDnsZoneName: "privateDnsZone1", -+ MXName: "mx1", -+ }, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/PRIVATEDNSZONES/PRIVATEDNSZONE1/MX/MX1", -+ Error: true, -+ }, -+ } -+ -+ for _, v := range testData { -+ t.Logf("[DEBUG] Testing %q", v.Input) -+ -+ actual, err := MxRecordID(v.Input) -+ if err != nil { -+ if v.Error { -+ continue -+ } -+ -+ t.Fatalf("Expect a value but got an error: %s", err) -+ } -+ if v.Error { -+ t.Fatal("Expect an error but didn't get one") -+ } -+ -+ if actual.SubscriptionId != v.Expected.SubscriptionId { -+ t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) -+ } -+ if actual.ResourceGroup != v.Expected.ResourceGroup { -+ t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) -+ } -+ if actual.PrivateDnsZoneName != v.Expected.PrivateDnsZoneName { -+ t.Fatalf("Expected %q but got %q for PrivateDnsZoneName", v.Expected.PrivateDnsZoneName, actual.PrivateDnsZoneName) -+ } -+ if actual.MXName != v.Expected.MXName { -+ t.Fatalf("Expected %q but got %q for MXName", v.Expected.MXName, actual.MXName) -+ } -+ } -+} -diff --git a/internal/services/privatedns/parse/private_dns_zone.go b/internal/services/privatedns/parse/private_dns_zone.go -new file mode 100644 -index 0000000000..7ed4f6f732 ---- /dev/null -+++ b/internal/services/privatedns/parse/private_dns_zone.go -@@ -0,0 +1,69 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ "strings" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+type PrivateDnsZoneId struct { -+ SubscriptionId string -+ ResourceGroup string -+ Name string -+} -+ -+func NewPrivateDnsZoneID(subscriptionId, resourceGroup, name string) PrivateDnsZoneId { -+ return PrivateDnsZoneId{ -+ SubscriptionId: subscriptionId, -+ ResourceGroup: resourceGroup, -+ Name: name, -+ } -+} -+ -+func (id PrivateDnsZoneId) String() string { -+ segments := []string{ -+ fmt.Sprintf("Name %q", id.Name), -+ fmt.Sprintf("Resource Group %q", id.ResourceGroup), -+ } -+ segmentsStr := strings.Join(segments, " / ") -+ return fmt.Sprintf("%s: (%s)", "Private Dns Zone", segmentsStr) -+} -+ -+func (id PrivateDnsZoneId) ID() string { -+ fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/privateDnsZones/%s" -+ return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -+} -+ -+// PrivateDnsZoneID parses a PrivateDnsZone ID into an PrivateDnsZoneId struct -+func PrivateDnsZoneID(input string) (*PrivateDnsZoneId, error) { -+ id, err := resourceids.ParseAzureResourceID(input) -+ if err != nil { -+ return nil, err -+ } -+ -+ resourceId := PrivateDnsZoneId{ -+ SubscriptionId: id.SubscriptionID, -+ ResourceGroup: id.ResourceGroup, -+ } -+ -+ if resourceId.SubscriptionId == "" { -+ return nil, fmt.Errorf("ID was missing the 'subscriptions' element") -+ } -+ -+ if resourceId.ResourceGroup == "" { -+ return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") -+ } -+ -+ if resourceId.Name, err = id.PopSegment("privateDnsZones"); err != nil { -+ return nil, err -+ } -+ -+ if err := id.ValidateNoEmptySegments(input); err != nil { -+ return nil, err -+ } -+ -+ return &resourceId, nil -+} -diff --git a/internal/services/privatedns/parse/private_dns_zone_test.go b/internal/services/privatedns/parse/private_dns_zone_test.go -new file mode 100644 -index 0000000000..6edb3569ca ---- /dev/null -+++ b/internal/services/privatedns/parse/private_dns_zone_test.go -@@ -0,0 +1,112 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "testing" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+var _ resourceids.Id = PrivateDnsZoneId{} -+ -+func TestPrivateDnsZoneIDFormatter(t *testing.T) { -+ actual := NewPrivateDnsZoneID("12345678-1234-9876-4563-123456789012", "resGroup1", "privateDnsZone1").ID() -+ expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1" -+ if actual != expected { -+ t.Fatalf("Expected %q but got %q", expected, actual) -+ } -+} -+ -+func TestPrivateDnsZoneID(t *testing.T) { -+ testData := []struct { -+ Input string -+ Error bool -+ Expected *PrivateDnsZoneId -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Error: true, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Error: true, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Error: true, -+ }, -+ -+ { -+ // missing Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/", -+ Error: true, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1", -+ Expected: &PrivateDnsZoneId{ -+ SubscriptionId: "12345678-1234-9876-4563-123456789012", -+ ResourceGroup: "resGroup1", -+ Name: "privateDnsZone1", -+ }, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/PRIVATEDNSZONES/PRIVATEDNSZONE1", -+ Error: true, -+ }, -+ } -+ -+ for _, v := range testData { -+ t.Logf("[DEBUG] Testing %q", v.Input) -+ -+ actual, err := PrivateDnsZoneID(v.Input) -+ if err != nil { -+ if v.Error { -+ continue -+ } -+ -+ t.Fatalf("Expect a value but got an error: %s", err) -+ } -+ if v.Error { -+ t.Fatal("Expect an error but didn't get one") -+ } -+ -+ if actual.SubscriptionId != v.Expected.SubscriptionId { -+ t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) -+ } -+ if actual.ResourceGroup != v.Expected.ResourceGroup { -+ t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) -+ } -+ if actual.Name != v.Expected.Name { -+ t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) -+ } -+ } -+} -diff --git a/internal/services/privatedns/parse/ptr_record.go b/internal/services/privatedns/parse/ptr_record.go -new file mode 100644 -index 0000000000..c665609f92 ---- /dev/null -+++ b/internal/services/privatedns/parse/ptr_record.go -@@ -0,0 +1,75 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ "strings" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+type PtrRecordId struct { -+ SubscriptionId string -+ ResourceGroup string -+ PrivateDnsZoneName string -+ PTRName string -+} -+ -+func NewPtrRecordID(subscriptionId, resourceGroup, privateDnsZoneName, pTRName string) PtrRecordId { -+ return PtrRecordId{ -+ SubscriptionId: subscriptionId, -+ ResourceGroup: resourceGroup, -+ PrivateDnsZoneName: privateDnsZoneName, -+ PTRName: pTRName, -+ } -+} -+ -+func (id PtrRecordId) String() string { -+ segments := []string{ -+ fmt.Sprintf("P T R Name %q", id.PTRName), -+ fmt.Sprintf("Private Dns Zone Name %q", id.PrivateDnsZoneName), -+ fmt.Sprintf("Resource Group %q", id.ResourceGroup), -+ } -+ segmentsStr := strings.Join(segments, " / ") -+ return fmt.Sprintf("%s: (%s)", "Ptr Record", segmentsStr) -+} -+ -+func (id PtrRecordId) ID() string { -+ fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/privateDnsZones/%s/PTR/%s" -+ return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.PrivateDnsZoneName, id.PTRName) -+} -+ -+// PtrRecordID parses a PtrRecord ID into an PtrRecordId struct -+func PtrRecordID(input string) (*PtrRecordId, error) { -+ id, err := resourceids.ParseAzureResourceID(input) -+ if err != nil { -+ return nil, err -+ } -+ -+ resourceId := PtrRecordId{ -+ SubscriptionId: id.SubscriptionID, -+ ResourceGroup: id.ResourceGroup, -+ } -+ -+ if resourceId.SubscriptionId == "" { -+ return nil, fmt.Errorf("ID was missing the 'subscriptions' element") -+ } -+ -+ if resourceId.ResourceGroup == "" { -+ return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") -+ } -+ -+ if resourceId.PrivateDnsZoneName, err = id.PopSegment("privateDnsZones"); err != nil { -+ return nil, err -+ } -+ if resourceId.PTRName, err = id.PopSegment("PTR"); err != nil { -+ return nil, err -+ } -+ -+ if err := id.ValidateNoEmptySegments(input); err != nil { -+ return nil, err -+ } -+ -+ return &resourceId, nil -+} -diff --git a/internal/services/privatedns/parse/ptr_record_test.go b/internal/services/privatedns/parse/ptr_record_test.go -new file mode 100644 -index 0000000000..b16c62f84a ---- /dev/null -+++ b/internal/services/privatedns/parse/ptr_record_test.go -@@ -0,0 +1,128 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "testing" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+var _ resourceids.Id = PtrRecordId{} -+ -+func TestPtrRecordIDFormatter(t *testing.T) { -+ actual := NewPtrRecordID("12345678-1234-9876-4563-123456789012", "resGroup1", "privateDnsZone1", "ptr1").ID() -+ expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/PTR/ptr1" -+ if actual != expected { -+ t.Fatalf("Expected %q but got %q", expected, actual) -+ } -+} -+ -+func TestPtrRecordID(t *testing.T) { -+ testData := []struct { -+ Input string -+ Error bool -+ Expected *PtrRecordId -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Error: true, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Error: true, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Error: true, -+ }, -+ -+ { -+ // missing PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/", -+ Error: true, -+ }, -+ -+ { -+ // missing PTRName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for PTRName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/PTR/", -+ Error: true, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/PTR/ptr1", -+ Expected: &PtrRecordId{ -+ SubscriptionId: "12345678-1234-9876-4563-123456789012", -+ ResourceGroup: "resGroup1", -+ PrivateDnsZoneName: "privateDnsZone1", -+ PTRName: "ptr1", -+ }, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/PRIVATEDNSZONES/PRIVATEDNSZONE1/PTR/PTR1", -+ Error: true, -+ }, -+ } -+ -+ for _, v := range testData { -+ t.Logf("[DEBUG] Testing %q", v.Input) -+ -+ actual, err := PtrRecordID(v.Input) -+ if err != nil { -+ if v.Error { -+ continue -+ } -+ -+ t.Fatalf("Expect a value but got an error: %s", err) -+ } -+ if v.Error { -+ t.Fatal("Expect an error but didn't get one") -+ } -+ -+ if actual.SubscriptionId != v.Expected.SubscriptionId { -+ t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) -+ } -+ if actual.ResourceGroup != v.Expected.ResourceGroup { -+ t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) -+ } -+ if actual.PrivateDnsZoneName != v.Expected.PrivateDnsZoneName { -+ t.Fatalf("Expected %q but got %q for PrivateDnsZoneName", v.Expected.PrivateDnsZoneName, actual.PrivateDnsZoneName) -+ } -+ if actual.PTRName != v.Expected.PTRName { -+ t.Fatalf("Expected %q but got %q for PTRName", v.Expected.PTRName, actual.PTRName) -+ } -+ } -+} -diff --git a/internal/services/privatedns/parse/srv_record.go b/internal/services/privatedns/parse/srv_record.go -new file mode 100644 -index 0000000000..9dffad560e ---- /dev/null -+++ b/internal/services/privatedns/parse/srv_record.go -@@ -0,0 +1,75 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ "strings" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+type SrvRecordId struct { -+ SubscriptionId string -+ ResourceGroup string -+ PrivateDnsZoneName string -+ SRVName string -+} -+ -+func NewSrvRecordID(subscriptionId, resourceGroup, privateDnsZoneName, sRVName string) SrvRecordId { -+ return SrvRecordId{ -+ SubscriptionId: subscriptionId, -+ ResourceGroup: resourceGroup, -+ PrivateDnsZoneName: privateDnsZoneName, -+ SRVName: sRVName, -+ } -+} -+ -+func (id SrvRecordId) String() string { -+ segments := []string{ -+ fmt.Sprintf("S R V Name %q", id.SRVName), -+ fmt.Sprintf("Private Dns Zone Name %q", id.PrivateDnsZoneName), -+ fmt.Sprintf("Resource Group %q", id.ResourceGroup), -+ } -+ segmentsStr := strings.Join(segments, " / ") -+ return fmt.Sprintf("%s: (%s)", "Srv Record", segmentsStr) -+} -+ -+func (id SrvRecordId) ID() string { -+ fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/privateDnsZones/%s/SRV/%s" -+ return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.PrivateDnsZoneName, id.SRVName) -+} -+ -+// SrvRecordID parses a SrvRecord ID into an SrvRecordId struct -+func SrvRecordID(input string) (*SrvRecordId, error) { -+ id, err := resourceids.ParseAzureResourceID(input) -+ if err != nil { -+ return nil, err -+ } -+ -+ resourceId := SrvRecordId{ -+ SubscriptionId: id.SubscriptionID, -+ ResourceGroup: id.ResourceGroup, -+ } -+ -+ if resourceId.SubscriptionId == "" { -+ return nil, fmt.Errorf("ID was missing the 'subscriptions' element") -+ } -+ -+ if resourceId.ResourceGroup == "" { -+ return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") -+ } -+ -+ if resourceId.PrivateDnsZoneName, err = id.PopSegment("privateDnsZones"); err != nil { -+ return nil, err -+ } -+ if resourceId.SRVName, err = id.PopSegment("SRV"); err != nil { -+ return nil, err -+ } -+ -+ if err := id.ValidateNoEmptySegments(input); err != nil { -+ return nil, err -+ } -+ -+ return &resourceId, nil -+} -diff --git a/internal/services/privatedns/parse/srv_record_test.go b/internal/services/privatedns/parse/srv_record_test.go -new file mode 100644 -index 0000000000..2fceda33a8 ---- /dev/null -+++ b/internal/services/privatedns/parse/srv_record_test.go -@@ -0,0 +1,128 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "testing" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+var _ resourceids.Id = SrvRecordId{} -+ -+func TestSrvRecordIDFormatter(t *testing.T) { -+ actual := NewSrvRecordID("12345678-1234-9876-4563-123456789012", "resGroup1", "privateDnsZone1", "srv1").ID() -+ expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/SRV/srv1" -+ if actual != expected { -+ t.Fatalf("Expected %q but got %q", expected, actual) -+ } -+} -+ -+func TestSrvRecordID(t *testing.T) { -+ testData := []struct { -+ Input string -+ Error bool -+ Expected *SrvRecordId -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Error: true, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Error: true, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Error: true, -+ }, -+ -+ { -+ // missing PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/", -+ Error: true, -+ }, -+ -+ { -+ // missing SRVName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for SRVName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/SRV/", -+ Error: true, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/SRV/srv1", -+ Expected: &SrvRecordId{ -+ SubscriptionId: "12345678-1234-9876-4563-123456789012", -+ ResourceGroup: "resGroup1", -+ PrivateDnsZoneName: "privateDnsZone1", -+ SRVName: "srv1", -+ }, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/PRIVATEDNSZONES/PRIVATEDNSZONE1/SRV/SRV1", -+ Error: true, -+ }, -+ } -+ -+ for _, v := range testData { -+ t.Logf("[DEBUG] Testing %q", v.Input) -+ -+ actual, err := SrvRecordID(v.Input) -+ if err != nil { -+ if v.Error { -+ continue -+ } -+ -+ t.Fatalf("Expect a value but got an error: %s", err) -+ } -+ if v.Error { -+ t.Fatal("Expect an error but didn't get one") -+ } -+ -+ if actual.SubscriptionId != v.Expected.SubscriptionId { -+ t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) -+ } -+ if actual.ResourceGroup != v.Expected.ResourceGroup { -+ t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) -+ } -+ if actual.PrivateDnsZoneName != v.Expected.PrivateDnsZoneName { -+ t.Fatalf("Expected %q but got %q for PrivateDnsZoneName", v.Expected.PrivateDnsZoneName, actual.PrivateDnsZoneName) -+ } -+ if actual.SRVName != v.Expected.SRVName { -+ t.Fatalf("Expected %q but got %q for SRVName", v.Expected.SRVName, actual.SRVName) -+ } -+ } -+} -diff --git a/internal/services/privatedns/parse/txt_record.go b/internal/services/privatedns/parse/txt_record.go -new file mode 100644 -index 0000000000..3eb8a1ba99 ---- /dev/null -+++ b/internal/services/privatedns/parse/txt_record.go -@@ -0,0 +1,75 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ "strings" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+type TxtRecordId struct { -+ SubscriptionId string -+ ResourceGroup string -+ PrivateDnsZoneName string -+ TXTName string -+} -+ -+func NewTxtRecordID(subscriptionId, resourceGroup, privateDnsZoneName, tXTName string) TxtRecordId { -+ return TxtRecordId{ -+ SubscriptionId: subscriptionId, -+ ResourceGroup: resourceGroup, -+ PrivateDnsZoneName: privateDnsZoneName, -+ TXTName: tXTName, -+ } -+} -+ -+func (id TxtRecordId) String() string { -+ segments := []string{ -+ fmt.Sprintf("T X T Name %q", id.TXTName), -+ fmt.Sprintf("Private Dns Zone Name %q", id.PrivateDnsZoneName), -+ fmt.Sprintf("Resource Group %q", id.ResourceGroup), -+ } -+ segmentsStr := strings.Join(segments, " / ") -+ return fmt.Sprintf("%s: (%s)", "Txt Record", segmentsStr) -+} -+ -+func (id TxtRecordId) ID() string { -+ fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/privateDnsZones/%s/TXT/%s" -+ return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.PrivateDnsZoneName, id.TXTName) -+} -+ -+// TxtRecordID parses a TxtRecord ID into an TxtRecordId struct -+func TxtRecordID(input string) (*TxtRecordId, error) { -+ id, err := resourceids.ParseAzureResourceID(input) -+ if err != nil { -+ return nil, err -+ } -+ -+ resourceId := TxtRecordId{ -+ SubscriptionId: id.SubscriptionID, -+ ResourceGroup: id.ResourceGroup, -+ } -+ -+ if resourceId.SubscriptionId == "" { -+ return nil, fmt.Errorf("ID was missing the 'subscriptions' element") -+ } -+ -+ if resourceId.ResourceGroup == "" { -+ return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") -+ } -+ -+ if resourceId.PrivateDnsZoneName, err = id.PopSegment("privateDnsZones"); err != nil { -+ return nil, err -+ } -+ if resourceId.TXTName, err = id.PopSegment("TXT"); err != nil { -+ return nil, err -+ } -+ -+ if err := id.ValidateNoEmptySegments(input); err != nil { -+ return nil, err -+ } -+ -+ return &resourceId, nil -+} -diff --git a/internal/services/privatedns/parse/txt_record_test.go b/internal/services/privatedns/parse/txt_record_test.go -new file mode 100644 -index 0000000000..4947041f90 ---- /dev/null -+++ b/internal/services/privatedns/parse/txt_record_test.go -@@ -0,0 +1,128 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "testing" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+var _ resourceids.Id = TxtRecordId{} -+ -+func TestTxtRecordIDFormatter(t *testing.T) { -+ actual := NewTxtRecordID("12345678-1234-9876-4563-123456789012", "resGroup1", "privateDnsZone1", "txt1").ID() -+ expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/TXT/txt1" -+ if actual != expected { -+ t.Fatalf("Expected %q but got %q", expected, actual) -+ } -+} -+ -+func TestTxtRecordID(t *testing.T) { -+ testData := []struct { -+ Input string -+ Error bool -+ Expected *TxtRecordId -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Error: true, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Error: true, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Error: true, -+ }, -+ -+ { -+ // missing PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/", -+ Error: true, -+ }, -+ -+ { -+ // missing TXTName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for TXTName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/TXT/", -+ Error: true, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/TXT/txt1", -+ Expected: &TxtRecordId{ -+ SubscriptionId: "12345678-1234-9876-4563-123456789012", -+ ResourceGroup: "resGroup1", -+ PrivateDnsZoneName: "privateDnsZone1", -+ TXTName: "txt1", -+ }, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/PRIVATEDNSZONES/PRIVATEDNSZONE1/TXT/TXT1", -+ Error: true, -+ }, -+ } -+ -+ for _, v := range testData { -+ t.Logf("[DEBUG] Testing %q", v.Input) -+ -+ actual, err := TxtRecordID(v.Input) -+ if err != nil { -+ if v.Error { -+ continue -+ } -+ -+ t.Fatalf("Expect a value but got an error: %s", err) -+ } -+ if v.Error { -+ t.Fatal("Expect an error but didn't get one") -+ } -+ -+ if actual.SubscriptionId != v.Expected.SubscriptionId { -+ t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) -+ } -+ if actual.ResourceGroup != v.Expected.ResourceGroup { -+ t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) -+ } -+ if actual.PrivateDnsZoneName != v.Expected.PrivateDnsZoneName { -+ t.Fatalf("Expected %q but got %q for PrivateDnsZoneName", v.Expected.PrivateDnsZoneName, actual.PrivateDnsZoneName) -+ } -+ if actual.TXTName != v.Expected.TXTName { -+ t.Fatalf("Expected %q but got %q for TXTName", v.Expected.TXTName, actual.TXTName) -+ } -+ } -+} -diff --git a/internal/services/privatedns/parse/virtual_network_link.go b/internal/services/privatedns/parse/virtual_network_link.go -new file mode 100644 -index 0000000000..7ca1c96fdb ---- /dev/null -+++ b/internal/services/privatedns/parse/virtual_network_link.go -@@ -0,0 +1,75 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "fmt" -+ "strings" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+type VirtualNetworkLinkId struct { -+ SubscriptionId string -+ ResourceGroup string -+ PrivateDnsZoneName string -+ Name string -+} -+ -+func NewVirtualNetworkLinkID(subscriptionId, resourceGroup, privateDnsZoneName, name string) VirtualNetworkLinkId { -+ return VirtualNetworkLinkId{ -+ SubscriptionId: subscriptionId, -+ ResourceGroup: resourceGroup, -+ PrivateDnsZoneName: privateDnsZoneName, -+ Name: name, -+ } -+} -+ -+func (id VirtualNetworkLinkId) String() string { -+ segments := []string{ -+ fmt.Sprintf("Name %q", id.Name), -+ fmt.Sprintf("Private Dns Zone Name %q", id.PrivateDnsZoneName), -+ fmt.Sprintf("Resource Group %q", id.ResourceGroup), -+ } -+ segmentsStr := strings.Join(segments, " / ") -+ return fmt.Sprintf("%s: (%s)", "Virtual Network Link", segmentsStr) -+} -+ -+func (id VirtualNetworkLinkId) ID() string { -+ fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/privateDnsZones/%s/virtualNetworkLinks/%s" -+ return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.PrivateDnsZoneName, id.Name) -+} -+ -+// VirtualNetworkLinkID parses a VirtualNetworkLink ID into an VirtualNetworkLinkId struct -+func VirtualNetworkLinkID(input string) (*VirtualNetworkLinkId, error) { -+ id, err := resourceids.ParseAzureResourceID(input) -+ if err != nil { -+ return nil, err -+ } -+ -+ resourceId := VirtualNetworkLinkId{ -+ SubscriptionId: id.SubscriptionID, -+ ResourceGroup: id.ResourceGroup, -+ } -+ -+ if resourceId.SubscriptionId == "" { -+ return nil, fmt.Errorf("ID was missing the 'subscriptions' element") -+ } -+ -+ if resourceId.ResourceGroup == "" { -+ return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") -+ } -+ -+ if resourceId.PrivateDnsZoneName, err = id.PopSegment("privateDnsZones"); err != nil { -+ return nil, err -+ } -+ if resourceId.Name, err = id.PopSegment("virtualNetworkLinks"); err != nil { -+ return nil, err -+ } -+ -+ if err := id.ValidateNoEmptySegments(input); err != nil { -+ return nil, err -+ } -+ -+ return &resourceId, nil -+} -diff --git a/internal/services/privatedns/parse/virtual_network_link_test.go b/internal/services/privatedns/parse/virtual_network_link_test.go -new file mode 100644 -index 0000000000..1f45b56b1b ---- /dev/null -+++ b/internal/services/privatedns/parse/virtual_network_link_test.go -@@ -0,0 +1,128 @@ -+package parse -+ -+// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten -+ -+import ( -+ "testing" -+ -+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -+) -+ -+var _ resourceids.Id = VirtualNetworkLinkId{} -+ -+func TestVirtualNetworkLinkIDFormatter(t *testing.T) { -+ actual := NewVirtualNetworkLinkID("12345678-1234-9876-4563-123456789012", "resGroup1", "privateDnsZone1", "virtualNetworkLink1").ID() -+ expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/virtualNetworkLinks/virtualNetworkLink1" -+ if actual != expected { -+ t.Fatalf("Expected %q but got %q", expected, actual) -+ } -+} -+ -+func TestVirtualNetworkLinkID(t *testing.T) { -+ testData := []struct { -+ Input string -+ Error bool -+ Expected *VirtualNetworkLinkId -+ }{ -+ -+ { -+ // empty -+ Input: "", -+ Error: true, -+ }, -+ -+ { -+ // missing SubscriptionId -+ Input: "/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for SubscriptionId -+ Input: "/subscriptions/", -+ Error: true, -+ }, -+ -+ { -+ // missing ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for ResourceGroup -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", -+ Error: true, -+ }, -+ -+ { -+ // missing PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for PrivateDnsZoneName -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/", -+ Error: true, -+ }, -+ -+ { -+ // missing Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/", -+ Error: true, -+ }, -+ -+ { -+ // missing value for Name -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/virtualNetworkLinks/", -+ Error: true, -+ }, -+ -+ { -+ // valid -+ Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/virtualNetworkLinks/virtualNetworkLink1", -+ Expected: &VirtualNetworkLinkId{ -+ SubscriptionId: "12345678-1234-9876-4563-123456789012", -+ ResourceGroup: "resGroup1", -+ PrivateDnsZoneName: "privateDnsZone1", -+ Name: "virtualNetworkLink1", -+ }, -+ }, -+ -+ { -+ // upper-cased -+ Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/PRIVATEDNSZONES/PRIVATEDNSZONE1/VIRTUALNETWORKLINKS/VIRTUALNETWORKLINK1", -+ Error: true, -+ }, -+ } -+ -+ for _, v := range testData { -+ t.Logf("[DEBUG] Testing %q", v.Input) -+ -+ actual, err := VirtualNetworkLinkID(v.Input) -+ if err != nil { -+ if v.Error { -+ continue -+ } -+ -+ t.Fatalf("Expect a value but got an error: %s", err) -+ } -+ if v.Error { -+ t.Fatal("Expect an error but didn't get one") -+ } -+ -+ if actual.SubscriptionId != v.Expected.SubscriptionId { -+ t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) -+ } -+ if actual.ResourceGroup != v.Expected.ResourceGroup { -+ t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) -+ } -+ if actual.PrivateDnsZoneName != v.Expected.PrivateDnsZoneName { -+ t.Fatalf("Expected %q but got %q for PrivateDnsZoneName", v.Expected.PrivateDnsZoneName, actual.PrivateDnsZoneName) -+ } -+ if actual.Name != v.Expected.Name { -+ t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) -+ } -+ } -+} diff --git a/patches/0002-Shared-features.patch b/patches/0006-Make-shared-features-config-optional.patch similarity index 51% rename from patches/0002-Shared-features.patch rename to patches/0006-Make-shared-features-config-optional.patch index 727b5498e5..7612fbfd7e 100644 --- a/patches/0002-Shared-features.patch +++ b/patches/0006-Make-shared-features-config-optional.patch @@ -1,23 +1,13 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: aq17 Date: Thu, 25 May 2023 10:33:38 -0700 -Subject: [PATCH] Shared-features +Subject: [PATCH] Make shared features config optional +SharedFeatures config added in https://github.com/hashicorp/terraform-provider-azurerm/commit/f860827bcb64a4f6f97274e6ee276dd54b9bd4e2 +Modified in fork in https://github.com/pulumi/terraform-provider-azurerm/commit/6ac9e0b5ff9d72272d76f311a7665c03b12cb722 + +This originally included a conditional block to only set the SharedFeatures config if it had a value but this seems to have been lost during the provider config being refactored in https://github.com/hashicorp/terraform-provider-azurerm/commit/57bcf134131514ffcc962f20b12f993fad7d6060#diff-58d6a027753b50994deb7e11e4a99dde423f35844986019bd9cea5e0c94aba22 -diff --git a/internal/features/four_point_oh.go b/internal/features/four_point_oh.go -index d3723a3480..4953bff3b7 100644 ---- a/internal/features/four_point_oh.go -+++ b/internal/features/four_point_oh.go -@@ -40,3 +40,9 @@ func FourPointOh() bool { - func FourPointOhBeta() bool { - return FourPointOh() || false - } -+ -+// FORK: Small function to help us not make a breaking change in the Pulumi -+// provider where all Enums have been changed to case sensitive -+func CaseInsensitive() bool { -+ return true -+} diff --git a/internal/provider/features.go b/internal/provider/features.go index ac7f6da7d6..e41f13d5a6 100644 --- a/internal/provider/features.go diff --git a/patches/0007-Make-storage-account-resource_group_name-optional-in.patch b/patches/0007-Make-storage-account-resource_group_name-optional-in.patch new file mode 100644 index 0000000000..1bfb9dd8ab --- /dev/null +++ b/patches/0007-Make-storage-account-resource_group_name-optional-in.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Bradley +Date: Wed, 22 May 2024 12:47:41 +0100 +Subject: [PATCH] Make storage account resource_group_name optional in data + source + +Look up resource_group_name by using `storageClient.FindAccount` as storage account names should be unique, and resolve back to the resource group it belongs to. + +diff --git a/internal/services/storage/storage_account_data_source.go b/internal/services/storage/storage_account_data_source.go +index b215edff58..4381151544 100644 +--- a/internal/services/storage/storage_account_data_source.go ++++ b/internal/services/storage/storage_account_data_source.go +@@ -37,7 +37,8 @@ func dataSourceStorageAccount() *pluginsdk.Resource { + ValidateFunc: validate.StorageAccountName, + }, + +- "resource_group_name": commonschema.ResourceGroupNameForDataSource(), ++ // Fork: Ensuring that ResourceGroupName is optional when getting a storage account ++ "resource_group_name": commonschema.ResourceGroupNameOptional(), + + "location": commonschema.LocationComputed(), + +@@ -534,11 +535,28 @@ func dataSourceStorageAccount() *pluginsdk.Resource { + } + + func dataSourceStorageAccountRead(d *pluginsdk.ResourceData, meta interface{}) error { ++ storageClient := meta.(*clients.Client).Storage + client := meta.(*clients.Client).Storage.AccountsClient + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + ++ name := d.Get("name").(string) ++ var resourceGroup string ++ if rg, ok := d.GetOk("resource_group_name"); ok { ++ resourceGroup = rg.(string) ++ } else { ++ account, err := storageClient.FindAccount(ctx, subscriptionId, name) ++ if err != nil { ++ return fmt.Errorf("Error retrieving Account %q: %s", name, err) ++ } ++ if account == nil { ++ return fmt.Errorf("Unable to locate Account %q", name) ++ } ++ resourceGroup = account.StorageAccountId.ResourceGroupName ++ d.Set("resource_group_name", resourceGroup) ++ } ++ + storageDomainSuffix, ok := meta.(*clients.Client).Account.Environment.Storage.DomainSuffix() + if !ok { + return fmt.Errorf("could not determine Storage domain suffix for environment %q", meta.(*clients.Client).Account.Environment.Name) diff --git a/patches/0008-Relax-storage-management-policy-validation.patch b/patches/0008-Relax-storage-management-policy-validation.patch new file mode 100644 index 0000000000..786d27793f --- /dev/null +++ b/patches/0008-Relax-storage-management-policy-validation.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Bradley +Date: Wed, 22 May 2024 12:49:00 +0100 +Subject: [PATCH] Relax storage management policy validation + +Remove validation of tier_to_cool_after_days_since_last_access_time_greater_than range. + +diff --git a/internal/services/storage/storage_management_policy_resource.go b/internal/services/storage/storage_management_policy_resource.go +index c90910e01c..1e3e9900e2 100644 +--- a/internal/services/storage/storage_management_policy_resource.go ++++ b/internal/services/storage/storage_management_policy_resource.go +@@ -138,10 +138,9 @@ func resourceStorageManagementPolicy() *pluginsdk.Resource { + ValidateFunc: validation.IntBetween(0, 99999), + }, + "tier_to_cool_after_days_since_last_access_time_greater_than": { +- Type: pluginsdk.TypeInt, +- Optional: true, +- Default: -1, +- ValidateFunc: validation.IntBetween(0, 99999), ++ Type: pluginsdk.TypeInt, ++ Optional: true, ++ Default: -1, + }, + "auto_tier_to_hot_from_cool_enabled": { + Type: pluginsdk.TypeBool, diff --git a/patches/0005-Modify-resources.patch b/patches/0009-Make-fields-case-insensitive-for-backward-compatibil.patch similarity index 71% rename from patches/0005-Modify-resources.patch rename to patches/0009-Make-fields-case-insensitive-for-backward-compatibil.patch index 3654a142b9..b90b2c9bf5 100644 --- a/patches/0005-Modify-resources.patch +++ b/patches/0009-Make-fields-case-insensitive-for-backward-compatibil.patch @@ -1,9 +1,26 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Anton Tayanovskyy -Date: Wed, 7 Feb 2024 13:53:37 -0500 -Subject: [PATCH] Modify resources +From: Daniel Bradley +Date: Wed, 22 May 2024 13:18:05 +0100 +Subject: [PATCH] Make fields case-insensitive for backward compatibility +Try to make diffs as robust and mergable as possible: +- Minimise the amount of code reformatting around by adding comments where needed. +- Put added import lines in own block to avoid conflicts. +diff --git a/internal/features/four_point_oh.go b/internal/features/four_point_oh.go +index d3723a3480..4953bff3b7 100644 +--- a/internal/features/four_point_oh.go ++++ b/internal/features/four_point_oh.go +@@ -40,3 +40,9 @@ func FourPointOh() bool { + func FourPointOhBeta() bool { + return FourPointOh() || false + } ++ ++// FORK: Small function to help us not make a breaking change in the Pulumi ++// provider where all Enums have been changed to case sensitive ++func CaseInsensitive() bool { ++ return true ++} diff --git a/internal/services/advisor/advisor_recommendations_data_source.go b/internal/services/advisor/advisor_recommendations_data_source.go index 39c0506972..c4965dfbdb 100644 --- a/internal/services/advisor/advisor_recommendations_data_source.go @@ -51,58 +68,6 @@ index 40c52aa5bd..dab70b9c5c 100644 }, "backup_blob_container_uri": { -diff --git a/internal/services/appservice/helpers/function_app_schema.go b/internal/services/appservice/helpers/function_app_schema.go -index 06b5fa4d90..bdda339536 100644 ---- a/internal/services/appservice/helpers/function_app_schema.go -+++ b/internal/services/appservice/helpers/function_app_schema.go -@@ -1059,10 +1059,11 @@ func linuxFunctionAppStackSchema() *pluginsdk.Schema { - Description: "The version of .Net. Possible values are `3.1`, `6.0` and `7.0`", - }, - -+ // FORK: Removed default value due to pulumi-azure#1227 -+ // These modifications can be removed once pulumi-terraform-bridge#577 is fixed. - "use_dotnet_isolated_runtime": { - Type: pluginsdk.TypeBool, - Optional: true, -- Default: false, - ConflictsWith: []string{ - "site_config.0.application_stack.0.python_version", - "site_config.0.application_stack.0.java_version", -diff --git a/internal/services/appservice/linux_function_app_slot_resource_test.go b/internal/services/appservice/linux_function_app_slot_resource_test.go -index 4b02552385..5dfdc6a81e 100644 ---- a/internal/services/appservice/linux_function_app_slot_resource_test.go -+++ b/internal/services/appservice/linux_function_app_slot_resource_test.go -@@ -1098,11 +1098,21 @@ func TestAccLinuxFunctionAppSlot_identityKeyVaultIdentity(t *testing.T) { - - data.ResourceTest(t, r, []acceptance.TestStep{ - { -- Config: r.identityUserAssignedKeyVaultIdentity(data, SkuStandardPlan), -+ Config: r.basic(data, SkuStandardPlan), -+ Check: acceptance.ComposeTestCheckFunc( -+ check.That(data.ResourceName).ExistsInAzure(r), -+ check.That(data.ResourceName).Key("kind").HasValue("functionapp,linux"), -+ ), -+ }, -+ data.ImportStep(), -+ { -+ Config: r.updateStorageAccount(data, SkuStandardPlan), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), -+ check.That(data.ResourceName).Key("kind").HasValue("functionapp,linux"), - ), - }, -+ data.ImportStep(), - }) - } - -@@ -1147,7 +1157,6 @@ func TestAccLinuxFunctionAppSlot_storageAccountKeyVaultSecret(t *testing.T) { - Config: r.storageAccountKVSecret(data, SkuStandardPlan), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), -- check.That(data.ResourceName).Key("kind").HasValue("functionapp,linux"), - ), - }, - data.ImportStep("site_credential.0.password"), diff --git a/internal/services/automation/automation_runbook_resource.go b/internal/services/automation/automation_runbook_resource.go index fd0873abad..a3c6fb2896 100644 --- a/internal/services/automation/automation_runbook_resource.go @@ -222,108 +187,55 @@ index 67956f15c9..0b70ccb184 100644 "tags": tags.Schema(), diff --git a/internal/services/compute/image_resource.go b/internal/services/compute/image_resource.go -index d1de175cb8..d18589669e 100644 +index d1de175cb8..e8fd90b9df 100644 --- a/internal/services/compute/image_resource.go +++ b/internal/services/compute/image_resource.go -@@ -7,6 +7,9 @@ import ( +@@ -7,6 +7,8 @@ import ( "fmt" "time" + "github.com/hashicorp/terraform-provider-azurerm/internal/features" -+ "github.com/tombuildsstuff/kermit/sdk/compute/2022-08-01/compute" + "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -@@ -88,18 +91,18 @@ func resourceImage() *pluginsdk.Resource { - Type: pluginsdk.TypeString, - Optional: true, +@@ -90,7 +92,7 @@ func resourceImage() *pluginsdk.Resource { ValidateFunc: validation.StringInSlice([]string{ -- string(images.OperatingSystemTypesLinux), -- string(images.OperatingSystemTypesWindows), + string(images.OperatingSystemTypesLinux), + string(images.OperatingSystemTypesWindows), - }, false), -+ string(compute.OperatingSystemTypesLinux), -+ string(compute.OperatingSystemTypesWindows), + }, features.CaseInsensitive()), }, "os_state": { - Type: pluginsdk.TypeString, - Optional: true, +@@ -99,7 +101,7 @@ func resourceImage() *pluginsdk.Resource { ValidateFunc: validation.StringInSlice([]string{ -- string(images.OperatingSystemStateTypesGeneralized), -- string(images.OperatingSystemStateTypesSpecialized), + string(images.OperatingSystemStateTypesGeneralized), + string(images.OperatingSystemStateTypesSpecialized), - }, false), -+ string(compute.OperatingSystemStateTypesGeneralized), -+ string(compute.OperatingSystemStateTypesSpecialized), + }, features.CaseInsensitive()), }, "managed_disk_id": { -@@ -123,10 +126,10 @@ func resourceImage() *pluginsdk.Resource { - Optional: true, - Default: string(images.CachingTypesNone), - ValidateFunc: validation.StringInSlice([]string{ -- string(images.CachingTypesNone), -- string(images.CachingTypesReadOnly), -- string(images.CachingTypesReadWrite), +@@ -126,7 +128,7 @@ func resourceImage() *pluginsdk.Resource { + string(images.CachingTypesNone), + string(images.CachingTypesReadOnly), + string(images.CachingTypesReadWrite), - }, false), -+ string(compute.CachingTypesNone), -+ string(compute.CachingTypesReadOnly), -+ string(compute.CachingTypesReadWrite), + }, features.CaseInsensitive()), }, "size_gb": { -@@ -176,10 +179,11 @@ func resourceImage() *pluginsdk.Resource { - Optional: true, - Default: string(images.CachingTypesNone), - ValidateFunc: validation.StringInSlice([]string{ -- string(images.CachingTypesNone), -- string(images.CachingTypesReadOnly), -- string(images.CachingTypesReadWrite), +@@ -179,7 +181,8 @@ func resourceImage() *pluginsdk.Resource { + string(images.CachingTypesNone), + string(images.CachingTypesReadOnly), + string(images.CachingTypesReadWrite), - }, false), -+ string(compute.CachingTypesNone), -+ string(compute.CachingTypesReadOnly), -+ string(compute.CachingTypesReadWrite), + }, features.CaseInsensitive()), + DiffSuppressFunc: suppress.CaseDifferenceV2Only, }, "size_gb": { -diff --git a/internal/services/compute/linux_virtual_machine_resource.go b/internal/services/compute/linux_virtual_machine_resource.go -index fdeed2c65d..eb99645011 100644 ---- a/internal/services/compute/linux_virtual_machine_resource.go -+++ b/internal/services/compute/linux_virtual_machine_resource.go -@@ -368,11 +368,11 @@ func resourceLinuxVirtualMachine() *pluginsdk.Resource { - }, - - "platform_fault_domain": { -- Type: pluginsdk.TypeInt, -- Optional: true, -- Default: -1, -- ForceNew: true, -- RequiredWith: []string{"virtual_machine_scale_set_id"}, -+ Type: pluginsdk.TypeInt, -+ Optional: true, -+ Default: -1, -+ ForceNew: true, -+ //RequiredWith: []string{"virtual_machine_scale_set_id"}, - ValidateFunc: validation.IntAtLeast(-1), - }, - -diff --git a/internal/services/compute/managed_disk_resource.go b/internal/services/compute/managed_disk_resource.go -index 619b11b2a3..2b87497d64 100644 ---- a/internal/services/compute/managed_disk_resource.go -+++ b/internal/services/compute/managed_disk_resource.go -@@ -164,6 +164,7 @@ func resourceManagedDisk() *pluginsdk.Resource { - Type: pluginsdk.TypeString, - Optional: true, - ValidateFunc: validation.StringInSlice([]string{ -+ - string(disks.OperatingSystemTypesWindows), - string(disks.OperatingSystemTypesLinux), - }, false), diff --git a/internal/services/compute/snapshot_resource.go b/internal/services/compute/snapshot_resource.go index 539c138df6..5446846a89 100644 --- a/internal/services/compute/snapshot_resource.go @@ -369,27 +281,6 @@ index db0a760341..fe30ade2d5 100644 }, "write_accelerator_enabled": { -diff --git a/internal/services/compute/windows_virtual_machine_resource.go b/internal/services/compute/windows_virtual_machine_resource.go -index 4c6030c160..e320bb0c99 100644 ---- a/internal/services/compute/windows_virtual_machine_resource.go -+++ b/internal/services/compute/windows_virtual_machine_resource.go -@@ -383,11 +383,11 @@ func resourceWindowsVirtualMachine() *pluginsdk.Resource { - }, - - "platform_fault_domain": { -- Type: pluginsdk.TypeInt, -- Optional: true, -- Default: -1, -- ForceNew: true, -- RequiredWith: []string{"virtual_machine_scale_set_id"}, -+ Type: pluginsdk.TypeInt, -+ Optional: true, -+ Default: -1, -+ ForceNew: true, -+ //RequiredWith: []string{"virtual_machine_scale_set_id"}, - ValidateFunc: validation.IntAtLeast(-1), - }, - diff --git a/internal/services/containers/container_group_resource.go b/internal/services/containers/container_group_resource.go index 8c58fcc2df..be6dd18437 100644 --- a/internal/services/containers/container_group_resource.go @@ -432,30 +323,6 @@ index 8c58fcc2df..be6dd18437 100644 }, "dns_name_label": { -diff --git a/internal/services/containers/container_registry_resource.go b/internal/services/containers/container_registry_resource.go -index b4421f2947..0eb8adf83a 100644 ---- a/internal/services/containers/container_registry_resource.go -+++ b/internal/services/containers/container_registry_resource.go -@@ -7,7 +7,6 @@ import ( - "context" - "fmt" - "log" -- "sort" - "strings" - "time" - -@@ -762,11 +761,6 @@ func resourceContainerRegistryRead(d *pluginsdk.ResourceData, meta interface{}) - } - } - -- // The order of the georeplications returned from the list API is not consistent. We simply order it alphabetically to be consistent. -- sort.Slice(geoReplications, func(i, j int) bool { -- return geoReplications[i].(map[string]interface{})["location"].(string) < geoReplications[j].(map[string]interface{})["location"].(string) -- }) -- - d.Set("georeplications", geoReplications) - - return nil diff --git a/internal/services/containers/kubernetes_cluster_resource.go b/internal/services/containers/kubernetes_cluster_resource.go index e4a6c70f92..3706fdcb8f 100644 --- a/internal/services/containers/kubernetes_cluster_resource.go @@ -470,25 +337,19 @@ index e4a6c70f92..3706fdcb8f 100644 "outbound_type": { diff --git a/internal/services/cosmos/common/schema.go b/internal/services/cosmos/common/schema.go -index b141d14cfd..0e3d2fd1b2 100644 +index b141d14cfd..d15c245309 100644 --- a/internal/services/cosmos/common/schema.go +++ b/internal/services/cosmos/common/schema.go -@@ -107,9 +107,10 @@ func CosmosDbIndexingPolicySchema() *pluginsdk.Schema { - // `automatic` is excluded as it is deprecated; see https://stackoverflow.com/a/58721386 - // `indexing_mode` case changes from 2020-04-01 to 2021-01-15 issue https://github.com/Azure/azure-rest-api-specs/issues/14051 - "indexing_mode": { -- Type: pluginsdk.TypeString, -- Optional: true, -- Default: documentdb.IndexingModeConsistent, -+ Type: pluginsdk.TypeString, -+ Optional: true, -+ Default: documentdb.IndexingModeConsistent, -+ DiffSuppressFunc: suppress.CaseDifferenceV2Only, // Open issue https://github.com/Azure/azure-sdk-for-go/issues/6603 - ValidateFunc: validation.StringInSlice([]string{ +@@ -114,6 +114,7 @@ func CosmosDbIndexingPolicySchema() *pluginsdk.Schema { string(documentdb.IndexingModeConsistent), string(documentdb.IndexingModeNone), + }, false), ++ DiffSuppressFunc: suppress.CaseDifferenceV2Only, // Open issue https://github.com/Azure/azure-sdk-for-go/issues/6603 + }, + + "included_path": { diff --git a/internal/services/cosmos/cosmosdb_account_resource.go b/internal/services/cosmos/cosmosdb_account_resource.go -index bdbf31ad05..fb941af76c 100644 +index bdbf31ad05..aa16996aaa 100644 --- a/internal/services/cosmos/cosmosdb_account_resource.go +++ b/internal/services/cosmos/cosmosdb_account_resource.go @@ -13,6 +13,8 @@ import ( @@ -527,81 +388,50 @@ index bdbf31ad05..fb941af76c 100644 }, // This value can only change if the 'consistency_level' is set to 'BoundedStaleness' -@@ -446,8 +448,9 @@ func resourceCosmosDbAccount() *pluginsdk.Resource { - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "name": { -- Type: pluginsdk.TypeString, -- Required: true, -+ Type: pluginsdk.TypeString, -+ Required: true, +@@ -466,6 +468,7 @@ func resourceCosmosDbAccount() *pluginsdk.Resource { + string(databaseAccountCapabilitiesEnableTtlOnCustomPath), + string(databaseAccountCapabilitiesEnablePartialUniqueIndex), + }, false), + DiffSuppressFunc: suppress.CaseDifferenceV2Only, - ValidateFunc: validation.StringInSlice([]string{ - string(databaseAccountCapabilitiesEnableAggregationPipeline), - string(databaseAccountCapabilitiesEnableCassandra), -diff --git a/internal/services/cosmos/cosmosdb_cassandra_cluster_resource_test.go b/internal/services/cosmos/cosmosdb_cassandra_cluster_resource_test.go -index e6a2b93e01..53efd0fc1f 100644 ---- a/internal/services/cosmos/cosmosdb_cassandra_cluster_resource_test.go -+++ b/internal/services/cosmos/cosmosdb_cassandra_cluster_resource_test.go -@@ -18,6 +18,18 @@ import ( - - type CassandraClusterResource struct{} - -+func TestAccCassandraCluster(t *testing.T) { -+ // NOTE: this is a combined test rather than separate split out tests due to all below TCs sharing same sp -+ acceptance.RunTestsInSequence(t, map[string]map[string]func(t *testing.T){ -+ "basic": { -+ "basic": testAccCassandraCluster_basic, -+ "requiresImport": testAccCassandraCluster_requiresImport, -+ "complete": testAccCassandraCluster_complete, -+ "update": testAccCassandraCluster_update, -+ }, -+ }) -+} -+ - func testAccCassandraCluster_basic(t *testing.T) { - data := acceptance.BuildTestData(t, "azurerm_cosmosdb_cassandra_cluster", "test") - r := CassandraClusterResource{} + }, + }, + }, diff --git a/internal/services/cosmos/cosmosdb_gremlin_graph_resource.go b/internal/services/cosmos/cosmosdb_gremlin_graph_resource.go -index ba13f83bab..6c6e7bd44b 100644 +index ba13f83bab..b0491b5d8e 100644 --- a/internal/services/cosmos/cosmosdb_gremlin_graph_resource.go +++ b/internal/services/cosmos/cosmosdb_gremlin_graph_resource.go -@@ -6,6 +6,7 @@ package cosmos - import ( - "context" - "fmt" -+ "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" - "log" +@@ -10,6 +10,8 @@ import ( "strings" "time" -@@ -126,8 +127,9 @@ func resourceCosmosDbGremlinGraph() *pluginsdk.Resource { - - // case change in 2021-01-15, issue https://github.com/Azure/azure-rest-api-specs/issues/14051 - "indexing_mode": { -- Type: pluginsdk.TypeString, -- Required: true, -+ Type: pluginsdk.TypeString, -+ Required: true, -+ DiffSuppressFunc: suppress.CaseDifferenceV2Only, // Open issue https://github.com/Azure/azure-sdk-for-go/issues/6603 - ValidateFunc: validation.StringInSlice([]string{ - string(cosmosdb.IndexingModeConsistent), + ++ "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" ++ + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2023-04-15/cosmosdb" +@@ -133,6 +135,7 @@ func resourceCosmosDbGremlinGraph() *pluginsdk.Resource { string(cosmosdb.IndexingModeNone), + string(cosmosdb.IndexingModeLazy), + }, false), ++ DiffSuppressFunc: suppress.CaseDifferenceV2Only, // Open issue https://github.com/Azure/azure-sdk-for-go/issues/6603 + }, + + "included_paths": { diff --git a/internal/services/dns/dns_caa_record_resource.go b/internal/services/dns/dns_caa_record_resource.go -index 24f5734126..ed9096b273 100644 +index 24f5734126..f20b2cd035 100644 --- a/internal/services/dns/dns_caa_record_resource.go +++ b/internal/services/dns/dns_caa_record_resource.go -@@ -14,8 +14,10 @@ import ( - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" - "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" - "github.com/hashicorp/terraform-provider-azurerm/internal/clients" +@@ -8,6 +8,9 @@ import ( + "fmt" + "time" + + "github.com/hashicorp/terraform-provider-azurerm/internal/features" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" - "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - ) -@@ -82,7 +84,8 @@ func resourceDnsCaaRecord() *pluginsdk.Resource { ++ + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" +@@ -82,7 +85,8 @@ func resourceDnsCaaRecord() *pluginsdk.Resource { "issue", "issuewild", "iodef", @@ -625,18 +455,19 @@ index 4c348213e9..578b65b5ac 100644 "capacity": { diff --git a/internal/services/eventhub/eventhub_resource.go b/internal/services/eventhub/eventhub_resource.go -index b3cb1e5f84..7cb1c42d70 100644 +index b3cb1e5f84..2ec36c63da 100644 --- a/internal/services/eventhub/eventhub_resource.go +++ b/internal/services/eventhub/eventhub_resource.go -@@ -5,6 +5,7 @@ package eventhub - - import ( - "fmt" -+ "github.com/hashicorp/terraform-provider-azurerm/internal/features" +@@ -8,6 +8,8 @@ import ( "log" "time" -@@ -93,7 +94,7 @@ func resourceEventHub() *pluginsdk.Resource { ++ "github.com/hashicorp/terraform-provider-azurerm/internal/features" ++ + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" +@@ -93,7 +95,7 @@ func resourceEventHub() *pluginsdk.Resource { ValidateFunc: validation.StringInSlice([]string{ string(eventhubs.EncodingCaptureDescriptionAvro), string(eventhubs.EncodingCaptureDescriptionAvroDeflate), @@ -676,45 +507,42 @@ index 29d42ef784..f2f9d678ab 100644 "source_addresses": { Type: pluginsdk.TypeSet, diff --git a/internal/services/hdinsight/hdinsight_hadoop_cluster_resource.go b/internal/services/hdinsight/hdinsight_hadoop_cluster_resource.go -index 067484d622..f17abd35c9 100644 +index 067484d622..543f3c8f77 100644 --- a/internal/services/hdinsight/hdinsight_hadoop_cluster_resource.go +++ b/internal/services/hdinsight/hdinsight_hadoop_cluster_resource.go -@@ -5,6 +5,7 @@ package hdinsight - - import ( - "fmt" -+ "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" - "log" +@@ -9,6 +9,8 @@ import ( "strings" "time" -@@ -147,9 +148,10 @@ func resourceHDInsightHadoopCluster() *pluginsdk.Resource { - }, - "vm_size": { -- Type: pluginsdk.TypeString, -- Required: true, -- ValidateFunc: validation.StringInSlice(validate.NodeDefinitionVMSize, false), -+ Type: pluginsdk.TypeString, -+ Required: true, ++ "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" ++ + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +@@ -150,6 +152,8 @@ func resourceHDInsightHadoopCluster() *pluginsdk.Resource { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice(validate.NodeDefinitionVMSize, false), ++ // FORK: Force attributes to maintain case-insensitivity to avoid breaking changes in Pulumi programs. + DiffSuppressFunc: suppress.CaseDifferenceV2Only, -+ ValidateFunc: validation.StringInSlice(validate.NodeDefinitionVMSize, false), }, "install_script_action": { diff --git a/internal/services/hdinsight/schema.go b/internal/services/hdinsight/schema.go -index 36c461cbdc..da5c8b4982 100644 +index 36c461cbdc..e063184038 100644 --- a/internal/services/hdinsight/schema.go +++ b/internal/services/hdinsight/schema.go -@@ -5,6 +5,8 @@ package hdinsight +@@ -9,6 +9,9 @@ import ( + "regexp" + "strings" - import ( - "fmt" + "github.com/hashicorp/terraform-provider-azurerm/internal/features" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" - "net/url" - "regexp" - "strings" -@@ -42,7 +44,8 @@ func SchemaHDInsightTier() *pluginsdk.Schema { ++ + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +@@ -42,7 +45,8 @@ func SchemaHDInsightTier() *pluginsdk.Schema { ValidateFunc: validation.StringInSlice([]string{ string(clusters.TierStandard), string(clusters.TierPremium), @@ -724,19 +552,12 @@ index 36c461cbdc..da5c8b4982 100644 } } -@@ -1165,10 +1168,11 @@ type HDInsightNodeDefinition struct { - func SchemaHDInsightNodeDefinition(schemaLocation string, definition HDInsightNodeDefinition, required bool) *pluginsdk.Schema { - result := map[string]*pluginsdk.Schema{ - "vm_size": { -- Type: pluginsdk.TypeString, -- Required: true, -- ForceNew: true, -- ValidateFunc: validation.StringInSlice(validate.NodeDefinitionVMSize, false), -+ Type: pluginsdk.TypeString, -+ Required: true, -+ ForceNew: true, +@@ -1169,6 +1173,8 @@ func SchemaHDInsightNodeDefinition(schemaLocation string, definition HDInsightNo + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice(validate.NodeDefinitionVMSize, false), ++ // FORK: Force attributes to maintain case-insensitivity to avoid breaking changes in Pulumi programs. + DiffSuppressFunc: suppress.CaseDifferenceV2Only, -+ ValidateFunc: validation.StringInSlice(validate.NodeDefinitionVMSize, false), }, "username": { Type: pluginsdk.TypeString, @@ -754,50 +575,42 @@ index e15c10ac79..ebcdb70c0b 100644 }, "template": { diff --git a/internal/services/iothub/iothub_resource.go b/internal/services/iothub/iothub_resource.go -index 3d40271135..b2dccadabb 100644 +index 3d40271135..277d4b1670 100644 --- a/internal/services/iothub/iothub_resource.go +++ b/internal/services/iothub/iothub_resource.go -@@ -30,6 +30,7 @@ import ( - servicebusValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" -+ "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" - "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" -@@ -341,11 +342,13 @@ func resourceIotHub() *pluginsdk.Resource { - }, +@@ -13,6 +13,8 @@ import ( + "strings" + "time" - "encoding": { -- Type: pluginsdk.TypeString, -- Optional: true, -- ForceNew: true, -- Default: string(devices.EncodingAvro), ++ "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" ++ + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" +@@ -345,7 +347,7 @@ func resourceIotHub() *pluginsdk.Resource { + Optional: true, + ForceNew: true, + Default: string(devices.EncodingAvro), - DiffSuppressFunc: suppressIfTypeIsNot("AzureIotHub.StorageContainer"), -+ Type: pluginsdk.TypeString, -+ Optional: true, -+ ForceNew: true, -+ Default: string(devices.EncodingAvro), -+ DiffSuppressFunc: suppressWhenAny( -+ suppressIfTypeIsNot("AzureIotHub.StorageContainer"), -+ suppress.CaseDifferenceV2Only), ++ DiffSuppressFunc: suppress.CaseDifferenceV2Only, ValidateFunc: validation.StringInSlice([]string{ string(devices.EncodingAvro), string(devices.EncodingAvroDeflate), diff --git a/internal/services/keyvault/key_vault_certificate_resource.go b/internal/services/keyvault/key_vault_certificate_resource.go -index 90e02d8080..8970530193 100644 +index 90e02d8080..a28b4f08e5 100644 --- a/internal/services/keyvault/key_vault_certificate_resource.go +++ b/internal/services/keyvault/key_vault_certificate_resource.go -@@ -9,6 +9,8 @@ import ( - "encoding/base64" - "encoding/hex" - "fmt" +@@ -14,6 +14,9 @@ import ( + "strings" + "time" + + "github.com/hashicorp/terraform-provider-azurerm/internal/features" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" - "log" - "math" - "strings" -@@ -157,7 +159,8 @@ func resourceKeyVaultCertificate() *pluginsdk.Resource { ++ + "github.com/Azure/go-autorest/autorest" + "github.com/google/go-cmp/cmp" + "github.com/hashicorp/go-azure-helpers/lang/pointer" +@@ -157,7 +160,8 @@ func resourceKeyVaultCertificate() *pluginsdk.Resource { string(keyvault.JSONWebKeyTypeRSA), string(keyvault.JSONWebKeyTypeRSAHSM), string(keyvault.JSONWebKeyTypeOct), @@ -932,18 +745,19 @@ index 799f142449..6aada8c4d7 100644 }, }, diff --git a/internal/services/loadbalancer/loadbalancer_resource.go b/internal/services/loadbalancer/loadbalancer_resource.go -index 88ad72fb9d..f9c43c1458 100644 +index 88ad72fb9d..fddeea834e 100644 --- a/internal/services/loadbalancer/loadbalancer_resource.go +++ b/internal/services/loadbalancer/loadbalancer_resource.go -@@ -6,6 +6,7 @@ package loadbalancer - import ( - "context" - "fmt" +@@ -12,6 +12,8 @@ import ( + "strings" + "time" + + "github.com/hashicorp/terraform-provider-azurerm/internal/features" - "log" - "reflect" - "strconv" -@@ -399,7 +400,8 @@ func resourceArmLoadBalancerSchema() map[string]*pluginsdk.Schema { ++ + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +@@ -399,7 +401,8 @@ func resourceArmLoadBalancerSchema() map[string]*pluginsdk.Schema { string(loadbalancers.LoadBalancerSkuNameBasic), string(loadbalancers.LoadBalancerSkuNameStandard), string(loadbalancers.LoadBalancerSkuNameGateway), @@ -954,18 +768,19 @@ index 88ad72fb9d..f9c43c1458 100644 "sku_tier": { diff --git a/internal/services/loadbalancer/nat_pool_resource.go b/internal/services/loadbalancer/nat_pool_resource.go -index d07fec653a..2c55900279 100644 +index d07fec653a..57342b5b34 100644 --- a/internal/services/loadbalancer/nat_pool_resource.go +++ b/internal/services/loadbalancer/nat_pool_resource.go -@@ -5,6 +5,7 @@ package loadbalancer - - import ( - "fmt" -+ "github.com/hashicorp/terraform-provider-azurerm/internal/features" +@@ -8,6 +8,8 @@ import ( "log" "time" -@@ -71,7 +72,7 @@ func resourceArmLoadBalancerNatPool() *pluginsdk.Resource { ++ "github.com/hashicorp/terraform-provider-azurerm/internal/features" ++ + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" +@@ -71,7 +73,7 @@ func resourceArmLoadBalancerNatPool() *pluginsdk.Resource { string(loadbalancers.TransportProtocolAll), string(loadbalancers.TransportProtocolTcp), string(loadbalancers.TransportProtocolUdp), @@ -975,18 +790,19 @@ index d07fec653a..2c55900279 100644 "frontend_port_start": { diff --git a/internal/services/loadbalancer/nat_rule_resource.go b/internal/services/loadbalancer/nat_rule_resource.go -index 773f12d0c5..a3b8822324 100644 +index 773f12d0c5..28e0ce4af5 100644 --- a/internal/services/loadbalancer/nat_rule_resource.go +++ b/internal/services/loadbalancer/nat_rule_resource.go -@@ -5,6 +5,7 @@ package loadbalancer - - import ( - "fmt" -+ "github.com/hashicorp/terraform-provider-azurerm/internal/features" +@@ -8,6 +8,8 @@ import ( "log" "time" -@@ -69,7 +70,7 @@ func resourceArmLoadBalancerNatRule() *pluginsdk.Resource { ++ "github.com/hashicorp/terraform-provider-azurerm/internal/features" ++ + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" +@@ -69,7 +71,7 @@ func resourceArmLoadBalancerNatRule() *pluginsdk.Resource { string(loadbalancers.TransportProtocolAll), string(loadbalancers.TransportProtocolTcp), string(loadbalancers.TransportProtocolUdp), @@ -996,18 +812,19 @@ index 773f12d0c5..a3b8822324 100644 "frontend_port": { diff --git a/internal/services/loadbalancer/probe_resource.go b/internal/services/loadbalancer/probe_resource.go -index 5b4376f28d..ea4551f9ab 100644 +index 5b4376f28d..440c5c209a 100644 --- a/internal/services/loadbalancer/probe_resource.go +++ b/internal/services/loadbalancer/probe_resource.go -@@ -5,6 +5,7 @@ package loadbalancer - - import ( - "fmt" -+ "github.com/hashicorp/terraform-provider-azurerm/internal/features" +@@ -8,6 +8,8 @@ import ( "log" "time" -@@ -67,7 +68,7 @@ func resourceArmLoadBalancerProbe() *pluginsdk.Resource { ++ "github.com/hashicorp/terraform-provider-azurerm/internal/features" ++ + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-09-01/loadbalancers" +@@ -67,7 +69,7 @@ func resourceArmLoadBalancerProbe() *pluginsdk.Resource { string(loadbalancers.ProbeProtocolHTTP), string(loadbalancers.ProbeProtocolHTTPS), string(loadbalancers.ProbeProtocolTcp), @@ -1017,18 +834,19 @@ index 5b4376f28d..ea4551f9ab 100644 "port": { diff --git a/internal/services/loadbalancer/rule_resource.go b/internal/services/loadbalancer/rule_resource.go -index 1ae1e82215..dd88209bf6 100644 +index 1ae1e82215..1699fba1b7 100644 --- a/internal/services/loadbalancer/rule_resource.go +++ b/internal/services/loadbalancer/rule_resource.go -@@ -5,6 +5,7 @@ package loadbalancer - - import ( - "fmt" -+ "github.com/hashicorp/terraform-provider-azurerm/internal/features" +@@ -8,6 +8,8 @@ import ( "log" "time" -@@ -371,7 +372,7 @@ func resourceArmLoadBalancerRuleSchema() map[string]*pluginsdk.Schema { ++ "github.com/hashicorp/terraform-provider-azurerm/internal/features" ++ + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-09-01/loadbalancers" +@@ -371,7 +373,7 @@ func resourceArmLoadBalancerRuleSchema() map[string]*pluginsdk.Schema { string(loadbalancers.TransportProtocolAll), string(loadbalancers.TransportProtocolTcp), string(loadbalancers.TransportProtocolUdp), @@ -1038,41 +856,44 @@ index 1ae1e82215..dd88209bf6 100644 "frontend_port": { diff --git a/internal/services/loganalytics/log_analytics_datasource_windows_event_resource.go b/internal/services/loganalytics/log_analytics_datasource_windows_event_resource.go -index dbbf9132fb..2e56c94e0e 100644 +index dbbf9132fb..e516105b85 100644 --- a/internal/services/loganalytics/log_analytics_datasource_windows_event_resource.go +++ b/internal/services/loganalytics/log_analytics_datasource_windows_event_resource.go -@@ -6,6 +6,7 @@ package loganalytics - import ( - "encoding/json" - "fmt" -+ "github.com/hashicorp/terraform-provider-azurerm/internal/features" +@@ -9,6 +9,8 @@ import ( "log" "time" -@@ -79,7 +80,8 @@ func resourceLogAnalyticsDataSourceWindowsEvent() *pluginsdk.Resource { ++ "github.com/hashicorp/terraform-provider-azurerm/internal/features" ++ + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/datasources" +@@ -79,7 +81,9 @@ func resourceLogAnalyticsDataSourceWindowsEvent() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, // API backend accepts event_types case-insensitively - ValidateFunc: validation.StringInSlice([]string{"Error", "Warning", "Information"}, false), -+ ValidateFunc: validation.StringInSlice([]string{"Error", "Warning", "Information"}, features.CaseInsensitive()), ++ ValidateFunc: validation.StringInSlice([]string{"Error", "Warning", "Information"}, features.CaseInsensitive()), ++ // FORK: Force attributes to maintain case-insensitivity to avoid breaking changes in Pulumi programs. + DiffSuppressFunc: suppress.CaseDifferenceV2Only, }, }, }, diff --git a/internal/services/loganalytics/log_analytics_workspace_resource.go b/internal/services/loganalytics/log_analytics_workspace_resource.go -index b98942039f..6d29439643 100644 +index b98942039f..6f4d9ef6f3 100644 --- a/internal/services/loganalytics/log_analytics_workspace_resource.go +++ b/internal/services/loganalytics/log_analytics_workspace_resource.go -@@ -6,6 +6,8 @@ package loganalytics - import ( - "context" - "fmt" +@@ -11,6 +11,9 @@ import ( + "strings" + "time" + + "github.com/hashicorp/terraform-provider-azurerm/internal/features" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" - "log" - "strconv" - "strings" -@@ -115,7 +117,8 @@ func resourceLogAnalyticsWorkspace() *pluginsdk.Resource { ++ + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" +@@ -115,7 +118,8 @@ func resourceLogAnalyticsWorkspace() *pluginsdk.Resource { string(workspaces.WorkspaceSkuNameEnumStandard), string(workspaces.WorkspaceSkuNameEnumCapacityReservation), "Unlimited", // TODO check if this is actually no longer valid, removed in v28.0.0 of the SDK @@ -1169,18 +990,19 @@ index 61dd7f0622..cd5000e953 100644 "vnet_route_all_enabled": { diff --git a/internal/services/logz/logz_monitor_resource.go b/internal/services/logz/logz_monitor_resource.go -index 4c3ad9df42..c72a31367e 100644 +index 4c3ad9df42..852dc41fd4 100644 --- a/internal/services/logz/logz_monitor_resource.go +++ b/internal/services/logz/logz_monitor_resource.go -@@ -5,6 +5,7 @@ package logz - - import ( - "fmt" -+ "github.com/hashicorp/terraform-provider-azurerm/internal/features" +@@ -8,6 +8,8 @@ import ( "log" "time" -@@ -95,7 +96,8 @@ func resourceLogzMonitor() *pluginsdk.Resource { ++ "github.com/hashicorp/terraform-provider-azurerm/internal/features" ++ + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" +@@ -95,7 +97,8 @@ func resourceLogzMonitor() *pluginsdk.Resource { ValidateFunc: validation.StringInSlice([]string{ "MONTHLY", "WEEKLY", @@ -1190,7 +1012,7 @@ index 4c3ad9df42..c72a31367e 100644 }, "effective_date": { -@@ -112,8 +114,9 @@ func resourceLogzMonitor() *pluginsdk.Resource { +@@ -112,8 +115,9 @@ func resourceLogzMonitor() *pluginsdk.Resource { ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ PlanId100gb14days, @@ -1202,7 +1024,7 @@ index 4c3ad9df42..c72a31367e 100644 }, "usage_type": { -@@ -123,7 +126,8 @@ func resourceLogzMonitor() *pluginsdk.Resource { +@@ -123,7 +127,8 @@ func resourceLogzMonitor() *pluginsdk.Resource { ValidateFunc: validation.StringInSlice([]string{ "PAYG", "COMMITTED", @@ -1244,19 +1066,20 @@ index 520bf65dd8..128cd14f20 100644 "ip_allow_list": { diff --git a/internal/services/monitor/monitor_autoscale_setting_resource.go b/internal/services/monitor/monitor_autoscale_setting_resource.go -index 2766565528..b7af892e01 100644 +index 2766565528..acaa0496c4 100644 --- a/internal/services/monitor/monitor_autoscale_setting_resource.go +++ b/internal/services/monitor/monitor_autoscale_setting_resource.go -@@ -5,6 +5,8 @@ package monitor +@@ -9,6 +9,9 @@ import ( + "strconv" + "time" - import ( - "fmt" + "github.com/hashicorp/terraform-provider-azurerm/internal/features" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" - "log" - "strconv" - "time" -@@ -343,7 +345,8 @@ func resourceMonitorAutoScaleSetting() *pluginsdk.Resource { ++ + "github.com/Azure/go-autorest/autorest/date" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" +@@ -343,7 +346,8 @@ func resourceMonitorAutoScaleSetting() *pluginsdk.Resource { "Friday", "Saturday", "Sunday", @@ -1267,18 +1090,19 @@ index 2766565528..b7af892e01 100644 }, "hours": { diff --git a/internal/services/mssql/mssql_database_resource.go b/internal/services/mssql/mssql_database_resource.go -index f2531818d2..f6b10d8969 100644 +index f2531818d2..bc63a0394c 100644 --- a/internal/services/mssql/mssql_database_resource.go +++ b/internal/services/mssql/mssql_database_resource.go -@@ -6,6 +6,7 @@ package mssql - import ( - "context" - "fmt" -+ "github.com/hashicorp/terraform-provider-azurerm/internal/features" - "log" +@@ -10,6 +10,8 @@ import ( "strings" "time" -@@ -1680,7 +1681,8 @@ func resourceMsSqlDatabaseSchema() map[string]*pluginsdk.Schema { + ++ "github.com/hashicorp/terraform-provider-azurerm/internal/features" ++ + "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/v5.0/sql" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" +@@ -1680,7 +1682,8 @@ func resourceMsSqlDatabaseSchema() map[string]*pluginsdk.Schema { "Sql_Injection", "Sql_Injection_Vulnerability", "Access_Anomaly", @@ -1288,7 +1112,7 @@ index f2531818d2..f6b10d8969 100644 }, }, -@@ -1691,7 +1693,7 @@ func resourceMsSqlDatabaseSchema() map[string]*pluginsdk.Schema { +@@ -1691,7 +1694,7 @@ func resourceMsSqlDatabaseSchema() map[string]*pluginsdk.Schema { Optional: true, Default: EmailAccountAdminsStatusDisabled, ValidateFunc: validation.StringInSlice(PossibleValuesForEmailAccountAdminsStatus(), @@ -1297,7 +1121,7 @@ index f2531818d2..f6b10d8969 100644 }, "email_addresses": { -@@ -1719,7 +1721,7 @@ func resourceMsSqlDatabaseSchema() map[string]*pluginsdk.Schema { +@@ -1719,7 +1722,7 @@ func resourceMsSqlDatabaseSchema() map[string]*pluginsdk.Schema { Optional: true, Default: string(serversecurityalertpolicies.SecurityAlertsPolicyStateDisabled), ValidateFunc: validation.StringInSlice(serversecurityalertpolicies.PossibleValuesForSecurityAlertsPolicyState(), @@ -1307,19 +1131,20 @@ index f2531818d2..f6b10d8969 100644 "storage_account_access_key": { diff --git a/internal/services/mssql/mssql_elasticpool_resource.go b/internal/services/mssql/mssql_elasticpool_resource.go -index a78b061fe0..d484e990ba 100644 +index a78b061fe0..8432341650 100644 --- a/internal/services/mssql/mssql_elasticpool_resource.go +++ b/internal/services/mssql/mssql_elasticpool_resource.go -@@ -6,6 +6,8 @@ package mssql - import ( - "context" - "fmt" -+ "github.com/hashicorp/terraform-provider-azurerm/internal/features" -+ "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" - "log" +@@ -10,6 +10,9 @@ import ( "strings" "time" -@@ -90,7 +92,8 @@ func resourceMsSqlElasticPool() *pluginsdk.Resource { + ++ "github.com/hashicorp/terraform-provider-azurerm/internal/features" ++ "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" ++ + "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/v5.0/sql" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" +@@ -90,7 +93,8 @@ func resourceMsSqlElasticPool() *pluginsdk.Resource { "BC_Gen5", "BC_DC", "HS_Gen5", @@ -1329,7 +1154,7 @@ index a78b061fe0..d484e990ba 100644 }, "capacity": { -@@ -109,7 +112,8 @@ func resourceMsSqlElasticPool() *pluginsdk.Resource { +@@ -109,7 +113,8 @@ func resourceMsSqlElasticPool() *pluginsdk.Resource { "GeneralPurpose", "BusinessCritical", "Hyperscale", @@ -1339,7 +1164,7 @@ index a78b061fe0..d484e990ba 100644 }, "family": { -@@ -120,7 +124,8 @@ func resourceMsSqlElasticPool() *pluginsdk.Resource { +@@ -120,7 +125,8 @@ func resourceMsSqlElasticPool() *pluginsdk.Resource { "Gen5", "Fsv2", "DC", @@ -1350,19 +1175,20 @@ index a78b061fe0..d484e990ba 100644 }, }, diff --git a/internal/services/mssql/mssql_server_security_alert_policy_resource.go b/internal/services/mssql/mssql_server_security_alert_policy_resource.go -index 95a9635019..6cf10653d9 100644 +index 95a9635019..8faaf92a24 100644 --- a/internal/services/mssql/mssql_server_security_alert_policy_resource.go +++ b/internal/services/mssql/mssql_server_security_alert_policy_resource.go -@@ -5,6 +5,8 @@ package mssql - - import ( - "fmt" -+ "github.com/hashicorp/terraform-provider-azurerm/internal/features" -+ "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" +@@ -8,6 +8,9 @@ import ( "log" "time" -@@ -95,7 +97,8 @@ func resourceMsSqlServerSecurityAlertPolicy() *pluginsdk.Resource { ++ "github.com/hashicorp/terraform-provider-azurerm/internal/features" ++ "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" ++ + "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/v5.0/sql" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" +@@ -95,7 +98,8 @@ func resourceMsSqlServerSecurityAlertPolicy() *pluginsdk.Resource { string(sql.SecurityAlertPolicyStateDisabled), string(sql.SecurityAlertPolicyStateEnabled), string(sql.SecurityAlertPolicyStateNew), @@ -1373,27 +1199,28 @@ index 95a9635019..6cf10653d9 100644 "storage_account_access_key": { diff --git a/internal/services/mysql/mysql_server_resource.go b/internal/services/mysql/mysql_server_resource.go -index a7553589e1..8691c8bb72 100644 +index a7553589e1..99c6655b1f 100644 --- a/internal/services/mysql/mysql_server_resource.go +++ b/internal/services/mysql/mysql_server_resource.go -@@ -6,6 +6,8 @@ package mysql - import ( - "context" - "fmt" +@@ -11,6 +11,9 @@ import ( + "strings" + "time" + + "github.com/hashicorp/terraform-provider-azurerm/internal/features" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" - "log" - "strconv" - "strings" -@@ -309,8 +311,9 @@ func resourceMySqlServer() *pluginsdk.Resource { ++ + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" +@@ -309,8 +312,10 @@ func resourceMySqlServer() *pluginsdk.Resource { ValidateFunc: validation.StringInSlice([]string{ string(servers.ServerVersionFivePointSeven), string(servers.ServerVersionEightPointZero), - }, false), -- ForceNew: true, + }, features.CaseInsensitive()), + ForceNew: true, ++ // FORK: Force attributes to maintain case-insensitivity to avoid breaking changes in Pulumi programs. + DiffSuppressFunc: suppress.CaseDifferenceV2Only, -+ ForceNew: true, }, }, @@ -1525,24 +1352,20 @@ index b500b50239..4896bd84aa 100644 }, }, diff --git a/internal/services/network/network_security_group_resource.go b/internal/services/network/network_security_group_resource.go -index 668ca0a8d1..a5531c00ba 100644 +index 668ca0a8d1..aa6a9a9936 100644 --- a/internal/services/network/network_security_group_resource.go +++ b/internal/services/network/network_security_group_resource.go -@@ -13,11 +13,13 @@ import ( - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" - "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" - "github.com/hashicorp/terraform-provider-azurerm/internal/clients" +@@ -8,6 +8,9 @@ import ( + "strings" + "time" + + "github.com/hashicorp/terraform-provider-azurerm/internal/features" - "github.com/hashicorp/terraform-provider-azurerm/internal/locks" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/set" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" - "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" -@@ -84,7 +86,8 @@ func resourceNetworkSecurityGroup() *pluginsdk.Resource { ++ + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + multierror "github.com/hashicorp/go-multierror" + "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" +@@ -84,7 +87,8 @@ func resourceNetworkSecurityGroup() *pluginsdk.Resource { string(network.SecurityRuleProtocolIcmp), string(network.SecurityRuleProtocolAh), string(network.SecurityRuleProtocolEsp), @@ -1552,7 +1375,7 @@ index 668ca0a8d1..a5531c00ba 100644 }, "source_port_range": { -@@ -155,7 +158,8 @@ func resourceNetworkSecurityGroup() *pluginsdk.Resource { +@@ -155,7 +159,8 @@ func resourceNetworkSecurityGroup() *pluginsdk.Resource { ValidateFunc: validation.StringInSlice([]string{ string(network.SecurityRuleAccessAllow), string(network.SecurityRuleAccessDeny), @@ -1562,7 +1385,7 @@ index 668ca0a8d1..a5531c00ba 100644 }, "priority": { -@@ -170,7 +174,8 @@ func resourceNetworkSecurityGroup() *pluginsdk.Resource { +@@ -170,7 +175,8 @@ func resourceNetworkSecurityGroup() *pluginsdk.Resource { ValidateFunc: validation.StringInSlice([]string{ string(network.SecurityRuleDirectionInbound), string(network.SecurityRuleDirectionOutbound), @@ -1573,20 +1396,20 @@ index 668ca0a8d1..a5531c00ba 100644 }, }, diff --git a/internal/services/network/network_security_rule_resource.go b/internal/services/network/network_security_rule_resource.go -index d1af54365a..3fb960d1bb 100644 +index d1af54365a..800adca50c 100644 --- a/internal/services/network/network_security_rule_resource.go +++ b/internal/services/network/network_security_rule_resource.go -@@ -14,7 +14,9 @@ import ( - "github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-09-01/securityrules" - "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" - "github.com/hashicorp/terraform-provider-azurerm/internal/clients" +@@ -8,6 +8,9 @@ import ( + "strings" + "time" + + "github.com/hashicorp/terraform-provider-azurerm/internal/features" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" - "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" -@@ -70,7 +72,8 @@ func resourceNetworkSecurityRule() *pluginsdk.Resource { ++ + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" +@@ -70,7 +73,8 @@ func resourceNetworkSecurityRule() *pluginsdk.Resource { string(securityrules.SecurityRuleProtocolIcmp), string(securityrules.SecurityRuleProtocolAh), string(securityrules.SecurityRuleProtocolEsp), @@ -1596,25 +1419,7 @@ index d1af54365a..3fb960d1bb 100644 }, "source_port_range": { -@@ -132,7 +135,7 @@ func resourceNetworkSecurityRule() *pluginsdk.Resource { - //lintignore:S018 - "source_application_security_group_ids": { - Type: pluginsdk.TypeSet, -- MaxItems: 10, -+ MaxItems: 1, - Optional: true, - Elem: &pluginsdk.Schema{Type: pluginsdk.TypeString}, - Set: pluginsdk.HashString, -@@ -141,7 +144,7 @@ func resourceNetworkSecurityRule() *pluginsdk.Resource { - //lintignore:S018 - "destination_application_security_group_ids": { - Type: pluginsdk.TypeSet, -- MaxItems: 10, -+ MaxItems: 1, - Optional: true, - Elem: &pluginsdk.Schema{Type: pluginsdk.TypeString}, - Set: pluginsdk.HashString, -@@ -153,7 +156,8 @@ func resourceNetworkSecurityRule() *pluginsdk.Resource { +@@ -153,7 +157,8 @@ func resourceNetworkSecurityRule() *pluginsdk.Resource { ValidateFunc: validation.StringInSlice([]string{ string(securityrules.SecurityRuleAccessAllow), string(securityrules.SecurityRuleAccessDeny), @@ -1624,7 +1429,7 @@ index d1af54365a..3fb960d1bb 100644 }, "priority": { -@@ -168,7 +172,8 @@ func resourceNetworkSecurityRule() *pluginsdk.Resource { +@@ -168,7 +173,8 @@ func resourceNetworkSecurityRule() *pluginsdk.Resource { ValidateFunc: validation.StringInSlice([]string{ string(securityrules.SecurityRuleDirectionInbound), string(securityrules.SecurityRuleDirectionOutbound), @@ -1635,73 +1440,53 @@ index d1af54365a..3fb960d1bb 100644 }, } diff --git a/internal/services/network/public_ip_prefix_resource.go b/internal/services/network/public_ip_prefix_resource.go -index f0f001ff61..d909b00794 100644 +index f0f001ff61..7f14b48178 100644 --- a/internal/services/network/public_ip_prefix_resource.go +++ b/internal/services/network/public_ip_prefix_resource.go -@@ -5,6 +5,8 @@ package network - - import ( - "fmt" -+ "github.com/hashicorp/terraform-provider-azurerm/internal/features" -+ "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" +@@ -8,6 +8,9 @@ import ( "log" "time" -@@ -73,14 +75,15 @@ func resourcePublicIpPrefix() *pluginsdk.Resource { - }, - - "ip_version": { -- Type: pluginsdk.TypeString, -- Optional: true, -- Default: string(network.IPVersionIPv4), -- ForceNew: true, -+ Type: pluginsdk.TypeString, -+ Optional: true, -+ Default: string(network.IPVersionIPv4), -+ ForceNew: true, -+ DiffSuppressFunc: suppress.CaseDifferenceV2Only, ++ "github.com/hashicorp/terraform-provider-azurerm/internal/features" ++ "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" ++ + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +@@ -80,7 +83,8 @@ func resourcePublicIpPrefix() *pluginsdk.Resource { ValidateFunc: validation.StringInSlice([]string{ string(network.IPVersionIPv4), string(network.IPVersionIPv6), - }, false), + }, features.CaseInsensitive()), ++ DiffSuppressFunc: suppress.CaseDifferenceV2Only, }, "zones": commonschema.ZonesMultipleOptionalForceNew(), diff --git a/internal/services/network/public_ip_resource.go b/internal/services/network/public_ip_resource.go -index 783d4697cc..f29ea8b4da 100644 +index 783d4697cc..0b6021265d 100644 --- a/internal/services/network/public_ip_resource.go +++ b/internal/services/network/public_ip_resource.go -@@ -5,6 +5,7 @@ package network - - import ( - "fmt" -+ "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" - "log" +@@ -9,6 +9,8 @@ import ( "strings" "time" -@@ -89,14 +90,15 @@ func resourcePublicIp() *pluginsdk.Resource { - "edge_zone": commonschema.EdgeZoneOptionalForceNew(), - - "ip_version": { -- Type: pluginsdk.TypeString, -- Optional: true, -- Default: string(network.IPVersionIPv4), -- ForceNew: true, -+ Type: pluginsdk.TypeString, -+ Optional: true, -+ Default: string(network.IPVersionIPv4), -+ ForceNew: true, -+ DiffSuppressFunc: suppress.CaseDifferenceV2Only, + ++ "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" ++ + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +@@ -96,7 +98,8 @@ func resourcePublicIp() *pluginsdk.Resource { ValidateFunc: validation.StringInSlice([]string{ string(network.IPVersionIPv4), string(network.IPVersionIPv6), - }, false), + }, features.CaseInsensitive()), ++ DiffSuppressFunc: suppress.CaseDifferenceV2Only, }, "sku": { -@@ -113,7 +115,7 @@ func resourcePublicIp() *pluginsdk.Resource { +@@ -113,7 +116,7 @@ func resourcePublicIp() *pluginsdk.Resource { ValidateFunc: validation.StringInSlice([]string{ string(network.PublicIPAddressSkuNameBasic), string(network.PublicIPAddressSkuNameStandard), @@ -1734,21 +1519,20 @@ index 948650490b..9fba7427fd 100644 "next_hop_in_ip_address": { diff --git a/internal/services/network/route_table_resource.go b/internal/services/network/route_table_resource.go -index 426dcd90a5..d4da8f1051 100644 +index 426dcd90a5..26c04e4e80 100644 --- a/internal/services/network/route_table_resource.go +++ b/internal/services/network/route_table_resource.go -@@ -15,8 +15,10 @@ import ( - "github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-09-01/routetables" - "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" - "github.com/hashicorp/terraform-provider-azurerm/internal/clients" +@@ -7,6 +7,9 @@ import ( + "fmt" + "time" + + "github.com/hashicorp/terraform-provider-azurerm/internal/features" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" - "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" -@@ -83,7 +85,8 @@ func resourceRouteTable() *pluginsdk.Resource { ++ + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" +@@ -83,7 +86,8 @@ func resourceRouteTable() *pluginsdk.Resource { string(routetables.RouteNextHopTypeInternet), string(routetables.RouteNextHopTypeVirtualAppliance), string(routetables.RouteNextHopTypeNone), @@ -1917,55 +1701,21 @@ index a159838239..91f3791833 100644 }, "mode": { -diff --git a/internal/services/portal/portal_dashboard_resource_test.go b/internal/services/portal/portal_dashboard_resource_test.go -index f5a509fd86..03b6351a59 100644 ---- a/internal/services/portal/portal_dashboard_resource_test.go -+++ b/internal/services/portal/portal_dashboard_resource_test.go -@@ -75,6 +75,7 @@ func (PortalDashboardResource) Exists(ctx context.Context, clients *clients.Clie - } - - func (PortalDashboardResource) basic(data acceptance.TestData) string { -+ resourceName := "azurerm_portal_dashboard" - return fmt.Sprintf(` - provider "azurerm" { - features {} -@@ -96,10 +97,12 @@ resource "azurerm_portal_dashboard" "test" { - } - DASH - } --`, data.RandomInteger, data.Locations.Primary) -+`, data.RandomInteger, data.Locations.Primary, resourceName) - } - - func (PortalDashboardResource) complete(data acceptance.TestData) string { -+ resourceName := "azurerm_portal_dashboard" -+ - return fmt.Sprintf(` - provider "azurerm" { - features {} -@@ -150,7 +153,7 @@ resource "azurerm_portal_dashboard" "test" { - } - DASH - } --`, data.RandomInteger, data.Locations.Primary) -+`, data.RandomInteger, data.Locations.Primary, resourceName) - } - - func (PortalDashboardResource) hiddenTitle(data acceptance.TestData) string { diff --git a/internal/services/postgres/postgresql_server_resource.go b/internal/services/postgres/postgresql_server_resource.go -index d68d5963fa..5da4ee2bdc 100644 +index d68d5963fa..90dd2bfc33 100644 --- a/internal/services/postgres/postgresql_server_resource.go +++ b/internal/services/postgres/postgresql_server_resource.go -@@ -6,6 +6,8 @@ package postgres - import ( - "context" - "fmt" +@@ -11,6 +11,9 @@ import ( + "strings" + "time" + + "github.com/hashicorp/terraform-provider-azurerm/internal/features" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" - "log" - "strconv" - "strings" -@@ -133,10 +135,12 @@ func resourcePostgreSQLServer() *pluginsdk.Resource { ++ + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" +@@ -133,10 +136,12 @@ func resourcePostgreSQLServer() *pluginsdk.Resource { }, "version": { @@ -2070,26 +1820,20 @@ index ff302107f2..a8916e78f2 100644 "name": { diff --git a/internal/services/resource/template_deployment_resource.go b/internal/services/resource/template_deployment_resource.go -index 7cb0c666d8..2bbe3566f2 100644 +index 7cb0c666d8..bedb1e8223 100644 --- a/internal/services/resource/template_deployment_resource.go +++ b/internal/services/resource/template_deployment_resource.go -@@ -7,6 +7,7 @@ import ( - "context" - "encoding/json" - "fmt" -+ "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" - "log" - "strconv" +@@ -12,6 +12,9 @@ import ( "strings" -@@ -16,6 +17,7 @@ import ( + "time" + ++ "github.com/hashicorp/terraform-provider-azurerm/internal/features" ++ "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" ++ + "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2020-06-01/resources" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "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/services/resource/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" -@@ -83,7 +85,8 @@ func resourceTemplateDeployment() *pluginsdk.Resource { +@@ -83,7 +86,8 @@ func resourceTemplateDeployment() *pluginsdk.Resource { ValidateFunc: validation.StringInSlice([]string{ string(resources.DeploymentModeComplete), string(resources.DeploymentModeIncremental), @@ -2142,18 +1886,6 @@ index 0756a64ade..e4b858a999 100644 }, }, }, -diff --git a/internal/services/securitycenter/security_center_server_vulnerability_assessment_resource.go b/internal/services/securitycenter/security_center_server_vulnerability_assessment_resource.go -index 693259db60..fa44554cd1 100644 ---- a/internal/services/securitycenter/security_center_server_vulnerability_assessment_resource.go -+++ b/internal/services/securitycenter/security_center_server_vulnerability_assessment_resource.go -@@ -26,6 +26,7 @@ const ( - hybridMachineProvider = "Microsoft.HybridCompute" - ) - -+// TODO: 3.0 - split this into two resources for VM and HybridVM - func resourceServerVulnerabilityAssessment() *pluginsdk.Resource { - return &pluginsdk.Resource{ - Create: resourceServerVulnerabilityAssessmentCreate, diff --git a/internal/services/servicebus/servicebus_namespace_resource.go b/internal/services/servicebus/servicebus_namespace_resource.go index 56fa2647cb..b03bdc1fa8 100644 --- a/internal/services/servicebus/servicebus_namespace_resource.go @@ -2168,45 +1900,6 @@ index 56fa2647cb..b03bdc1fa8 100644 }, "capacity": { -diff --git a/internal/services/servicebus/servicebus_queue_resource.go b/internal/services/servicebus/servicebus_queue_resource.go -index fd6bafbc15..892ca423b4 100644 ---- a/internal/services/servicebus/servicebus_queue_resource.go -+++ b/internal/services/servicebus/servicebus_queue_resource.go -@@ -46,6 +46,8 @@ func resourceServiceBusQueue() *pluginsdk.Resource { - } - } - -+// FORK: @stack72: Ensured the ResourceGroupName and NamespaceName was available as a computed attribute for use -+// in the servicebus mixins in Pulumi - func resourceServicebusQueueSchema() map[string]*pluginsdk.Schema { - return map[string]*pluginsdk.Schema{ - "name": { -@@ -166,6 +168,16 @@ func resourceServicebusQueueSchema() map[string]*pluginsdk.Schema { - ForceNew: true, - }, - -+ "resource_group_name": { -+ Type: pluginsdk.TypeString, -+ Computed: true, -+ }, -+ -+ "namespace_name": { -+ Type: pluginsdk.TypeString, -+ Computed: true, -+ }, -+ - "status": { - Type: pluginsdk.TypeString, - Optional: true, -@@ -375,6 +387,8 @@ func resourceServiceBusQueueRead(d *pluginsdk.ResourceData, meta interface{}) er - - d.Set("name", id.QueueName) - d.Set("namespace_id", namespaceId.ID()) -+ d.Set("resource_group_name", id.ResourceGroupName) -+ d.Set("namespace_name", id.NamespaceName) - - if model := resp.Model; model != nil { - if props := model.Properties; props != nil { diff --git a/internal/services/servicebus/servicebus_subscription_rule_resource.go b/internal/services/servicebus/servicebus_subscription_rule_resource.go index a4db7728d8..d0bbf2ec2f 100644 --- a/internal/services/servicebus/servicebus_subscription_rule_resource.go @@ -2230,7 +1923,7 @@ index a4db7728d8..d0bbf2ec2f 100644 "action": { diff --git a/internal/services/servicebus/servicebus_topic_resource.go b/internal/services/servicebus/servicebus_topic_resource.go -index 7c2cdadb04..0b18171b8f 100644 +index 7c2cdadb04..b661a5e54a 100644 --- a/internal/services/servicebus/servicebus_topic_resource.go +++ b/internal/services/servicebus/servicebus_topic_resource.go @@ -5,6 +5,8 @@ package servicebus @@ -2242,16 +1935,7 @@ index 7c2cdadb04..0b18171b8f 100644 "log" "time" -@@ -44,6 +46,8 @@ func resourceServiceBusTopic() *pluginsdk.Resource { - } - } - -+// FORK: @stack72: Ensured the ResourceGroupName and NamespaceName was available as a computed attribute for use -+// in the servicebus mixins in Pulumi - func resourceServiceBusTopicSchema() map[string]*pluginsdk.Schema { - return map[string]*pluginsdk.Schema{ - "name": { -@@ -68,7 +72,8 @@ func resourceServiceBusTopicSchema() map[string]*pluginsdk.Schema { +@@ -68,7 +70,8 @@ func resourceServiceBusTopicSchema() map[string]*pluginsdk.Schema { ValidateFunc: validation.StringInSlice([]string{ string(topics.EntityStatusActive), string(topics.EntityStatusDisabled), @@ -2261,47 +1945,20 @@ index 7c2cdadb04..0b18171b8f 100644 }, "auto_delete_on_idle": { -@@ -135,6 +140,16 @@ func resourceServiceBusTopicSchema() map[string]*pluginsdk.Schema { - Type: pluginsdk.TypeBool, - Optional: true, - }, -+ -+ "resource_group_name": { -+ Type: pluginsdk.TypeString, -+ Computed: true, -+ }, -+ -+ "namespace_name": { -+ Type: pluginsdk.TypeString, -+ Computed: true, -+ }, - } - } - -@@ -240,6 +255,10 @@ func resourceServiceBusTopicRead(d *pluginsdk.ResourceData, meta interface{}) er - d.Set("name", id.TopicName) - d.Set("namespace_id", topics.NewNamespaceID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName).ID()) - -+ // FORK: We must maintain these properties in order to keep Pulumi mixins working. -+ d.Set("namespace_name", id.NamespaceName) -+ d.Set("resource_group_name", id.ResourceGroupName) -+ - if model := resp.Model; model != nil { - if props := model.Properties; props != nil { - status := "" diff --git a/internal/services/sql/sql_database_resource.go b/internal/services/sql/sql_database_resource.go -index 8fab920f07..1ca7f6154d 100644 +index 8fab920f07..73ffbe68b9 100644 --- a/internal/services/sql/sql_database_resource.go +++ b/internal/services/sql/sql_database_resource.go -@@ -17,6 +17,7 @@ import ( - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" - "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" - "github.com/hashicorp/terraform-provider-azurerm/internal/clients" +@@ -10,6 +10,8 @@ import ( + "strings" + "time" + + "github.com/hashicorp/terraform-provider-azurerm/internal/features" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" -@@ -470,7 +471,7 @@ func resourceSqlDatabaseSchema() map[string]*pluginsdk.Schema { ++ + "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2017-03-01-preview/sql" // nolint: staticcheck + "github.com/Azure/go-autorest/autorest/date" + "github.com/gofrs/uuid" +@@ -470,7 +472,7 @@ func resourceSqlDatabaseSchema() map[string]*pluginsdk.Schema { string(sql.CreateModeRecovery), string(sql.CreateModeRestore), string(sql.CreateModeRestoreLongTermRetentionBackup), @@ -2310,7 +1967,7 @@ index 8fab920f07..1ca7f6154d 100644 }, "import": { -@@ -494,7 +495,7 @@ func resourceSqlDatabaseSchema() map[string]*pluginsdk.Schema { +@@ -494,7 +496,7 @@ func resourceSqlDatabaseSchema() map[string]*pluginsdk.Schema { ValidateFunc: validation.StringInSlice([]string{ "StorageAccessKey", "SharedAccessKey", @@ -2319,7 +1976,7 @@ index 8fab920f07..1ca7f6154d 100644 }, "administrator_login": { Type: pluginsdk.TypeString, -@@ -511,7 +512,7 @@ func resourceSqlDatabaseSchema() map[string]*pluginsdk.Schema { +@@ -511,7 +513,7 @@ func resourceSqlDatabaseSchema() map[string]*pluginsdk.Schema { ValidateFunc: validation.StringInSlice([]string{ "ADPassword", "SQL", @@ -2328,7 +1985,7 @@ index 8fab920f07..1ca7f6154d 100644 }, "operation_mode": { Type: pluginsdk.TypeString, -@@ -519,7 +520,7 @@ func resourceSqlDatabaseSchema() map[string]*pluginsdk.Schema { +@@ -519,7 +521,7 @@ func resourceSqlDatabaseSchema() map[string]*pluginsdk.Schema { Default: "Import", ValidateFunc: validation.StringInSlice([]string{ "Import", @@ -2337,7 +1994,7 @@ index 8fab920f07..1ca7f6154d 100644 }, }, }, -@@ -557,7 +558,7 @@ func resourceSqlDatabaseSchema() map[string]*pluginsdk.Schema { +@@ -557,7 +559,7 @@ func resourceSqlDatabaseSchema() map[string]*pluginsdk.Schema { string(sql.System), string(sql.System2), string(sql.Web), @@ -2346,7 +2003,7 @@ index 8fab920f07..1ca7f6154d 100644 }, "collation": { -@@ -642,7 +643,8 @@ func resourceSqlDatabaseSchema() map[string]*pluginsdk.Schema { +@@ -642,7 +644,8 @@ func resourceSqlDatabaseSchema() map[string]*pluginsdk.Schema { "Sql_Injection", "Sql_Injection_Vulnerability", "Access_Anomaly", @@ -2356,7 +2013,7 @@ index 8fab920f07..1ca7f6154d 100644 }, }, -@@ -653,7 +655,7 @@ func resourceSqlDatabaseSchema() map[string]*pluginsdk.Schema { +@@ -653,7 +656,7 @@ func resourceSqlDatabaseSchema() map[string]*pluginsdk.Schema { ValidateFunc: validation.StringInSlice([]string{ string(sql.SecurityAlertPolicyEmailAccountAdminsDisabled), string(sql.SecurityAlertPolicyEmailAccountAdminsEnabled), @@ -2365,7 +2022,7 @@ index 8fab920f07..1ca7f6154d 100644 }, "email_addresses": { -@@ -679,7 +681,7 @@ func resourceSqlDatabaseSchema() map[string]*pluginsdk.Schema { +@@ -679,7 +682,7 @@ func resourceSqlDatabaseSchema() map[string]*pluginsdk.Schema { string(sql.SecurityAlertPolicyStateDisabled), string(sql.SecurityAlertPolicyStateEnabled), string(sql.SecurityAlertPolicyStateNew), @@ -2429,49 +2086,6 @@ index 16797800a2..6d74e94b4f 100644 }, "storage_account_access_key": { -diff --git a/internal/services/storage/storage_account_data_source.go b/internal/services/storage/storage_account_data_source.go -index b215edff58..4381151544 100644 ---- a/internal/services/storage/storage_account_data_source.go -+++ b/internal/services/storage/storage_account_data_source.go -@@ -37,7 +37,8 @@ func dataSourceStorageAccount() *pluginsdk.Resource { - ValidateFunc: validate.StorageAccountName, - }, - -- "resource_group_name": commonschema.ResourceGroupNameForDataSource(), -+ // Fork: Ensuring that ResourceGroupName is optional when getting a storage account -+ "resource_group_name": commonschema.ResourceGroupNameOptional(), - - "location": commonschema.LocationComputed(), - -@@ -534,11 +535,28 @@ func dataSourceStorageAccount() *pluginsdk.Resource { - } - - func dataSourceStorageAccountRead(d *pluginsdk.ResourceData, meta interface{}) error { -+ storageClient := meta.(*clients.Client).Storage - client := meta.(*clients.Client).Storage.AccountsClient - subscriptionId := meta.(*clients.Client).Account.SubscriptionId - ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) - defer cancel() - -+ name := d.Get("name").(string) -+ var resourceGroup string -+ if rg, ok := d.GetOk("resource_group_name"); ok { -+ resourceGroup = rg.(string) -+ } else { -+ account, err := storageClient.FindAccount(ctx, subscriptionId, name) -+ if err != nil { -+ return fmt.Errorf("Error retrieving Account %q: %s", name, err) -+ } -+ if account == nil { -+ return fmt.Errorf("Unable to locate Account %q", name) -+ } -+ resourceGroup = account.StorageAccountId.ResourceGroupName -+ d.Set("resource_group_name", resourceGroup) -+ } -+ - storageDomainSuffix, ok := meta.(*clients.Client).Account.Environment.Storage.DomainSuffix() - if !ok { - return fmt.Errorf("could not determine Storage domain suffix for environment %q", meta.(*clients.Client).Account.Environment.Name) diff --git a/internal/services/storage/storage_account_resource.go b/internal/services/storage/storage_account_resource.go index 8e4d3eae4a..351df0b49a 100644 --- a/internal/services/storage/storage_account_resource.go @@ -2538,24 +2152,6 @@ index 8e4d3eae4a..351df0b49a 100644 }, Set: pluginsdk.HashString, }, -diff --git a/internal/services/storage/storage_management_policy_resource.go b/internal/services/storage/storage_management_policy_resource.go -index c90910e01c..1e3e9900e2 100644 ---- a/internal/services/storage/storage_management_policy_resource.go -+++ b/internal/services/storage/storage_management_policy_resource.go -@@ -138,10 +138,9 @@ func resourceStorageManagementPolicy() *pluginsdk.Resource { - ValidateFunc: validation.IntBetween(0, 99999), - }, - "tier_to_cool_after_days_since_last_access_time_greater_than": { -- Type: pluginsdk.TypeInt, -- Optional: true, -- Default: -1, -- ValidateFunc: validation.IntBetween(0, 99999), -+ Type: pluginsdk.TypeInt, -+ Optional: true, -+ Default: -1, - }, - "auto_tier_to_hot_from_cool_enabled": { - Type: pluginsdk.TypeBool, diff --git a/internal/services/synapse/synapse_sql_pool_security_alert_policy_resource.go b/internal/services/synapse/synapse_sql_pool_security_alert_policy_resource.go index bdbad438b2..992f5ac5ab 100644 --- a/internal/services/synapse/synapse_sql_pool_security_alert_policy_resource.go @@ -2636,19 +2232,20 @@ index 88fa114d68..0e395b4046 100644 "port": { diff --git a/internal/services/web/app_service.go b/internal/services/web/app_service.go -index f5dac4de88..e85775dadd 100644 +index f5dac4de88..c60cc1d850 100644 --- a/internal/services/web/app_service.go +++ b/internal/services/web/app_service.go -@@ -5,6 +5,8 @@ package web - - import ( - "fmt" -+ "github.com/hashicorp/terraform-provider-azurerm/internal/features" -+ "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" +@@ -8,6 +8,9 @@ import ( "log" "strings" -@@ -261,7 +263,8 @@ func schemaAppServiceSiteConfig() *pluginsdk.Schema { ++ "github.com/hashicorp/terraform-provider-azurerm/internal/features" ++ "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" ++ + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +@@ -261,7 +264,8 @@ func schemaAppServiceSiteConfig() *pluginsdk.Schema { "v4.0", "v5.0", "v6.0", @@ -2658,7 +2255,7 @@ index f5dac4de88..e85775dadd 100644 }, "http2_enabled": { -@@ -293,7 +296,8 @@ func schemaAppServiceSiteConfig() *pluginsdk.Schema { +@@ -293,7 +297,8 @@ func schemaAppServiceSiteConfig() *pluginsdk.Schema { "JAVA", "JETTY", "TOMCAT", @@ -2668,7 +2265,7 @@ index f5dac4de88..e85775dadd 100644 }, "java_container_version": { -@@ -314,7 +318,8 @@ func schemaAppServiceSiteConfig() *pluginsdk.Schema { +@@ -314,7 +319,8 @@ func schemaAppServiceSiteConfig() *pluginsdk.Schema { ValidateFunc: validation.StringInSlice([]string{ string(web.ManagedPipelineModeClassic), string(web.ManagedPipelineModeIntegrated), @@ -2678,20 +2275,14 @@ index f5dac4de88..e85775dadd 100644 }, "php_version": { -@@ -347,9 +352,10 @@ func schemaAppServiceSiteConfig() *pluginsdk.Schema { - }, - - "remote_debugging_version": { -- Type: pluginsdk.TypeString, -- Optional: true, -- Computed: true, -+ Type: pluginsdk.TypeString, -+ Optional: true, -+ Computed: true, -+ DiffSuppressFunc: suppress.CaseDifferenceV2Only, - ValidateFunc: validation.StringInSlice([]string{ +@@ -354,6 +360,7 @@ func schemaAppServiceSiteConfig() *pluginsdk.Schema { "VS2017", "VS2019", + }, false), ++ DiffSuppressFunc: suppress.CaseDifferenceV2Only, + }, + + "scm_type": { diff --git a/internal/services/web/app_service_certificate_order_resource.go b/internal/services/web/app_service_certificate_order_resource.go index cf219be2e2..de18a1e028 100644 --- a/internal/services/web/app_service_certificate_order_resource.go @@ -2736,59 +2327,17 @@ index c3dfeff2cf..86a94c195d 100644 }, "vnet_route_all_enabled": { -diff --git a/internal/services/web/function_app_slot_resource.go b/internal/services/web/function_app_slot_resource.go -index baaf28b822..ec0522f4b1 100644 ---- a/internal/services/web/function_app_slot_resource.go -+++ b/internal/services/web/function_app_slot_resource.go -@@ -259,6 +259,7 @@ func resourceFunctionAppSlotCreate(d *pluginsdk.ResourceData, meta interface{}) - - appServicePlanID := d.Get("app_service_plan_id").(string) - enabled := d.Get("enabled").(bool) -+ clientAffinityEnabled := d.Get("client_affinity_enabled").(bool) - httpsOnly := d.Get("https_only").(bool) - dailyMemoryTimeQuota := d.Get("daily_memory_time_quota").(int) - t := d.Get("tags").(map[string]interface{}) -@@ -281,11 +282,12 @@ func resourceFunctionAppSlotCreate(d *pluginsdk.ResourceData, meta interface{}) - Location: &location, - Tags: tags.Expand(t), - SiteProperties: &web.SiteProperties{ -- ServerFarmID: utils.String(appServicePlanID), -- Enabled: utils.Bool(enabled), -- HTTPSOnly: utils.Bool(httpsOnly), -- DailyMemoryTimeQuota: utils.Int32(int32(dailyMemoryTimeQuota)), -- SiteConfig: &siteConfig, -+ ServerFarmID: utils.String(appServicePlanID), -+ Enabled: utils.Bool(enabled), -+ ClientAffinityEnabled: utils.Bool(clientAffinityEnabled), -+ HTTPSOnly: utils.Bool(httpsOnly), -+ DailyMemoryTimeQuota: utils.Int32(int32(dailyMemoryTimeQuota)), -+ SiteConfig: &siteConfig, - }, - } - -@@ -349,6 +351,7 @@ func resourceFunctionAppSlotUpdate(d *pluginsdk.ResourceData, meta interface{}) - } - appServicePlanID := d.Get("app_service_plan_id").(string) - enabled := d.Get("enabled").(bool) -+ clientAffinityEnabled := d.Get("client_affinity_enabled").(bool) - httpsOnly := d.Get("https_only").(bool) - dailyMemoryTimeQuota := d.Get("daily_memory_time_quota").(int) - t := d.Get("tags").(map[string]interface{}) -@@ -381,11 +384,12 @@ func resourceFunctionAppSlotUpdate(d *pluginsdk.ResourceData, meta interface{}) - Location: &location, - Tags: tags.Expand(t), - SiteProperties: &web.SiteProperties{ -- ServerFarmID: utils.String(appServicePlanID), -- Enabled: utils.Bool(enabled), -- HTTPSOnly: utils.Bool(httpsOnly), -- DailyMemoryTimeQuota: utils.Int32(int32(dailyMemoryTimeQuota)), -- SiteConfig: &siteConfig, -+ ServerFarmID: utils.String(appServicePlanID), -+ Enabled: utils.Bool(enabled), -+ ClientAffinityEnabled: utils.Bool(clientAffinityEnabled), -+ HTTPSOnly: utils.Bool(httpsOnly), -+ DailyMemoryTimeQuota: utils.Int32(int32(dailyMemoryTimeQuota)), -+ SiteConfig: &siteConfig, - }, - } - +diff --git a/internal/tf/suppress/deprecated_soon.go b/internal/tf/suppress/deprecated_soon.go +index 926f57f880..815f6e3006 100644 +--- a/internal/tf/suppress/deprecated_soon.go ++++ b/internal/tf/suppress/deprecated_soon.go +@@ -17,3 +17,9 @@ func CaseDifference(_, old, new string, _ *schema.ResourceData) bool { + // fields should be case-sensitive, normalize the Azure Resource ID in the Read if required + return strings.EqualFold(old, new) + } ++ ++// CaseDifferenceV2Only only suppress case difference for v2.0. ++func CaseDifferenceV2Only(_, old, new string, _ *schema.ResourceData) bool { ++ // FORK: Force attributes to maintain case-insensitivity to avoid breaking changes in Pulumi programs. ++ return strings.EqualFold(old, new) ++} diff --git a/patches/0010-Remove-vm-platform_fault_domain-required_with.patch b/patches/0010-Remove-vm-platform_fault_domain-required_with.patch new file mode 100644 index 0000000000..8d0d6b7502 --- /dev/null +++ b/patches/0010-Remove-vm-platform_fault_domain-required_with.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Bradley +Date: Wed, 22 May 2024 13:22:11 +0100 +Subject: [PATCH] Remove vm platform_fault_domain required_with + +Applies to both Windows and Linux. + +diff --git a/internal/services/compute/linux_virtual_machine_resource.go b/internal/services/compute/linux_virtual_machine_resource.go +index fdeed2c65d..b44f7e29d8 100644 +--- a/internal/services/compute/linux_virtual_machine_resource.go ++++ b/internal/services/compute/linux_virtual_machine_resource.go +@@ -372,7 +372,6 @@ func resourceLinuxVirtualMachine() *pluginsdk.Resource { + Optional: true, + Default: -1, + ForceNew: true, +- RequiredWith: []string{"virtual_machine_scale_set_id"}, + ValidateFunc: validation.IntAtLeast(-1), + }, + +diff --git a/internal/services/compute/windows_virtual_machine_resource.go b/internal/services/compute/windows_virtual_machine_resource.go +index 4c6030c160..e89e0f6de2 100644 +--- a/internal/services/compute/windows_virtual_machine_resource.go ++++ b/internal/services/compute/windows_virtual_machine_resource.go +@@ -387,7 +387,6 @@ func resourceWindowsVirtualMachine() *pluginsdk.Resource { + Optional: true, + Default: -1, + ForceNew: true, +- RequiredWith: []string{"virtual_machine_scale_set_id"}, + ValidateFunc: validation.IntAtLeast(-1), + }, + diff --git a/patches/0011-Remove-function_app_schema-use_dotnet_isolated_runti.patch b/patches/0011-Remove-function_app_schema-use_dotnet_isolated_runti.patch new file mode 100644 index 0000000000..f4650a8cb4 --- /dev/null +++ b/patches/0011-Remove-function_app_schema-use_dotnet_isolated_runti.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Bradley +Date: Wed, 22 May 2024 13:23:07 +0100 +Subject: [PATCH] Remove function_app_schema use_dotnet_isolated_runtime + default + + +diff --git a/internal/services/appservice/helpers/function_app_schema.go b/internal/services/appservice/helpers/function_app_schema.go +index 06b5fa4d90..bdda339536 100644 +--- a/internal/services/appservice/helpers/function_app_schema.go ++++ b/internal/services/appservice/helpers/function_app_schema.go +@@ -1059,10 +1059,11 @@ func linuxFunctionAppStackSchema() *pluginsdk.Schema { + Description: "The version of .Net. Possible values are `3.1`, `6.0` and `7.0`", + }, + ++ // FORK: Removed default value due to pulumi-azure#1227 ++ // These modifications can be removed once pulumi-terraform-bridge#577 is fixed. + "use_dotnet_isolated_runtime": { + Type: pluginsdk.TypeBool, + Optional: true, +- Default: false, + ConflictsWith: []string{ + "site_config.0.application_stack.0.python_version", + "site_config.0.application_stack.0.java_version", diff --git a/patches/0012-Avoid-ordering-container-registry-georeplications.patch b/patches/0012-Avoid-ordering-container-registry-georeplications.patch new file mode 100644 index 0000000000..ab1163f2ba --- /dev/null +++ b/patches/0012-Avoid-ordering-container-registry-georeplications.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Bradley +Date: Wed, 22 May 2024 13:25:24 +0100 +Subject: [PATCH] Avoid ordering container registry georeplications + +This looks like it might have been removed in error due to a bad merge at some point. + +diff --git a/internal/services/containers/container_registry_resource.go b/internal/services/containers/container_registry_resource.go +index b4421f2947..0eb8adf83a 100644 +--- a/internal/services/containers/container_registry_resource.go ++++ b/internal/services/containers/container_registry_resource.go +@@ -7,7 +7,6 @@ import ( + "context" + "fmt" + "log" +- "sort" + "strings" + "time" + +@@ -762,11 +761,6 @@ func resourceContainerRegistryRead(d *pluginsdk.ResourceData, meta interface{}) + } + } + +- // The order of the georeplications returned from the list API is not consistent. We simply order it alphabetically to be consistent. +- sort.Slice(geoReplications, func(i, j int) bool { +- return geoReplications[i].(map[string]interface{})["location"].(string) < geoReplications[j].(map[string]interface{})["location"].(string) +- }) +- + d.Set("georeplications", geoReplications) + + return nil diff --git a/patches/0013-Ensure-servicebus-queue-topic-have-namespaces-and-RG.patch b/patches/0013-Ensure-servicebus-queue-topic-have-namespaces-and-RG.patch new file mode 100644 index 0000000000..27da41bda1 --- /dev/null +++ b/patches/0013-Ensure-servicebus-queue-topic-have-namespaces-and-RG.patch @@ -0,0 +1,88 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Bradley +Date: Wed, 22 May 2024 13:30:53 +0100 +Subject: [PATCH] Ensure servicebus queue & topic have namespaces and RG names + available + +These are computed attributes for use in the servicebus mixins in Pulumi. + +diff --git a/internal/services/servicebus/servicebus_queue_resource.go b/internal/services/servicebus/servicebus_queue_resource.go +index fd6bafbc15..892ca423b4 100644 +--- a/internal/services/servicebus/servicebus_queue_resource.go ++++ b/internal/services/servicebus/servicebus_queue_resource.go +@@ -46,6 +46,8 @@ func resourceServiceBusQueue() *pluginsdk.Resource { + } + } + ++// FORK: @stack72: Ensured the ResourceGroupName and NamespaceName was available as a computed attribute for use ++// in the servicebus mixins in Pulumi + func resourceServicebusQueueSchema() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { +@@ -166,6 +168,16 @@ func resourceServicebusQueueSchema() map[string]*pluginsdk.Schema { + ForceNew: true, + }, + ++ "resource_group_name": { ++ Type: pluginsdk.TypeString, ++ Computed: true, ++ }, ++ ++ "namespace_name": { ++ Type: pluginsdk.TypeString, ++ Computed: true, ++ }, ++ + "status": { + Type: pluginsdk.TypeString, + Optional: true, +@@ -375,6 +387,8 @@ func resourceServiceBusQueueRead(d *pluginsdk.ResourceData, meta interface{}) er + + d.Set("name", id.QueueName) + d.Set("namespace_id", namespaceId.ID()) ++ d.Set("resource_group_name", id.ResourceGroupName) ++ d.Set("namespace_name", id.NamespaceName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { +diff --git a/internal/services/servicebus/servicebus_topic_resource.go b/internal/services/servicebus/servicebus_topic_resource.go +index b661a5e54a..0b18171b8f 100644 +--- a/internal/services/servicebus/servicebus_topic_resource.go ++++ b/internal/services/servicebus/servicebus_topic_resource.go +@@ -46,6 +46,8 @@ func resourceServiceBusTopic() *pluginsdk.Resource { + } + } + ++// FORK: @stack72: Ensured the ResourceGroupName and NamespaceName was available as a computed attribute for use ++// in the servicebus mixins in Pulumi + func resourceServiceBusTopicSchema() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { +@@ -138,6 +140,16 @@ func resourceServiceBusTopicSchema() map[string]*pluginsdk.Schema { + Type: pluginsdk.TypeBool, + Optional: true, + }, ++ ++ "resource_group_name": { ++ Type: pluginsdk.TypeString, ++ Computed: true, ++ }, ++ ++ "namespace_name": { ++ Type: pluginsdk.TypeString, ++ Computed: true, ++ }, + } + } + +@@ -243,6 +255,10 @@ func resourceServiceBusTopicRead(d *pluginsdk.ResourceData, meta interface{}) er + d.Set("name", id.TopicName) + d.Set("namespace_id", topics.NewNamespaceID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName).ID()) + ++ // FORK: We must maintain these properties in order to keep Pulumi mixins working. ++ d.Set("namespace_name", id.NamespaceName) ++ d.Set("resource_group_name", id.ResourceGroupName) ++ + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + status := "" diff --git a/patches/0007-Update-documentation.patch b/patches/0014-Update-documentation.patch similarity index 99% rename from patches/0007-Update-documentation.patch rename to patches/0014-Update-documentation.patch index 4b277b245f..e2d0cefae6 100644 --- a/patches/0007-Update-documentation.patch +++ b/patches/0014-Update-documentation.patch @@ -532,7 +532,7 @@ index 95dac2d863..22f89d3199 100644 } ``` diff --git a/website/docs/r/app_service.html.markdown b/website/docs/r/app_service.html.markdown -index 25e53059a0..b2f7684482 100644 +index e22526a383..feff83d72e 100644 --- a/website/docs/r/app_service.html.markdown +++ b/website/docs/r/app_service.html.markdown @@ -17,7 +17,7 @@ Manages an App Service (within an App Service Plan). @@ -603,7 +603,7 @@ index 6cd2598464..c8510b1c99 100644 ```hcl data "azuread_service_principal" "MicrosoftWebApp" { diff --git a/website/docs/r/app_service_slot.html.markdown b/website/docs/r/app_service_slot.html.markdown -index 4d2a801464..90f4a28915 100644 +index cbda06e6a6..54c68c9c9c 100644 --- a/website/docs/r/app_service_slot.html.markdown +++ b/website/docs/r/app_service_slot.html.markdown @@ -235,7 +235,7 @@ A `site_config` block supports the following: @@ -1537,7 +1537,7 @@ index 6b06ca628f..a2e544d3ef 100644 ```hcl diff --git a/website/docs/r/function_app.html.markdown b/website/docs/r/function_app.html.markdown -index 4fad99cea6..ec393da25c 100644 +index 138d8e5b99..6ac7206ed5 100644 --- a/website/docs/r/function_app.html.markdown +++ b/website/docs/r/function_app.html.markdown @@ -237,7 +237,7 @@ The following arguments are supported: @@ -1550,7 +1550,7 @@ index 4fad99cea6..ec393da25c 100644 ~> **Note:** When using an App Service Plan in the `Free` or `Shared` Tiers `use_32_bit_worker_process` must be set to `true`. diff --git a/website/docs/r/function_app_slot.html.markdown b/website/docs/r/function_app_slot.html.markdown -index 39b679a016..575b9a8f57 100644 +index b88cc5d709..090510bb2d 100644 --- a/website/docs/r/function_app_slot.html.markdown +++ b/website/docs/r/function_app_slot.html.markdown @@ -80,7 +80,7 @@ The following arguments are supported: diff --git a/provider/resources.go b/provider/resources.go index 466404fe73..64e6300223 100644 --- a/provider/resources.go +++ b/provider/resources.go @@ -1833,6 +1833,8 @@ func Provider() tfbridge.ProviderInfo { Randlen: 8, Transform: strings.ToLower, }), + "source_application_security_group_ids": {MaxItemsOne: ref(true)}, + "destination_application_security_group_ids": {MaxItemsOne: ref(true)}, }, }, "azurerm_network_watcher": {Tok: azureResource(azureNetwork, "NetworkWatcher")},