Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resource/app_service: Add support for site_config FtpsState #1577

Merged
merged 2 commits into from
Jul 15, 2018
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
16 changes: 16 additions & 0 deletions azurerm/helpers/schema/app_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,17 @@ func AppServiceSiteConfigSchema() *schema.Schema {
Optional: true,
Computed: true,
},

"ftps_state": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validation.StringInSlice([]string{
string(web.AllAllowed),
string(web.Disabled),
string(web.FtpsOnly),
}, false),
},
},
},
}
Expand Down Expand Up @@ -281,6 +292,10 @@ func ExpandAppServiceSiteConfig(input interface{}) web.SiteConfig {
siteConfig.ScmType = web.ScmType(v.(string))
}

if v, ok := config["ftps_state"]; ok {
siteConfig.FtpsState = web.FtpsState(v.(string))
}

return siteConfig
}

Expand Down Expand Up @@ -380,6 +395,7 @@ func FlattenAppServiceSiteConfig(input *web.SiteConfig) []interface{} {
}

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

return append(results, result)
}
52 changes: 52 additions & 0 deletions azurerm/resource_arm_app_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,27 @@ func TestAccAzureRMAppService_scmType(t *testing.T) {
})
}

func TestAccAzureRMAppService_ftpsState(t *testing.T) {
resourceName := "azurerm_app_service.test"
ri := acctest.RandInt()
config := testAccAzureRMAppService_ftpsState(ri, testLocation())

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMAppServiceDestroy,
Steps: []resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMAppServiceExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "site_config.0.ftps_state", "AllAllowed"),
),
},
},
})
}

func testCheckAzureRMAppServiceDestroy(s *terraform.State) error {
client := testAccProvider.Meta().(*ArmClient).appServicesClient

Expand Down Expand Up @@ -1695,3 +1716,34 @@ resource "azurerm_app_service" "test" {
}
`, rInt, location, rInt, rInt)
}

func testAccAzureRMAppService_ftpsState(rInt int, location string) string {
return fmt.Sprintf(`
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 {
ftps_state = "AllAllowed"
}
}
`, rInt, location, rInt, rInt)
}
2 changes: 2 additions & 0 deletions website/docs/d/app_service.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ output "app_service_id" {

* `websockets_enabled` - Are WebSockets enabled for this App Service?

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

---

`ip_restriction` exports the following:
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/app_service.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ The following arguments are supported:
* `remote_debugging_version` - (Optional) Which version of Visual Studio should the Remote Debugger be compatible with? Possible values are `VS2012`, `VS2013`, `VS2015` and `VS2017`.
* `scm_type` - (Optional) The type of Source Control enabled for this App Service. Possible values include `None` and `LocalGit`. Defaults to `None`.
* `use_32_bit_worker_process` - (Optional) Should the App Service run in 32 bit mode, rather than 64 bit mode?
* `ftps_state` - (Optional) State of FTP / FTPS service for this AppService. Possible values include: `AllAllowed`, `FtpsOnly` and `Disabled`.

~> **NOTE:** when using an App Service Plan in the `Free` or `Shared` Tiers `use_32_bit_worker_process` must be set to `true`.

Expand Down