Merge pull request #4717 from stack72/azurerm-availSet-acctests

Add acceptance test to ARM Availability Set for tagging
This commit is contained in:
James Nugent 2016-01-18 12:58:42 -05:00
commit a32980e8a7
2 changed files with 72 additions and 0 deletions

View File

@ -32,6 +32,40 @@ func TestAccAzureRMAvailabilitySet_basic(t *testing.T) {
})
}
func TestAccAzureRMAvailabilitySet_withTags(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMAvailabilitySetDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccAzureRMVAvailabilitySet_withTags,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMAvailabilitySetExists("azurerm_availability_set.test"),
resource.TestCheckResourceAttr(
"azurerm_availability_set.test", "tags.#", "2"),
resource.TestCheckResourceAttr(
"azurerm_availability_set.test", "tags.environment", "Production"),
resource.TestCheckResourceAttr(
"azurerm_availability_set.test", "tags.cost_center", "MSFT"),
),
},
resource.TestStep{
Config: testAccAzureRMVAvailabilitySet_withUpdatedTags,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMAvailabilitySetExists("azurerm_availability_set.test"),
resource.TestCheckResourceAttr(
"azurerm_availability_set.test", "tags.#", "1"),
resource.TestCheckResourceAttr(
"azurerm_availability_set.test", "tags.environment", "staging"),
),
},
},
})
}
func TestAccAzureRMAvailabilitySet_withDomainCounts(t *testing.T) {
resource.Test(t, resource.TestCase{
@ -121,6 +155,39 @@ resource "azurerm_availability_set" "test" {
}
`
var testAccAzureRMVAvailabilitySet_withTags = `
resource "azurerm_resource_group" "test" {
name = "acceptanceTestResourceGroup1"
location = "West US"
}
resource "azurerm_availability_set" "test" {
name = "acceptanceTestAvailabilitySet1"
location = "West US"
resource_group_name = "${azurerm_resource_group.test.name}"
tags {
environment = "Production"
cost_center = "MSFT"
}
}
`
var testAccAzureRMVAvailabilitySet_withUpdatedTags = `
resource "azurerm_resource_group" "test" {
name = "acceptanceTestResourceGroup1"
location = "West US"
}
resource "azurerm_availability_set" "test" {
name = "acceptanceTestAvailabilitySet1"
location = "West US"
resource_group_name = "${azurerm_resource_group.test.name}"
tags {
environment = "staging"
}
}
`
var testAccAzureRMVAvailabilitySet_withDomainCounts = `
resource "azurerm_resource_group" "test" {
name = "acceptanceTestResourceGroup1"

View File

@ -22,6 +22,10 @@ resource "azurerm_availability_set" "test" {
name = "acceptanceTestAvailabilitySet1"
location = "West US"
resource_group_name = "${azurerm_resource_group.test.name}"
tags {
environment = "Production"
}
}
```
@ -40,6 +44,7 @@ The following arguments are supported:
* `platform_update_domain_count` - (Optional) Specifies the number of update domains that are used. Defaults to 5.
* `platform_fault_domain_count` - (Optional) Specifies the number of fault domains that are used. Defaults to 3.
* `tags` - (Optional) A mapping of tags to assign to the resource.
## Attributes Reference