From 2c5cacdbe88702d641f50413a77661fa1052235d Mon Sep 17 00:00:00 2001 From: Tom Bamford Date: Fri, 26 Jul 2024 12:57:02 +0100 Subject: [PATCH] azurerm_logic_app_standard: restore ConfigModeAttr for `ip_restrictions` and `scm_ip_restrictions` blocks (#26818) --- .../logic/logic_app_standard_resource.go | 124 ++---------------- .../logic/logic_app_standard_resource_test.go | 44 +------ 2 files changed, 11 insertions(+), 157 deletions(-) diff --git a/internal/services/logic/logic_app_standard_resource.go b/internal/services/logic/logic_app_standard_resource.go index 61dd7f0622dc..0c29d3383e6f 100644 --- a/internal/services/logic/logic_app_standard_resource.go +++ b/internal/services/logic/logic_app_standard_resource.go @@ -919,119 +919,11 @@ func schemaLogicAppCorsSettings() *pluginsdk.Schema { } func schemaLogicAppStandardIpRestriction() *pluginsdk.Schema { - if !features.FourPointOhBeta() { - return &pluginsdk.Schema{ - Type: pluginsdk.TypeList, - Optional: true, - Computed: true, - ConfigMode: pluginsdk.SchemaConfigModeAttr, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "ip_address": { - Type: pluginsdk.TypeString, - Optional: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - - "service_tag": { - Type: pluginsdk.TypeString, - Optional: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - - "virtual_network_subnet_id": { - Type: pluginsdk.TypeString, - Optional: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - - "name": { - Type: pluginsdk.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - - "priority": { - Type: pluginsdk.TypeInt, - Optional: true, - Default: 65000, - ValidateFunc: validation.IntBetween(1, 2147483647), - }, - - "action": { - Type: pluginsdk.TypeString, - Default: "Allow", - Optional: true, - ValidateFunc: validation.StringInSlice([]string{ - "Allow", - "Deny", - }, false), - }, - - // lintignore:XS003 - "headers": { - Type: pluginsdk.TypeList, - Optional: true, - Computed: true, - MaxItems: 1, - ConfigMode: pluginsdk.SchemaConfigModeAttr, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - // lintignore:S018 - "x_forwarded_host": { - Type: pluginsdk.TypeSet, - Optional: true, - MaxItems: 8, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - - // lintignore:S018 - "x_forwarded_for": { - Type: pluginsdk.TypeSet, - Optional: true, - MaxItems: 8, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - ValidateFunc: validation.IsCIDR, - }, - }, - - // lintignore:S018 - "x_azure_fdid": { - Type: pluginsdk.TypeSet, - Optional: true, - MaxItems: 8, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - ValidateFunc: validation.IsUUID, - }, - }, - - // lintignore:S018 - "x_fd_health_probe": { - Type: pluginsdk.TypeSet, - Optional: true, - MaxItems: 1, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - ValidateFunc: validation.StringInSlice([]string{ - "1", - }, false), - }, - }, - }, - }, - }, - }, - }, - } - } return &pluginsdk.Schema{ - Type: pluginsdk.TypeList, - Optional: true, + Type: pluginsdk.TypeList, + Optional: true, + Computed: true, + ConfigMode: pluginsdk.SchemaConfigModeAttr, Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ "ip_address": { @@ -1078,9 +970,11 @@ func schemaLogicAppStandardIpRestriction() *pluginsdk.Schema { // lintignore:XS003 "headers": { - Type: pluginsdk.TypeList, - Optional: true, - MaxItems: 1, + Type: pluginsdk.TypeList, + Optional: true, + Computed: true, + MaxItems: 1, + ConfigMode: pluginsdk.SchemaConfigModeAttr, Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ // lintignore:S018 diff --git a/internal/services/logic/logic_app_standard_resource_test.go b/internal/services/logic/logic_app_standard_resource_test.go index 86fdf5e52777..4968a0146fe9 100644 --- a/internal/services/logic/logic_app_standard_resource_test.go +++ b/internal/services/logic/logic_app_standard_resource_test.go @@ -1688,8 +1688,7 @@ resource "azurerm_logic_app_standard" "test" { } func (r LogicAppStandardResource) ipRestrictionRemoved(data acceptance.TestData) string { - if !features.FourPointOhBeta() { - return fmt.Sprintf(` + return fmt.Sprintf(` provider "azurerm" { features {} } @@ -1708,25 +1707,6 @@ resource "azurerm_logic_app_standard" "test" { ip_restriction = [] } } -`, r.template(data), data.RandomInteger) - } - return fmt.Sprintf(` -provider "azurerm" { - features {} -} - -%s - -resource "azurerm_logic_app_standard" "test" { - name = "acctest-%d-func" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - app_service_plan_id = azurerm_app_service_plan.test.id - storage_account_name = azurerm_storage_account.test.name - storage_account_access_key = azurerm_storage_account.test.primary_access_key - - site_config {} -} `, r.template(data), data.RandomInteger) } @@ -1805,8 +1785,7 @@ resource "azurerm_logic_app_standard" "test" { } func (r LogicAppStandardResource) unsetScmIpRestriction(data acceptance.TestData) string { - if !features.FourPointOhBeta() { - return fmt.Sprintf(` + return fmt.Sprintf(` provider "azurerm" { features {} } @@ -1825,25 +1804,6 @@ resource "azurerm_logic_app_standard" "test" { scm_ip_restriction = [] } } -`, r.template(data), data.RandomInteger) - } - return fmt.Sprintf(` -provider "azurerm" { - features {} -} - -%s - -resource "azurerm_logic_app_standard" "test" { - name = "acctest-%d-func" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - app_service_plan_id = azurerm_app_service_plan.test.id - storage_account_name = azurerm_storage_account.test.name - storage_account_access_key = azurerm_storage_account.test.primary_access_key - - site_config {} -} `, r.template(data), data.RandomInteger) }