Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions internal/services/appservice/helpers/logic_apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type LogicAppSiteConfig struct {
DotnetFrameworkVersion string `tfschema:"dotnet_framework_version"`
VNETRouteAllEnabled bool `tfschema:"vnet_route_all_enabled"`
AutoSwapSlotName string `tfschema:"auto_swap_slot_name"`
IpRestrictionDefaultAction string `tfschema:"ip_restriction_default_action"`

PublicNetworkAccessEnabled bool `tfschema:"public_network_access_enabled,removedInNextMajorVersion"`
}
Expand Down Expand Up @@ -189,6 +190,12 @@ func SchemaLogicAppStandardSiteConfig() *pluginsdk.Schema {
Computed: true,
},

"ip_restriction_default_action": {
Type: pluginsdk.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice(webapps.PossibleValuesForDefaultAction(), false),
},

"auto_swap_slot_name": {
Type: pluginsdk.TypeString,
Computed: true,
Expand Down
7 changes: 7 additions & 0 deletions internal/services/logic/logic_app_standard_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,8 @@ func flattenLogicAppStandardDataSourceSiteConfig(input *webapps.SiteConfig) []in

result["vnet_route_all_enabled"] = pointer.From(input.VnetRouteAllEnabled)

result["ip_restriction_default_action"] = string(pointer.From(input.IPSecurityRestrictionsDefaultAction))

results = append(results, result)
return results
}
Expand Down Expand Up @@ -593,6 +595,11 @@ func schemaLogicAppStandardSiteConfigDataSource() *pluginsdk.Schema {
Type: pluginsdk.TypeString,
Computed: true,
},

"ip_restriction_default_action": {
Type: pluginsdk.TypeString,
Computed: true,
},
},
},
}
Expand Down
8 changes: 8 additions & 0 deletions internal/services/logic/logic_app_standard_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,8 @@ func flattenLogicAppStandardSiteConfig(input *webapps.SiteConfig) []helpers.Logi

result.VNETRouteAllEnabled = pointer.From(input.VnetRouteAllEnabled)

result.IpRestrictionDefaultAction = pointer.FromEnum(input.IPSecurityRestrictionsDefaultAction)

if !features.FivePointOh() {
result.PublicNetworkAccessEnabled = strings.EqualFold(pointer.From(input.PublicNetworkAccess), helpers.PublicNetworkAccessEnabled)
}
Expand Down Expand Up @@ -1110,6 +1112,8 @@ func expandLogicAppStandardSiteConfigForCreate(d []helpers.LogicAppSiteConfig, m
siteConfig.PublicNetworkAccess = pointer.To(reconcilePNA(metadata))
}

siteConfig.IPSecurityRestrictionsDefaultAction = pointer.ToEnum[webapps.DefaultAction](config.IpRestrictionDefaultAction)

return siteConfig, nil
}

Expand Down Expand Up @@ -1212,6 +1216,10 @@ func expandLogicAppStandardSiteConfigForUpdate(d []helpers.LogicAppSiteConfig, m
siteConfig.AppSettings = mergeAppSettings(appSettings, o.(map[string]interface{}), n.(map[string]interface{}), metadata)
}

if metadata.ResourceData.HasChange("site_config.0.ip_restriction_default_action") {
siteConfig.IPSecurityRestrictionsDefaultAction = pointer.ToEnum[webapps.DefaultAction](config.IpRestrictionDefaultAction)
}

return siteConfig, nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1666,7 +1666,8 @@ resource "azurerm_logic_app_standard" "test" {
storage_account_access_key = azurerm_storage_account.test.primary_access_key

site_config {
min_tls_version = 1.2
min_tls_version = 1.2
ip_restriction_default_action = "Allow"
ip_restriction {
ip_address = "10.10.10.10/32"
name = "test-restriction"
Expand Down
2 changes: 2 additions & 0 deletions website/docs/d/logic_app_standard.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ The `site_config` block exports the following:

* `ip_restriction` - A list of `ip_restriction` objects representing IP restrictions as defined below.

* `ip_restriction_default_action` - The default action taken when no `ip_restriction` rules match.

* `scm_ip_restriction` - A list of `scm_ip_restriction` objects representing SCM IP restrictions as defined below.

* `scm_use_main_ip_restriction` - Should the Logic App `ip_restriction` configuration be used for the SCM too.
Expand Down
4 changes: 4 additions & 0 deletions website/docs/r/logic_app_standard.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ The `site_config` block supports the following:

-> **Note:** User has to explicitly set `ip_restriction` to empty slice (`[]`) to remove it.

* `ip_restriction_default_action` - (Optional) The action to take when no `ip_restriction` rules match. Possible values are `Allow` and `Deny`.

-> **Note:** If `ip_restriction_default_action` is not configured, it is implicitly set to `Allow` when no `ip_restriction` rules are defined and `Deny` when at least one `ip_restriction` rule is defined.

* `scm_ip_restriction` - (Optional) A list of `scm_ip_restriction` objects representing SCM IP restrictions as defined below.

-> **Note:** User has to explicitly set `scm_ip_restriction` to empty slice (`[]`) to remove it.
Expand Down
Loading