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

#8506 ability to import an existing lambda alias to terraform state #8513

Merged
merged 2 commits into from
May 9, 2019
Merged

#8506 ability to import an existing lambda alias to terraform state #8513

merged 2 commits into from
May 9, 2019

Conversation

richardjennings
Copy link
Contributor

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" comments, they generate extra noise for pull request followers and do not help prioritize the request

Fixes #8506

Release note for CHANGELOG:

Import of existing lambda aliases to terraform state

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccAWSLambdaAlias_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSLambdaAlias_basic -timeout 120m
?       github.com/terraform-providers/terraform-provider-aws   [no test files]
=== RUN   TestAccAWSLambdaAlias_basic
=== PAUSE TestAccAWSLambdaAlias_basic
=== CONT  TestAccAWSLambdaAlias_basic
--- PASS: TestAccAWSLambdaAlias_basic (45.47s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       45.518s

@ghost ghost added size/S 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. labels May 3, 2019
@ghost ghost added the documentation Introduces or discusses updates to documentation. label May 3, 2019
@bflad bflad added the enhancement Requests to existing resources that expand the functionality or scope. label May 9, 2019
@bflad bflad added this to the v2.10.0 milestone May 9, 2019
Copy link
Member

@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.

LGTM, thanks so much, @richardjennings! 🚀

Output from acceptance testing:

--- PASS: TestAccAWSLambdaAlias_basic (34.51s)
--- PASS: TestAccAWSLambdaAlias_nameupdate (40.00s)
--- PASS: TestAccAWSLambdaAlias_routingconfig (45.76s)

@@ -117,6 +120,7 @@ func resourceAwsLambdaAliasRead(d *schema.ResourceData, meta interface{}) error
d.Set("function_version", aliasConfiguration.FunctionVersion)
d.Set("name", aliasConfiguration.Name)
d.Set("arn", aliasConfiguration.AliasArn)
d.SetId(*aliasConfiguration.AliasArn)
Copy link
Member

Choose a reason for hiding this comment

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

Typically d.SetId() should only be called during Create and Importer State functions, however this is understandably a little more nuanced here since if we followed that rule here we would need the entire alias ARN passed into terraform import or to make an additional API call in the import function which is less than ideal. I'm okay with merging this as-is for now to get this functionality in. 👍

@bflad bflad merged commit cc0d186 into hashicorp:master May 9, 2019
bflad added a commit that referenced this pull request May 9, 2019
@bflad
Copy link
Member

bflad commented May 10, 2019

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

@ghost
Copy link

ghost commented Mar 30, 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 Mar 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. 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.

Support import for aws_lambda_alias
3 participants