Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provider/aws: Retry DB Creation on IAM propigation error #5515

Merged
merged 1 commit into from
Mar 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion builtin/providers/aws/resource_aws_db_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,18 @@ func resourceAwsDbInstanceCreate(d *schema.ResourceData, meta interface{}) error

log.Printf("[DEBUG] DB Instance create configuration: %#v", opts)
var err error
_, err = conn.CreateDBInstance(&opts)
err = resource.Retry(5*time.Minute, func() error {
_, err = conn.CreateDBInstance(&opts)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
if awsErr.Code() == "InvalidParameterValue" && strings.Contains(awsErr.Message(), "ENHANCED_MONITORING") {
return awsErr
}
}
return resource.RetryError{Err: err}
}
return nil
})
if err != nil {
return fmt.Errorf("Error creating DB Instance: %s", err)
}
Expand Down
2 changes: 1 addition & 1 deletion builtin/providers/aws/resource_aws_db_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ resource "aws_db_instance" "enhanced_monitoring" {
allocated_storage = 5
engine = "mysql"
engine_version = "5.6.21"
instance_class = "db.t2.small"
instance_class = "db.m3.medium"
name = "baz"
password = "barbarbarbar"
username = "foo"
Expand Down