Skip to content

Commit

Permalink
resource/aws_lambda_function: Increase IAM retry timeout for create t…
Browse files Browse the repository at this point in the history
…o 2 minutes (#14291)

References:
* #14285

Increased the retry timeout for eventual consistency IAM errors during a
lambda function create from 1 minute to 2 minute.

Output from acceptance testing:

```
make testacc TEST=./aws TESTARGS='-run=TestAccAWSLambdaFunction_'
...
--- PASS: TestAccAWSLambdaFunction_basic (28.86s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_java8 (34.46s)
--- PASS: TestAccAWSLambdaFunction_DeadLetterConfigUpdated (160.32s)
--- PASS: TestAccAWSLambdaFunction_VpcConfig_ProperIamDependencies (208.54s)
--- PASS: TestAccAWSLambdaFunction_VPC_withInvocation (567.54s)
--- PASS: TestAccAWSLambdaFunction_VPCRemoval (596.13s)
--- PASS: TestAccAWSLambdaFunction_LayersUpdate (49.02s)
--- PASS: TestAccAWSLambdaFunction_VPC (362.84s)
--- PASS: TestAccAWSLambdaFunction_VPCUpdate (797.25s)
--- PASS: TestAccAWSLambdaFunction_nilDeadLetterConfig (120.01s)
--- PASS: TestAccAWSLambdaFunction_DeadLetterConfig (51.30s)
--- PASS: TestAccAWSLambdaFunction_envVariables (153.15s)
--- PASS: TestAccAWSLambdaFunction_versioned (39.16s)
--- PASS: TestAccAWSLambdaFunction_versionedUpdate (61.80s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_python37 (31.16s)
--- PASS: TestAccAWSLambdaFunction_encryptedEnvVariables (51.77s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_dotnetcore31 (36.20s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_ruby27 (40.86s)
--- PASS: TestAccAWSLambdaFunction_Layers (38.54s)
--- PASS: TestAccAWSLambdaFunction_tracingConfig (51.87s)
--- PASS: TestAccAWSLambdaFunction_KmsKeyArn_NoEnvironmentVariables (36.57s)
--- PASS: TestAccAWSLambdaFunction_concurrencyCycle (54.03s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_ruby25 (36.53s)
--- PASS: TestAccAWSLambdaFunction_expectFilenameAndS3Attributes (13.34s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_python38 (28.27s)
--- PASS: TestAccAWSLambdaFunction_tags (51.19s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_java11 (36.59s)
--- PASS: TestAccAWSLambdaFunction_updateRuntime (51.42s)
--- PASS: TestAccAWSLambdaFunction_s3Update_unversioned (43.77s)
--- PASS: TestAccAWSLambdaFunction_localUpdate (39.80s)
--- PASS: TestAccAWSLambdaFunction_s3Update_basic (44.15s)
--- PASS: TestAccAWSLambdaFunction_localUpdate_nameOnly (40.02s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_python36 (32.09s)
--- PASS: TestAccAWSLambdaFunction_FileSystemConfig (721.87s)
--- PASS: TestAccAWSLambdaFunction_s3 (31.68s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_provided (36.48s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_python27 (33.63s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_NodeJs10x (38.17s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_noRuntime (0.91s)
--- PASS: TestAccAWSLambdaFunction_concurrency (46.63s)
--- PASS: TestAccAWSLambdaFunction_EmptyVpcConfig (38.38s)
--- PASS: TestAccAWSLambdaFunction_disappears (36.13s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_NodeJs12x (38.47s)
```
  • Loading branch information
camlow325 authored Jul 23, 2020
1 parent 80e3d1b commit 4e78ae6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions aws/resource_aws_lambda_function.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
"github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags"
iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter"
)

const awsMutexLambdaKey = `aws_lambda_function`
Expand Down Expand Up @@ -426,8 +427,8 @@ func resourceAwsLambdaFunctionCreate(d *schema.ResourceData, meta interface{}) e
params.Tags = keyvaluetags.New(v.(map[string]interface{})).IgnoreAws().LambdaTags()
}

// IAM changes can take 1 minute to propagate in AWS
err := resource.Retry(1*time.Minute, func() *resource.RetryError {
// IAM changes can take some time to propagate in AWS
err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError {
_, err := conn.CreateFunction(params)
if err != nil {
log.Printf("[DEBUG] Error creating Lambda Function: %s", err)
Expand Down

0 comments on commit 4e78ae6

Please sign in to comment.