Merge pull request #5937 from stack72/f-aws-db-subnet-test

provider/aws: Test to validate that db subnet group description can be updated
This commit is contained in:
James Nugent 2016-03-30 17:04:04 -07:00
commit 22d0b63194
1 changed files with 64 additions and 0 deletions

View File

@ -66,6 +66,37 @@ func TestAccAWSDBSubnetGroup_withUndocumentedCharacters(t *testing.T) {
}) })
} }
func TestAccAWSDBSubnetGroup_updateDescription(t *testing.T) {
var v rds.DBSubnetGroup
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckDBSubnetGroupDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccDBSubnetGroupConfig,
Check: resource.ComposeTestCheckFunc(
testAccCheckDBSubnetGroupExists(
"aws_db_subnet_group.foo", &v),
resource.TestCheckResourceAttr(
"aws_db_subnet_group.foo", "description", "foo description"),
),
},
resource.TestStep{
Config: testAccDBSubnetGroupConfig_updatedDescription,
Check: resource.ComposeTestCheckFunc(
testAccCheckDBSubnetGroupExists(
"aws_db_subnet_group.foo", &v),
resource.TestCheckResourceAttr(
"aws_db_subnet_group.foo", "description", "foo description updated"),
),
},
},
})
}
func TestResourceAWSDBSubnetGroupNameValidation(t *testing.T) { func TestResourceAWSDBSubnetGroupNameValidation(t *testing.T) {
cases := []struct { cases := []struct {
Value string Value string
@ -190,6 +221,39 @@ resource "aws_db_subnet_group" "foo" {
} }
` `
const testAccDBSubnetGroupConfig_updatedDescription = `
resource "aws_vpc" "foo" {
cidr_block = "10.1.0.0/16"
}
resource "aws_subnet" "foo" {
cidr_block = "10.1.1.0/24"
availability_zone = "us-west-2a"
vpc_id = "${aws_vpc.foo.id}"
tags {
Name = "tf-dbsubnet-test-1"
}
}
resource "aws_subnet" "bar" {
cidr_block = "10.1.2.0/24"
availability_zone = "us-west-2b"
vpc_id = "${aws_vpc.foo.id}"
tags {
Name = "tf-dbsubnet-test-2"
}
}
resource "aws_db_subnet_group" "foo" {
name = "foo"
description = "foo description updated"
subnet_ids = ["${aws_subnet.foo.id}", "${aws_subnet.bar.id}"]
tags {
Name = "tf-dbsubnet-group-test"
}
}
`
const testAccDBSubnetGroupConfig_withUnderscoresAndPeriodsAndSpaces = ` const testAccDBSubnetGroupConfig_withUnderscoresAndPeriodsAndSpaces = `
resource "aws_vpc" "main" { resource "aws_vpc" "main" {
cidr_block = "192.168.0.0/16" cidr_block = "192.168.0.0/16"