provider/aws: Workaround API issue with RDS Cluster DatabaseName

This commit is contained in:
clint shryock 2016-01-26 10:35:21 -06:00
parent e10d7740b3
commit 8d3f309f62
2 changed files with 10 additions and 2 deletions

View File

@ -262,7 +262,15 @@ func resourceAwsRDSClusterRead(d *schema.ResourceData, meta interface{}) error {
if err := d.Set("availability_zones", aws.StringValueSlice(dbc.AvailabilityZones)); err != nil {
return fmt.Errorf("[DEBUG] Error saving AvailabilityZones to state for RDS Cluster (%s): %s", d.Id(), err)
}
d.Set("database_name", dbc.DatabaseName)
// Only set the DatabaseName if it is not nil. There is a known API bug where
// RDS accepts a DatabaseName but does not return it, causing a perpetual
// diff.
// See https://github.com/hashicorp/terraform/issues/4671 for backstory
if dbc.DatabaseName != nil {
d.Set("database_name", dbc.DatabaseName)
}
d.Set("db_subnet_group_name", dbc.DBSubnetGroup)
d.Set("endpoint", dbc.Endpoint)
d.Set("engine", dbc.Engine)

View File

@ -99,7 +99,7 @@ func testAccCheckAWSClusterDestroy(s *terraform.State) error {
// Return nil if the cluster is already destroyed
if awsErr, ok := err.(awserr.Error); ok {
if awsErr.Code() == "DBClusterNotFound" {
if awsErr.Code() == "DBClusterNotFoundFault" {
return nil
}
}