diff --git a/aws/resource_aws_cognito_identity_pool.go b/aws/resource_aws_cognito_identity_pool.go index 45cb039e841..8fcef667c38 100644 --- a/aws/resource_aws_cognito_identity_pool.go +++ b/aws/resource_aws_cognito_identity_pool.go @@ -3,13 +3,11 @@ package aws import ( "fmt" "log" - "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/arn" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/cognitoidentity" - "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" ) @@ -245,15 +243,12 @@ func resourceAwsCognitoIdentityPoolDelete(d *schema.ResourceData, meta interface conn := meta.(*AWSClient).cognitoconn log.Printf("[DEBUG] Deleting Cognito Identity Pool: %s", d.Id()) - return resource.Retry(5*time.Minute, func() *resource.RetryError { - _, err := conn.DeleteIdentityPool(&cognitoidentity.DeleteIdentityPoolInput{ - IdentityPoolId: aws.String(d.Id()), - }) - - if err == nil { - return nil - } - - return resource.NonRetryableError(err) + _, err := conn.DeleteIdentityPool(&cognitoidentity.DeleteIdentityPoolInput{ + IdentityPoolId: aws.String(d.Id()), }) + + if err != nil { + return fmt.Errorf("Error deleting Cognito identity pool: %s", err) + } + return nil } diff --git a/aws/resource_aws_cognito_identity_pool_roles_attachment.go b/aws/resource_aws_cognito_identity_pool_roles_attachment.go index 0b62891cd0b..df8e3a00ac4 100644 --- a/aws/resource_aws_cognito_identity_pool_roles_attachment.go +++ b/aws/resource_aws_cognito_identity_pool_roles_attachment.go @@ -3,12 +3,10 @@ package aws import ( "fmt" "log" - "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/cognitoidentity" - "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" ) @@ -222,19 +220,17 @@ func resourceAwsCognitoIdentityPoolRolesAttachmentDelete(d *schema.ResourceData, conn := meta.(*AWSClient).cognitoconn log.Printf("[DEBUG] Deleting Cognito Identity Pool Roles Association: %s", d.Id()) - return resource.Retry(5*time.Minute, func() *resource.RetryError { - _, err := conn.SetIdentityPoolRoles(&cognitoidentity.SetIdentityPoolRolesInput{ - IdentityPoolId: aws.String(d.Get("identity_pool_id").(string)), - Roles: expandCognitoIdentityPoolRoles(make(map[string]interface{})), - RoleMappings: expandCognitoIdentityPoolRoleMappingsAttachment([]interface{}{}), - }) + _, err := conn.SetIdentityPoolRoles(&cognitoidentity.SetIdentityPoolRolesInput{ + IdentityPoolId: aws.String(d.Get("identity_pool_id").(string)), + Roles: expandCognitoIdentityPoolRoles(make(map[string]interface{})), + RoleMappings: expandCognitoIdentityPoolRoleMappingsAttachment([]interface{}{}), + }) - if err == nil { - return nil - } + if err != nil { + return fmt.Errorf("Error deleting Cognito identity pool roles association: %s", err) + } - return resource.NonRetryableError(err) - }) + return nil } // Validating that each role_mapping ambiguous_role_resolution diff --git a/aws/resource_aws_cognito_user_pool.go b/aws/resource_aws_cognito_user_pool.go index 6b31bbee3b2..6b8dfbcd12a 100644 --- a/aws/resource_aws_cognito_user_pool.go +++ b/aws/resource_aws_cognito_user_pool.go @@ -673,6 +673,9 @@ func resourceAwsCognitoUserPoolCreate(d *schema.ResourceData, meta interface{}) return resource.NonRetryableError(err) }) + if isResourceTimeoutError(err) { + resp, err = conn.CreateUserPool(params) + } if err != nil { return fmt.Errorf("Error creating Cognito User Pool: %s", err) } @@ -944,6 +947,9 @@ func resourceAwsCognitoUserPoolUpdate(d *schema.ResourceData, meta interface{}) return resource.NonRetryableError(err) }) + if isResourceTimeoutError(err) { + _, err = conn.UpdateUserPool(params) + } if err != nil { return fmt.Errorf("Error updating Cognito User pool: %s", err) }