Skip to content

Commit

Permalink
azurerm_logic_app_standard: restore ConfigModeAttr for `ip_restrictio…
Browse files Browse the repository at this point in the history
…ns` and `scm_ip_restrictions` blocks (#26818)
  • Loading branch information
manicminer authored Jul 26, 2024
1 parent 5f9f14a commit 2c5cacd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 157 deletions.
124 changes: 9 additions & 115 deletions internal/services/logic/logic_app_standard_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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
Expand Down
44 changes: 2 additions & 42 deletions internal/services/logic/logic_app_standard_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
}
Expand All @@ -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)
}

Expand Down Expand Up @@ -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 {}
}
Expand All @@ -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)
}

Expand Down

0 comments on commit 2c5cacd

Please sign in to comment.