Skip to content
Closed
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
1 change: 1 addition & 0 deletions azurerm/resource_arm_app_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ func resourceArmAppService() *schema.Resource {
Default: string(web.ScmTypeNone),
ValidateFunc: validation.StringInSlice([]string{
string(web.ScmTypeNone),
string(web.ScmTypeGitHub),
string(web.ScmTypeLocalGit),
}, false),
},
Expand Down
60 changes: 57 additions & 3 deletions azurerm/resource_arm_app_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -653,10 +653,10 @@ func TestAccAzureRMAppService_webSockets(t *testing.T) {
})
}

func TestAccAzureRMAppService_scmType(t *testing.T) {
func TestAccAzureRMAppService_scmTypeLocalGit(t *testing.T) {
resourceName := "azurerm_app_service.test"
ri := acctest.RandInt()
config := testAccAzureRMAppService_scmType(ri, testLocation())
config := testAccAzureRMAppService_scmTypeLocalGit(ri, testLocation())

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand All @@ -676,6 +676,29 @@ func TestAccAzureRMAppService_scmType(t *testing.T) {
})
}

func TestAccAzureRMAppService_scmTypeGitHub(t *testing.T) {
resourceName := "azurerm_app_service.test"
ri := acctest.RandInt()
config := testAccAzureRMAppService_scmTypeGitHub(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.scm_type", "GitHub"),
resource.TestCheckResourceAttr(resourceName, "source_control.#", "1"),
resource.TestCheckResourceAttr(resourceName, "site_credential.#", "1"),
),
},
},
})
}

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

Expand Down Expand Up @@ -1390,7 +1413,7 @@ resource "azurerm_app_service" "test" {
`, rInt, location, rInt, rInt)
}

func testAccAzureRMAppService_scmType(rInt int, location string) string {
func testAccAzureRMAppService_scmTypeLocalGit(rInt int, location string) string {
return fmt.Sprintf(`
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
Expand Down Expand Up @@ -1420,3 +1443,34 @@ resource "azurerm_app_service" "test" {
}
`, rInt, location, rInt, rInt)
}

func testAccAzureRMAppService_scmTypeGitHub(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 {
scm_type = "GitHub"
}
}
`, rInt, location, rInt, rInt)
}