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

ForceNew on Lambda alias name change #4106

Merged
merged 2 commits into from
Apr 9, 2018
Merged

Conversation

catsby
Copy link
Contributor

@catsby catsby commented Apr 6, 2018

When updating a Lamda Alias, the API uses the name as the ID of the alias to update. When updating the name of aws_lambda_alias, we're sending the new name from the config, which isn't found, so Terraform errors.

The next plan reads the new name from the config, and shows an addition to be made (not an update). Applying then creates a new alias, and orphans the old one.

91d8b16 is a regression test that will fail on the current master (84353e4)

Fixes #4090

catsby added 2 commits April 6, 2018 11:45
This test demonstrates the bug in
#4090
The name functions as the "id" here, with regards to identifying the
alias for an update operation
@ghost ghost added the size/M Managed by automation to categorize the size of a PR. label Apr 6, 2018
@catsby catsby added bug Addresses a defect in current functionality. size/S Managed by automation to categorize the size of a PR. and removed size/M Managed by automation to categorize the size of a PR. labels Apr 6, 2018
@catsby catsby requested a review from bflad April 6, 2018 18:11
@catsby
Copy link
Contributor Author

catsby commented Apr 6, 2018

Tests passing:

screen shot 2018-04-06 at 1 13 15 pm

@bflad bflad added the service/lambda Issues and PRs that pertain to the lambda service. label Apr 9, 2018
@bflad bflad added this to the v1.14.1 milestone Apr 9, 2018
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

Thanks for this fix! 🚀

2 tests passed (all tests)
=== RUN   TestAccAWSLambdaAlias_basic
--- PASS: TestAccAWSLambdaAlias_basic (26.95s)
=== RUN   TestAccAWSLambdaAlias_nameupdate
--- PASS: TestAccAWSLambdaAlias_nameupdate (34.92s)

testAccCheckAwsLambdaAliasExists("aws_lambda_alias.lambda_alias_test", &conf),
testAccCheckAwsLambdaAttributes(&conf),
resource.TestMatchResourceAttr("aws_lambda_alias.lambda_alias_test", "arn",
regexp.MustCompile(`^arn:aws:lambda:[a-z]+-[a-z]+-[0-9]+:\d{12}:function:`+funcName+`:`+aliasName+`$`)),
Copy link
Contributor

Choose a reason for hiding this comment

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

Future note: When we start testing outside the aws partition (e.g. US Government) these will break. We can go with something like ^arn:[^:]+:lambda:..., create a partition regex constant, or create our own test check wrapper function for AWS ARNs.

@bflad bflad merged commit 685d32d into master Apr 9, 2018
@bflad bflad deleted the lambda_alias_name_force_new branch April 9, 2018 12:38
bflad added a commit that referenced this pull request Apr 9, 2018
@bflad
Copy link
Contributor

bflad commented Apr 11, 2018

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

@ghost
Copy link

ghost commented Apr 6, 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 and limited conversation to collaborators Apr 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/lambda Issues and PRs that pertain to the lambda service. size/S Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provider attempts to update in line when Lambda alias name is changed
2 participants