From 81d3ade4c219641ec920a7ac718fcc0efb7b8699 Mon Sep 17 00:00:00 2001 From: Joshua Johnston Date: Thu, 28 Dec 2017 10:37:44 -0500 Subject: [PATCH] Handle RDS Cluster state `resetting-master-credentials` Addresses error when creating a new aws_rds_cluster using the `snapshot_identifier` option. ``` * aws_rds_cluster.aurora_postgres: [WARN] Error waiting for RDS Cluster state to be "available": unexpected state 'resetting-master-credentials', wanted target 'available'. last error: %!s() ``` --- aws/resource_aws_rds_cluster.go | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_rds_cluster.go b/aws/resource_aws_rds_cluster.go index 80cd7abab71..299153809bb 100644 --- a/aws/resource_aws_rds_cluster.go +++ b/aws/resource_aws_rds_cluster.go @@ -340,7 +340,7 @@ func resourceAwsRDSClusterCreate(d *schema.ResourceData, meta interface{}) error log.Println("[INFO] Waiting for RDS Cluster to be available") stateConf := &resource.StateChangeConf{ - Pending: []string{"creating", "backing-up", "modifying", "preparing-data-migration", "migrating"}, + Pending: resourceAwsRdsClusterCreatePendingStates, Target: []string{"available"}, Refresh: resourceAwsRDSClusterStateRefreshFunc(d, meta), Timeout: d.Timeout(schema.TimeoutCreate), @@ -497,7 +497,7 @@ func resourceAwsRDSClusterCreate(d *schema.ResourceData, meta interface{}) error "[INFO] Waiting for RDS Cluster to be available") stateConf := &resource.StateChangeConf{ - Pending: []string{"creating", "backing-up", "modifying"}, + Pending: resourceAwsRdsClusterCreatePendingStates, Target: []string{"available"}, Refresh: resourceAwsRDSClusterStateRefreshFunc(d, meta), Timeout: d.Timeout(schema.TimeoutCreate), @@ -765,7 +765,7 @@ func resourceAwsRDSClusterDelete(d *schema.ResourceData, meta interface{}) error } stateConf := &resource.StateChangeConf{ - Pending: []string{"available", "deleting", "backing-up", "modifying"}, + Pending: resourceAwsRdsClusterDeletePendingStates, Target: []string{"destroyed"}, Refresh: resourceAwsRDSClusterStateRefreshFunc(d, meta), Timeout: d.Timeout(schema.TimeoutDelete), @@ -859,3 +859,19 @@ func removeIamRoleFromRdsCluster(clusterIdentifier string, roleArn string, conn return nil } + +var resourceAwsRdsClusterCreatePendingStates = []string{ + "creating", + "backing-up", + "modifying", + "preparing-data-migration", + "migrating", + "resetting-master-credentials", +} + +var resourceAwsRdsClusterDeletePendingStates = []string{ + "available", + "deleting", + "backing-up", + "modifying", +}