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

Update plan output to reflect publish(version, qualified_arn) when config changes #15121

Merged
merged 1 commit into from
Oct 29, 2020
Merged

Conversation

grahamhar
Copy link
Contributor

@grahamhar grahamhar commented Sep 11, 2020

When config changes, such as environment variables, a publish is triggered
and the state is updated with the new version, however as the values of
version and qualified_arn were not showing as computed any dependent resource,
such as aws_lambda_alias, would not be triggered to update.

I'm not too sure if the approach I've taken here is the best so I'll welcome any suggestions to improve this. I also couldn't find any test coverage around this area, if I've missed it please point me in the correct place.

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Relates OR Closes #14934

Release note for CHANGELOG:

Update plan output to reflect the changes to version and qualified_arn on config changes.

Output from acceptance testing:

$  make testacc TESTARGS='-run=TestAccAWSLambdaFunction_' 
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 15 -run=TestAccAWSLambdaFunction_ -timeout 120m
=== RUN   TestAccAWSLambdaFunction_basic
=== PAUSE TestAccAWSLambdaFunction_basic
=== RUN   TestAccAWSLambdaFunction_disappears
=== PAUSE TestAccAWSLambdaFunction_disappears
=== RUN   TestAccAWSLambdaFunction_concurrency
=== PAUSE TestAccAWSLambdaFunction_concurrency
=== RUN   TestAccAWSLambdaFunction_concurrencyCycle
=== PAUSE TestAccAWSLambdaFunction_concurrencyCycle
=== RUN   TestAccAWSLambdaFunction_expectFilenameAndS3Attributes
=== PAUSE TestAccAWSLambdaFunction_expectFilenameAndS3Attributes
=== RUN   TestAccAWSLambdaFunction_envVariables
=== PAUSE TestAccAWSLambdaFunction_envVariables
=== RUN   TestAccAWSLambdaFunction_encryptedEnvVariables
=== PAUSE TestAccAWSLambdaFunction_encryptedEnvVariables
=== RUN   TestAccAWSLambdaFunction_versioned
=== PAUSE TestAccAWSLambdaFunction_versioned
=== RUN   TestAccAWSLambdaFunction_versionedUpdate
=== PAUSE TestAccAWSLambdaFunction_versionedUpdate
=== RUN   TestAccAWSLambdaFunction_DeadLetterConfig
=== PAUSE TestAccAWSLambdaFunction_DeadLetterConfig
=== RUN   TestAccAWSLambdaFunction_DeadLetterConfigUpdated
=== PAUSE TestAccAWSLambdaFunction_DeadLetterConfigUpdated
=== RUN   TestAccAWSLambdaFunction_nilDeadLetterConfig
=== PAUSE TestAccAWSLambdaFunction_nilDeadLetterConfig
=== RUN   TestAccAWSLambdaFunction_FileSystemConfig
=== PAUSE TestAccAWSLambdaFunction_FileSystemConfig
=== RUN   TestAccAWSLambdaFunction_tracingConfig
=== PAUSE TestAccAWSLambdaFunction_tracingConfig
=== RUN   TestAccAWSLambdaFunction_KmsKeyArn_NoEnvironmentVariables
=== PAUSE TestAccAWSLambdaFunction_KmsKeyArn_NoEnvironmentVariables
=== RUN   TestAccAWSLambdaFunction_Layers
=== PAUSE TestAccAWSLambdaFunction_Layers
=== RUN   TestAccAWSLambdaFunction_LayersUpdate
=== PAUSE TestAccAWSLambdaFunction_LayersUpdate
=== RUN   TestAccAWSLambdaFunction_VPC
=== PAUSE TestAccAWSLambdaFunction_VPC
=== RUN   TestAccAWSLambdaFunction_VPCRemoval
=== PAUSE TestAccAWSLambdaFunction_VPCRemoval
=== RUN   TestAccAWSLambdaFunction_VPCUpdate
=== PAUSE TestAccAWSLambdaFunction_VPCUpdate
=== RUN   TestAccAWSLambdaFunction_VPC_withInvocation
=== PAUSE TestAccAWSLambdaFunction_VPC_withInvocation
=== RUN   TestAccAWSLambdaFunction_VpcConfig_ProperIamDependencies
=== PAUSE TestAccAWSLambdaFunction_VpcConfig_ProperIamDependencies
=== RUN   TestAccAWSLambdaFunction_EmptyVpcConfig
=== PAUSE TestAccAWSLambdaFunction_EmptyVpcConfig
=== RUN   TestAccAWSLambdaFunction_s3
=== PAUSE TestAccAWSLambdaFunction_s3
=== RUN   TestAccAWSLambdaFunction_localUpdate
=== PAUSE TestAccAWSLambdaFunction_localUpdate
=== RUN   TestAccAWSLambdaFunction_localUpdate_nameOnly
=== PAUSE TestAccAWSLambdaFunction_localUpdate_nameOnly
=== RUN   TestAccAWSLambdaFunction_s3Update_basic
=== PAUSE TestAccAWSLambdaFunction_s3Update_basic
=== RUN   TestAccAWSLambdaFunction_s3Update_unversioned
=== PAUSE TestAccAWSLambdaFunction_s3Update_unversioned
=== RUN   TestAccAWSLambdaFunction_tags
=== PAUSE TestAccAWSLambdaFunction_tags
=== RUN   TestAccAWSLambdaFunction_runtimes
=== PAUSE TestAccAWSLambdaFunction_runtimes
=== CONT  TestAccAWSLambdaFunction_basic
=== CONT  TestAccAWSLambdaFunction_LayersUpdate
=== CONT  TestAccAWSLambdaFunction_localUpdate
=== CONT  TestAccAWSLambdaFunction_runtimes
=== CONT  TestAccAWSLambdaFunction_tags
=== CONT  TestAccAWSLambdaFunction_s3Update_unversioned
=== CONT  TestAccAWSLambdaFunction_s3Update_basic
=== CONT  TestAccAWSLambdaFunction_versionedUpdate
=== CONT  TestAccAWSLambdaFunction_Layers
=== CONT  TestAccAWSLambdaFunction_localUpdate_nameOnly
=== CONT  TestAccAWSLambdaFunction_KmsKeyArn_NoEnvironmentVariables
=== CONT  TestAccAWSLambdaFunction_tracingConfig
=== CONT  TestAccAWSLambdaFunction_VPC_withInvocation
=== CONT  TestAccAWSLambdaFunction_FileSystemConfig
=== CONT  TestAccAWSLambdaFunction_s3
2020/09/11 18:58:30 [WARN] Truncating attribute path of 0 diagnostics for TypeSet
2020/09/11 18:58:30 [WARN] Truncating attribute path of 0 diagnostics for TypeSet
2020/09/11 18:58:30 [WARN] Truncating attribute path of 0 diagnostics for TypeSet
2020/09/11 18:58:30 [WARN] Truncating attribute path of 0 diagnostics for TypeSet
--- PASS: TestAccAWSLambdaFunction_s3 (63.39s)
=== CONT  TestAccAWSLambdaFunction_nilDeadLetterConfig
    TestAccAWSLambdaFunction_KmsKeyArn_NoEnvironmentVariables: resource_aws_lambda_function_test.go:686: [INFO] Got non-empty plan, as expected
