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

azurerm_virtual_hub: fix acc test and make the address_prefix as ForceNew #7713

Merged
merged 1 commit into from
Jul 13, 2020
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
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