diff --git a/aws/config.go b/aws/config.go index fa37b7f5173..efd4b2300ef 100644 --- a/aws/config.go +++ b/aws/config.go @@ -497,6 +497,19 @@ func (c *Config) Client() (interface{}, error) { } }) + client.kinesisconn.Handlers.Retry.PushBack(func(r *request.Request) { + if r.Operation.Name == "CreateStream" { + if isAWSErr(r.Error, kinesis.ErrCodeLimitExceededException, "simultaneously be in CREATING or DELETING") { + r.Retryable = aws.Bool(true) + } + } + if r.Operation.Name == "CreateStream" || r.Operation.Name == "DeleteStream" { + if isAWSErr(r.Error, kinesis.ErrCodeLimitExceededException, "Rate exceeded for stream") { + r.Retryable = aws.Bool(true) + } + } + }) + return &client, nil } diff --git a/aws/resource_aws_kinesis_stream.go b/aws/resource_aws_kinesis_stream.go index 87b050e3d6c..cf4a60430b2 100644 --- a/aws/resource_aws_kinesis_stream.go +++ b/aws/resource_aws_kinesis_stream.go @@ -106,19 +106,7 @@ func resourceAwsKinesisStreamCreate(d *schema.ResourceData, meta interface{}) er StreamName: aws.String(sn), } - err := resource.Retry(5*time.Minute, func() *resource.RetryError { - _, err := conn.CreateStream(createOpts) - if isAWSErr(err, kinesis.ErrCodeLimitExceededException, "simultaneously be in CREATING or DELETING") { - return resource.RetryableError(err) - } - // AWS (un)helpfully raises LimitExceededException - // rather than ThrottlingException here - if isAWSErr(err, kinesis.ErrCodeLimitExceededException, "Rate exceeded for stream") { - return resource.RetryableError(err) - } - return resource.NonRetryableError(err) - }) - + _, err := conn.CreateStream(createOpts) if err != nil { return fmt.Errorf("Unable to create stream: %s", err) } @@ -222,18 +210,8 @@ func resourceAwsKinesisStreamDelete(d *schema.ResourceData, meta interface{}) er conn := meta.(*AWSClient).kinesisconn sn := d.Get("name").(string) - err := resource.Retry(5*time.Minute, func() *resource.RetryError { - _, err := conn.DeleteStream(&kinesis.DeleteStreamInput{ - StreamName: aws.String(sn), - }) - if err != nil { - if isAWSErr(err, kinesis.ErrCodeLimitExceededException, "Rate exceeded for stream") { - return resource.RetryableError(err) - } - - return resource.NonRetryableError(err) - } - return nil + _, err := conn.DeleteStream(&kinesis.DeleteStreamInput{ + StreamName: aws.String(sn), }) if err != nil { return err