Skip to content

Commit

Permalink
first acctest adjustment and panic fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Aris van Ommeren committed Apr 2, 2021
1 parent 9a854a1 commit 5205dc5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion azurerm/internal/services/web/app_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -2031,7 +2031,7 @@ func flattenHeaders(input map[string][]string) []interface{} {

func expandHeaders(input []interface{}) map[string][]string {
output := make(map[string][]string)
if input == nil || input[0] == nil {
if input == nil || len(input) == 0 {
return output
}

Expand Down
16 changes: 16 additions & 0 deletions azurerm/internal/services/web/app_service_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,16 @@ func TestAccAppService_completeIpRestriction(t *testing.T) {
check.That(data.ResourceName).Key("site_config.0.ip_restriction.0.name").HasValue("test-restriction"),
check.That(data.ResourceName).Key("site_config.0.ip_restriction.0.priority").HasValue("123"),
check.That(data.ResourceName).Key("site_config.0.ip_restriction.0.action").HasValue("Allow"),
check.That(data.ResourceName).Key("site_config.0.ip_restriction.0.headers.0.x_forwarded_for.#").HasValue("2"),
check.That(data.ResourceName).Key("site_config.0.ip_restriction.0.headers.0.x_forwarded_for.0").HasValue("2002::1234:abcd:ffff:c0a8:101/64"),
check.That(data.ResourceName).Key("site_config.0.ip_restriction.0.headers.0.x_forwarded_for.1").HasValue("9.9.9.9/32"),
check.That(data.ResourceName).Key("site_config.0.ip_restriction.0.headers.0.x_azure_fdid.#").HasValue("1"),
check.That(data.ResourceName).Key("site_config.0.ip_restriction.0.headers.0.x_azure_fdid.0").HasValue("55ce4ed1-4b06-4bf1-b40e-4638452104da"),
check.That(data.ResourceName).Key("site_config.0.ip_restriction.0.headers.0.x_fd_health_probe.#").HasValue("8"),
check.That(data.ResourceName).Key("site_config.0.ip_restriction.0.headers.0.x_fd_health_probe.0").HasValue("1"),
check.That(data.ResourceName).Key("site_config.0.ip_restriction.0.headers.0.x_fd_health_probe.7").HasValue("8"),
check.That(data.ResourceName).Key("site_config.0.ip_restriction.0.headers.0.x_forwarded_host.#").HasValue("1"),
check.That(data.ResourceName).Key("site_config.0.ip_restriction.0.headers.0.x_forwarded_host.0").HasValue("example.com"),
),
},
data.ImportStep(),
Expand Down Expand Up @@ -2774,6 +2784,12 @@ resource "azurerm_app_service" "test" {
name = "test-restriction"
priority = 123
action = "Allow"
headers {
x_azure_fdid = ["55ce4ed1-4b06-4bf1-b40e-4638452104da"]
x_fd_health_probe = ["1", "2", "3", "4", "5", "6", "7", "8"]
x_forwarded_for = ["9.9.9.9/32", "2002::1234:abcd:ffff:c0a8:101/64"]
x_forwarded_host = ["example.com"]
}
}
}
}
Expand Down

0 comments on commit 5205dc5

Please sign in to comment.