Merge pull request #4838 from hashicorp/b-aws-rds-db-name-fix

provider/aws: Workaround API issue with RDS Cluster DatabaseName
This commit is contained in:
Clint 2016-01-26 14:08:42 -06:00
commit 24f10b024f
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)
}
// 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
}
}