2020/09/11 18:59:28 [DEBUG] Trying to get account information via sts:GetCallerIdentity
    TestAccAWSLambdaFunction_KmsKeyArn_NoEnvironmentVariables: resource_aws_lambda_function_test.go:686: [INFO] Got non-empty plan, as expected
--- PASS: TestAccAWSLambdaFunction_basic (89.47s)
=== CONT  TestAccAWSLambdaFunction_EmptyVpcConfig
--- PASS: TestAccAWSLambdaFunction_KmsKeyArn_NoEnvironmentVariables (94.39s)
=== CONT  TestAccAWSLambdaFunction_DeadLetterConfigUpdated
--- PASS: TestAccAWSLambdaFunction_s3Update_unversioned (95.62s)
=== CONT  TestAccAWSLambdaFunction_DeadLetterConfig
--- PASS: TestAccAWSLambdaFunction_s3Update_basic (95.95s)
=== CONT  TestAccAWSLambdaFunction_VpcConfig_ProperIamDependencies
--- PASS: TestAccAWSLambdaFunction_Layers (117.34s)
=== CONT  TestAccAWSLambdaFunction_VPCUpdate
--- PASS: TestAccAWSLambdaFunction_tracingConfig (128.85s)
=== CONT  TestAccAWSLambdaFunction_expectFilenameAndS3Attributes
--- PASS: TestAccAWSLambdaFunction_tags (132.00s)
=== CONT  TestAccAWSLambdaFunction_VPC
--- PASS: TestAccAWSLambdaFunction_expectFilenameAndS3Attributes (18.43s)
=== CONT  TestAccAWSLambdaFunction_versioned
--- PASS: TestAccAWSLambdaFunction_nilDeadLetterConfig (171.39s)
=== CONT  TestAccAWSLambdaFunction_VPCRemoval
--- PASS: TestAccAWSLambdaFunction_localUpdate (250.44s)
=== CONT  TestAccAWSLambdaFunction_encryptedEnvVariables
--- PASS: TestAccAWSLambdaFunction_localUpdate_nameOnly (250.76s)
=== CONT  TestAccAWSLambdaFunction_envVariables
--- PASS: TestAccAWSLambdaFunction_EmptyVpcConfig (174.97s)
=== CONT  TestAccAWSLambdaFunction_concurrency
--- PASS: TestAccAWSLambdaFunction_versionedUpdate (286.15s)
=== CONT  TestAccAWSLambdaFunction_disappears
--- PASS: TestAccAWSLambdaFunction_LayersUpdate (291.52s)
=== CONT  TestAccAWSLambdaFunction_concurrencyCycle
--- PASS: TestAccAWSLambdaFunction_DeadLetterConfigUpdated (204.19s)
--- PASS: TestAccAWSLambdaFunction_DeadLetterConfig (205.53s)
--- PASS: TestAccAWSLambdaFunction_VPC_withInvocation (434.76s)
--- PASS: TestAccAWSLambdaFunction_runtimes (502.46s)
--- PASS: TestAccAWSLambdaFunction_VpcConfig_ProperIamDependencies (562.41s)
--- PASS: TestAccAWSLambdaFunction_versioned (650.41s)
--- PASS: TestAccAWSLambdaFunction_VPC (680.04s)
    TestAccAWSLambdaFunction_disappears: resource_aws_lambda_function_test.go:105: [INFO] Got non-empty plan, as expected
