Skip to content

Commit

Permalink
Merge pull request #7713 from magodo/acctest_vhub
Browse files Browse the repository at this point in the history
azurerm_virtual_hub: fix acc test and make the `address_prefix` as `ForceNew`
  • Loading branch information
tombuildsstuff authored Jul 13, 2020
2 parents 63f5228 + b984360 commit f9376a7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,32 +52,6 @@ func TestAccAzureRMVirtualHub_requiresImport(t *testing.T) {
})
}

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

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acceptance.PreCheck(t) },
Providers: acceptance.SupportedProviders,
CheckDestroy: testCheckAzureRMVirtualHubDestroy,
Steps: []resource.TestStep{
{
Config: testAccAzureRMVirtualHub_basic(data),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMVirtualHubExists(data.ResourceName),
),
},
data.ImportStep(),
{
Config: testAccAzureRMVirtualHub_updated(data),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMVirtualHubExists(data.ResourceName),
),
},
data.ImportStep(),
},
})
}

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

Expand Down Expand Up @@ -195,26 +169,12 @@ resource "azurerm_virtual_hub" "import" {
name = azurerm_virtual_hub.test.name
location = azurerm_virtual_hub.test.location
resource_group_name = azurerm_virtual_hub.test.resource_group_name
address_prefix = "10.0.1.0/24"
virtual_wan_id = azurerm_virtual_hub.test.virtual_wan_id
address_prefix = azurerm_virtual_hub.test.address_prefix
}
`, template)
}

func testAccAzureRMVirtualHub_updated(data acceptance.TestData) string {
template := testAccAzureRMVirtualHub_template(data)
return fmt.Sprintf(`
%s
resource "azurerm_virtual_hub" "test" {
name = "acctestVHUB-%d"
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
virtual_wan_id = azurerm_virtual_wan.test.id
address_prefix = "10.0.2.0/24"
}
`, template, data.RandomInteger)
}

func testAccAzureRMVirtualHub_route(data acceptance.TestData) string {
template := testAccAzureRMVirtualHub_template(data)
return fmt.Sprintf(`
Expand Down
1 change: 1 addition & 0 deletions azurerm/internal/services/network/virtual_hub_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func resourceArmVirtualHub() *schema.Resource {
"address_prefix": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validate.CIDR,
},

Expand Down
4 changes: 2 additions & 2 deletions website/docs/r/virtual_hub.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ The following arguments are supported:

* `location` - (Required) Specifies the supported Azure location where the Virtual Hub should exist. Changing this forces a new resource to be created.

* `address_prefix` - (Required) The Address Prefix which should be used for this Virtual Hub.
* `address_prefix` - (Required) The Address Prefix which should be used for this Virtual Hub. Changing this forces a new resource to be created.

* `virtual_wan_id` - (Required) The ID of a Virtual WAN within which the Virtual Hub should be created.
* `virtual_wan_id` - (Required) The ID of a Virtual WAN within which the Virtual Hub should be created. Changing this forces a new resource to be created.

---

Expand Down

0 comments on commit f9376a7

Please sign in to comment.