Skip to content

Commit

Permalink
test fixes. Unused virtual_network_name field removed
Browse files Browse the repository at this point in the history
  • Loading branch information
jackofallops committed Feb 20, 2020
1 parent 9b8d0bf commit 488b8ab
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 199 deletions.
1 change: 0 additions & 1 deletion azurerm/helpers/azure/app_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"regexp"
"strings"


"github.com/Azure/azure-sdk-for-go/services/web/mgmt/2019-08-01/web"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
Expand Down
4 changes: 0 additions & 4 deletions azurerm/internal/services/web/resource_arm_function_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,6 @@ func resourceArmFunctionApp() *schema.Resource {
Optional: true,
Computed: true,
},
"virtual_network_name": {
Type: schema.TypeString,
Optional: true,
},
"http2_enabled": {
Type: schema.TypeBool,
Optional: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2682,7 +2682,7 @@ resource "azurerm_app_service_slot" "test" {
site_config {
ip_restriction {
ip_address = "10.10.10.10"
ip_address = "10.10.10.10/32"
}
}
}
Expand Down Expand Up @@ -2821,15 +2821,15 @@ resource "azurerm_app_service_slot" "test" {
}
ip_restriction {
ip_address = "20.20.20.0/24"
ip_address = "20.20.20.0/24"
}
ip_restriction {
ip_address = "30.30.0.0/16"
ip_address = "30.30.0.0/16"
}
ip_restriction {
ip_address = "192.168.1.2/24"
ip_address = "192.168.1.2/24"
}
}
}
Expand Down
130 changes: 3 additions & 127 deletions azurerm/internal/services/web/tests/resource_arm_app_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,32 +344,6 @@ func TestAccAzureRMAppService_clientAffinityDisabled(t *testing.T) {
})
}

func TestAccAzureRMAppService_virtualNetwork(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_virtualNetwork(data),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMAppServiceExists(data.ResourceName),
resource.TestCheckResourceAttr(data.ResourceName, "site_config.0.virtual_network_name", fmt.Sprintf("acctestvn-%d", data.RandomInteger)),
),
},
{
Config: testAccAzureRMAppService_virtualNetworkUpdated(data),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMAppServiceExists(data.ResourceName),
resource.TestCheckResourceAttr(data.ResourceName, "site_config.0.virtual_network_name", fmt.Sprintf("acctestvn2-%d", data.RandomInteger)),
),
},
data.ImportStep(),
},
})
}

func TestAccAzureRMAppService_enableManageServiceIdentity(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_app_service", "test")
resource.ParallelTest(t, resource.TestCase{
Expand Down Expand Up @@ -2259,104 +2233,6 @@ resource "azurerm_app_service" "test" {
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, clientAffinity)
}

func testAccAzureRMAppService_virtualNetwork(data acceptance.TestData) string {
return fmt.Sprintf(`
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
location = "%s"
}
resource "azurerm_virtual_network" "test" {
name = "acctestvn-%d"
address_space = ["10.0.0.0/16"]
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
subnet {
name = "internal"
address_prefix = "10.0.1.0/24"
}
}
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 {
virtual_network_name = "${azurerm_virtual_network.test.name}"
}
}
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger)
}

func testAccAzureRMAppService_virtualNetworkUpdated(data acceptance.TestData) string {
return fmt.Sprintf(`
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
location = "%s"
}
resource "azurerm_virtual_network" "test" {
name = "acctestvn-%d"
address_space = ["10.0.0.0/16"]
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
subnet {
name = "internal"
address_prefix = "10.0.1.0/24"
}
}
resource "azurerm_virtual_network" "second" {
name = "acctestvn2-%d"
address_space = ["172.0.0.0/16"]
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
subnet {
name = "internal"
address_prefix = "172.0.1.0/24"
}
}
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 {
virtual_network_name = "${azurerm_virtual_network.second.name}"
}
}
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger)
}

func testAccAzureRMAppService_mangedServiceIdentity(data acceptance.TestData) string {
return fmt.Sprintf(`
resource "azurerm_resource_group" "test" {
Expand Down Expand Up @@ -2767,15 +2643,15 @@ resource "azurerm_app_service" "test" {
}
ip_restriction {
ip_address = "20.20.20.0/24"
ip_address = "20.20.20.0/24"
}
ip_restriction {
ip_address = "30.30.0.0/16"
ip_address = "30.30.0.0/16"
}
ip_restriction {
ip_address = "192.168.1.2/24"
ip_address = "192.168.1.2/24"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/features"

"github.com/hashicorp/terraform-plugin-sdk/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
Expand Down Expand Up @@ -580,28 +579,6 @@ func TestAccAzureRMFunctionApp_corsSettings(t *testing.T) {
})
}

func TestAccAzureRMFunctionApp_vnetName(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_function_app", "test")

vnetName := strings.ToLower(acctest.RandString(11))

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acceptance.PreCheck(t) },
Providers: acceptance.SupportedProviders,
CheckDestroy: testCheckAzureRMFunctionAppDestroy,
Steps: []resource.TestStep{
{
Config: testAccAzureRMFunctionApp_vnetName(data, vnetName),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMFunctionAppExists(data.ResourceName),
resource.TestCheckResourceAttr(data.ResourceName, "site_config.0.virtual_network_name", vnetName),
),
},
data.ImportStep(),
},
})
}

func TestAccAzureRMFunctionApp_enableHttp2(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_function_app", "test")

Expand Down Expand Up @@ -1802,46 +1779,6 @@ resource "azurerm_function_app" "test" {
`, data.RandomInteger, data.Locations.Primary, data.RandomString)
}

func testAccAzureRMFunctionApp_vnetName(data acceptance.TestData, vnetName string) string {
return fmt.Sprintf(`
resource "azurerm_resource_group" "test" {
name = "acctestRG-%[1]d"
location = "%[2]s"
}
resource "azurerm_storage_account" "test" {
name = "acctestsa%[3]s"
resource_group_name = "${azurerm_resource_group.test.name}"
location = "${azurerm_resource_group.test.location}"
account_tier = "Standard"
account_replication_type = "LRS"
}
resource "azurerm_app_service_plan" "test" {
name = "acctestASP-%[1]d"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
sku {
tier = "Standard"
size = "S1"
}
}
resource "azurerm_function_app" "test" {
name = "acctest-%[1]d-func"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
app_service_plan_id = "${azurerm_app_service_plan.test.id}"
storage_connection_string = "${azurerm_storage_account.test.primary_connection_string}"
site_config {
virtual_network_name = "%[4]s"
}
}
`, data.RandomInteger, data.Locations.Primary, data.RandomString, vnetName)
}

func testAccAzureRMFunctionApp_enableHttp2(data acceptance.TestData) string {
return fmt.Sprintf(`
resource "azurerm_resource_group" "test" {
Expand Down

1 comment on commit 488b8ab

@dexiantac
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I'm trying to find out a way to integrate vnet with app service without using the app service environment(super slow to setup), why the virtual_network_name is removed? I can do so easily on the azure portal through UI, I've been banging this for a while without success, any pointers?
Thank you.

Please sign in to comment.