--- PASS: TestAccAWSLambdaFunction_disappears (662.49s)
--- PASS: TestAccAWSLambdaFunction_VPCRemoval (722.36s)
--- PASS: TestAccAWSLambdaFunction_encryptedEnvVariables (712.64s)
--- PASS: TestAccAWSLambdaFunction_concurrency (706.63s)
--- PASS: TestAccAWSLambdaFunction_concurrencyCycle (710.59s)
--- PASS: TestAccAWSLambdaFunction_envVariables (769.69s)



--- PASS: TestAccAWSLambdaFunction_FileSystemConfig (2008.68s)
--- PASS: TestAccAWSLambdaFunction_VPCUpdate (2061.27s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       2180.108s


...

@grahamhar grahamhar requested a review from a team September 11, 2020 17:55
@ghost ghost added size/XS Managed by automation to categorize the size of a PR. service/lambda Issues and PRs that pertain to the lambda service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/S Managed by automation to categorize the size of a PR. and removed size/XS Managed by automation to categorize the size of a PR. labels Sep 11, 2020
Copy link

@acerbisgianluca acerbisgianluca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's perfect.

…nfig changes

When config changes, such as environment variables, a publish is triggered
and the state is updated with the new version, however as the values of
version and qualified_arn were not showing as computed any dependent resource,
such as aws_lambda_alias, would not be triggered to update.
@gdavison gdavison self-assigned this Oct 28, 2020
Copy link
Contributor

@gdavison gdavison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

--- PASS: TestAccAWSLambdaFunction_expectFilenameAndS3Attributes (32.85s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_FunctionName_Arn (65.93s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_basic (74.23s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_disappears_LambdaFunctionEventInvokeConfig (98.56s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_disappears_LambdaFunction (100.54s)
--- PASS: TestAccAWSLambdaFunction_disappears (100.78s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_Qualifier_Latest (105.30s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_Qualifier_FunctionName_Arn (105.76s)
--- PASS: TestAccAWSLambdaFunction_basic (106.63s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_Qualifier_FunctionVersion (107.34s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_Qualifier_AliasName (108.01s)
--- PASS: TestAccAWSLambdaFunction_nilDeadLetterConfig (35.41s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_MaximumEventAgeInSeconds (152.13s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_DestinationConfig_Remove (154.09s)
--- PASS: TestAccAWSLambdaFunction_concurrency (158.25s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_DestinationConfig_Swap (158.28s)
--- PASS: TestAccAWSLambdaFunction_versioned (92.09s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_DestinationConfig_OnFailure_Destination (169.20s)
--- PASS: TestAccAWSLambdaFunction_encryptedEnvVariables (141.85s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_DestinationConfig_OnSuccess_Destination (180.75s)
--- PASS: TestAccAWSLambdaFunction_KmsKeyArn_NoEnvironmentVariables (91.06s)
--- PASS: TestAccAWSLambdaFunction_Layers (90.88s)
--- PASS: TestAccAWSLambdaFunction_concurrencyCycle (200.34s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_MaximumRetryAttempts (202.08s)
--- PASS: TestAccAWSLambdaFunction_DeadLetterConfigUpdated (126.41s)
--- PASS: TestAccAWSLambdaFunction_DeadLetterConfig (128.84s)
--- PASS: TestAccAWSLambdaFunction_tracingConfig (125.36s)
--- PASS: TestAccAWSLambdaFunction_EmptyVpcConfig (72.79s)
--- PASS: TestAccAWSLambdaFunction_LayersUpdate (128.68s)
--- PASS: TestAccAWSLambdaFunction_s3 (68.31s)
--- PASS: TestAccAWSLambdaFunction_envVariables (239.46s)
--- PASS: TestAccAWSLambdaFunction_versionedUpdate (165.48s)
--- PASS: TestAccAWSLambdaFunction_localUpdate (82.25s)
--- PASS: TestAccAWSLambdaFunction_localUpdate_nameOnly (77.26s)
--- PASS: TestAccAWSLambdaFunction_s3Update_basic (67.85s)
--- PASS: TestAccAWSLambdaFunction_s3Update_unversioned (68.86s)
--- PASS: TestAccAWSLambdaFunction_tags (82.36s)
--- PASS: TestAccAWSLambdaFunction_VpcConfig_ProperIamDependencies (267.39s)
--- PASS: TestAccAWSLambdaFunction_runtimes (311.61s)
--- PASS: TestAccAWSLambdaFunction_VPC_withInvocation (692.65s)
--- PASS: TestAccAWSLambdaFunction_VPC (717.03s)
--- PASS: TestAccAWSLambdaFunction_VPCUpdate (911.81s)
--- PASS: TestAccAWSLambdaFunction_VPCRemoval (1673.17s)
--- PASS: TestAccAWSLambdaFunction_FileSystemConfig (2054.66s)

@gdavison gdavison added this to the v3.13.0 milestone Oct 28, 2020
@gdavison gdavison merged commit f3f6841 into hashicorp:master Oct 29, 2020
gdavison added a commit that referenced this pull request Oct 29, 2020
@ghost
Copy link

ghost commented Oct 29, 2020

This has been released in version 3.13.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Nov 29, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Nov 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/lambda Issues and PRs that pertain to the lambda service. size/S Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changes to Lambda environment variables don't trigger a new version publication
4 participants