providers/aws: fix some broken tests

This commit is contained in:
Mitchell Hashimoto 2014-09-22 08:57:17 -07:00
parent 166847d5dc
commit bea81d7710
1 changed files with 5 additions and 5 deletions

View File

@ -36,13 +36,13 @@ func TestAccAWSDbSubnetGroup(t *testing.T) {
func testAccCheckDbSubnetGroupDestroy(s *terraform.State) error { func testAccCheckDbSubnetGroupDestroy(s *terraform.State) error {
conn := testAccProvider.rdsconn conn := testAccProvider.rdsconn
for _, rs := range s.Resources { for _, rs := range s.RootModule().Resources {
if rs.Type != "aws_db_subnet_group" { if rs.Type != "aws_db_subnet_group" {
continue continue
} }
// Try to find the resource // Try to find the resource
resp, err := conn.DescribeDBSubnetGroups(&rds.DescribeDBSubnetGroups{rs.ID}) resp, err := conn.DescribeDBSubnetGroups(&rds.DescribeDBSubnetGroups{rs.Primary.ID})
if err == nil { if err == nil {
if len(resp.DBSubnetGroups) > 0 { if len(resp.DBSubnetGroups) > 0 {
return fmt.Errorf("still exist.") return fmt.Errorf("still exist.")
@ -66,17 +66,17 @@ func testAccCheckDbSubnetGroupDestroy(s *terraform.State) error {
func testAccCheckDbSubnetGroupExists(n string, v *rds.DBSubnetGroup) resource.TestCheckFunc { func testAccCheckDbSubnetGroupExists(n string, v *rds.DBSubnetGroup) resource.TestCheckFunc {
return func(s *terraform.State) error { return func(s *terraform.State) error {
rs, ok := s.Resources[n] rs, ok := s.RootModule().Resources[n]
if !ok { if !ok {
return fmt.Errorf("Not found: %s", n) return fmt.Errorf("Not found: %s", n)
} }
if rs.ID == "" { if rs.Primary.ID == "" {
return fmt.Errorf("No ID is set") return fmt.Errorf("No ID is set")
} }
conn := testAccProvider.rdsconn conn := testAccProvider.rdsconn
resp, err := conn.DescribeDBSubnetGroups(&rds.DescribeDBSubnetGroups{rs.ID}) resp, err := conn.DescribeDBSubnetGroups(&rds.DescribeDBSubnetGroups{rs.Primary.ID})
if err != nil { if err != nil {
return err return err
} }