Skip to content

Commit

Permalink
Merge pull request #6661 from sirlatrom/fix-6429
Browse files Browse the repository at this point in the history
  • Loading branch information
jackofallops committed May 7, 2020
2 parents c690b95 + 6cb1da5 commit 918273d
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 0 deletions.
19 changes: 19 additions & 0 deletions azurerm/helpers/azure/app_service.go
Expand Up @@ -450,6 +450,11 @@ func SchemaAppServiceSiteConfig() *schema.Schema {
}, false),
},

"health_check_path": {
Type: schema.TypeString,
Optional: true,
},

"linux_fx_version": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -749,6 +754,11 @@ func SchemaAppServiceDataSourceSiteConfig() *schema.Schema {
Computed: true,
},

"health_check_path": {
Type: schema.TypeString,
Computed: true,
},

"linux_fx_version": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -1486,6 +1496,10 @@ func ExpandAppServiceSiteConfig(input interface{}) (*web.SiteConfig, error) {
siteConfig.FtpsState = web.FtpsState(v.(string))
}

if v, ok := config["health_check_path"]; ok {
siteConfig.HealthCheckPath = utils.String(v.(string))
}

if v, ok := config["min_tls_version"]; ok {
siteConfig.MinTLSVersion = web.SupportedTLSVersions(v.(string))
}
Expand Down Expand Up @@ -1606,6 +1620,11 @@ func FlattenAppServiceSiteConfig(input *web.SiteConfig) []interface{} {

result["scm_type"] = string(input.ScmType)
result["ftps_state"] = string(input.FtpsState)

if input.HealthCheckPath != nil {
result["health_check_path"] = *input.HealthCheckPath
}

result["min_tls_version"] = string(input.MinTLSVersion)

result["cors"] = FlattenWebCorsSettings(input.Cors)
Expand Down
Expand Up @@ -1201,6 +1201,25 @@ func TestAccAzureRMAppService_ftpsState(t *testing.T) {
})
}

func TestAccAzureRMAppService_healthCheckPath(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_app_service", "test")
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acceptance.PreCheck(t) },
Providers: acceptance.SupportedProviders,
CheckDestroy: testCheckAzureRMAppServiceDestroy,
Steps: []resource.TestStep{
{
Config: testAccAzureRMAppService_healthCheckPath(data),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMAppServiceExists(data.ResourceName),
resource.TestCheckResourceAttr(data.ResourceName, "site_config.0.health_check_path", "/health"),
),
},
data.ImportStep(),
},
})
}

// todo - linuxFxVersion seems to reject all supplied values - needs more detailed investigation.
// error message simply reads: Original Error: Code="BadRequest" Message="The parameter LinuxFxVersion has an invalid value."
func TestAccAzureRMAppService_linuxFxVersion(t *testing.T) {
Expand Down Expand Up @@ -3391,6 +3410,41 @@ resource "azurerm_app_service" "test" {
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger)
}

func testAccAzureRMAppService_healthCheckPath(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
location = "%s"
}
resource "azurerm_app_service_plan" "test" {
name = "acctestASP-%d"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
sku {
tier = "Standard"
size = "S1"
}
}
resource "azurerm_app_service" "test" {
name = "acctestAS-%d"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
app_service_plan_id = azurerm_app_service_plan.test.id
site_config {
health_check_path = "/health"
}
}
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger)
}

func testAccAzureRMAppService_linuxFxVersion(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
Expand Down
2 changes: 2 additions & 0 deletions website/docs/d/app_service.html.markdown
Expand Up @@ -103,6 +103,8 @@ A `ip_restriction` block exports the following:

* `ftps_state` - State of FTP / FTPS service for this AppService.

* `health_check_path` - The health check path to be pinged by App Service.

* `ip_restriction` - One or more `ip_restriction` blocks as defined above.

* `java_version` - The version of Java in use.
Expand Down
4 changes: 4 additions & 0 deletions website/docs/r/app_service.html.markdown
Expand Up @@ -187,6 +187,10 @@ A `site_config` block supports the following:

* `ftps_state` - (Optional) State of FTP / FTPS service for this App Service. Possible values include: `AllAllowed`, `FtpsOnly` and `Disabled`.

* `health_check_path` - (Optional) The health check path to be pinged by App Service. [For more information - please see the corresponding Kudu Wiki page](https://github.com/projectkudu/kudu/wiki/Health-Check-(Preview)).

~> **Note:** This functionality is in Preview and is subject to changes (including breaking changes) on Azure's end

* `http2_enabled` - (Optional) Is HTTP2 Enabled on this App Service? Defaults to `false`.

* `ip_restriction` - (Optional) A [List of objects](/docs/configuration/attr-as-blocks.html) representing ip restrictions as defined below.
Expand Down

0 comments on commit 918273d

Please sign in to comment.