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

feat: Add support for AWS Graviton2 powered functions #206

Merged
merged 2 commits into from
Oct 2, 2021

Conversation

Infra-Red
Copy link
Contributor

@Infra-Red Infra-Red commented Sep 30, 2021

Description

Allow to configure architectures property in aws_lambda_function and compatible_architectures property in aws_lambda_layer_version configuration.

Motivation and Context

Add missing parameter that is required to support AWS Lambda Functions Powered by AWS Graviton2 Processor.

https://aws.amazon.com/blogs/aws/aws-lambda-functions-powered-by-aws-graviton2-processor-run-your-functions-on-arm-and-get-up-to-34-better-price-performance/

Breaking Changes

None.

How Has This Been Tested?

  • I have tested and validated these changes using one or more of the provided examples/* projects

Closes #207

@Infra-Red Infra-Red marked this pull request as draft September 30, 2021 16:15
Copy link
Member

@antonbabenko antonbabenko left a comment

Choose a reason for hiding this comment

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

Thank you for this PR! The draft looks great, there are couple of small things to do:

  1. Update minimum version requirements in versions.tf everywhere and rerun pre-commit run -a to fix documentation (when the updated provider is released)?
  2. Add support for the same feature in the Lambda Layer resource (compatible_architectures)?
  3. Update example code to have at least one function deploying using arm64 architecture.

If you can, please double-check whether we need to do anything in package.{tf,py} related to the way how the filename hash is computed to make sure that the same function (same runtime, same source) can be deployed in different architectures? If there are any changes required, please make an issue about it and we take it in a separate PR.

@Infra-Red
Copy link
Contributor Author

Hi @antonbabenko, I've updated this PR in accordance with your comments, please review when you get a chance.

For the package.{tf,py} I see that it is possible to update the Lambda architecture without changing the filename:

  1. Update a function to use different architecture:
    Terraform will perform the following actions:
    
     # module.lambda_function.aws_lambda_function.this[0] will be updated in-place
     ~ resource "aws_lambda_function" "this" {
         ~ architectures                  = [
             - "x86_64",
             + "arm64",
           ]
           id                             = "clear-earwig-lambda-async"
         ~ last_modified                  = "2021-10-02T13:04:47.276+0000" -> (known after apply)
           tags                           = {}
           # (18 unchanged attributes hidden)
    
           # (1 unchanged block hidden)
       }
    
    Plan: 0 to add, 1 to change, 0 to destroy.
    
  2. Apply the changes:
    > terraform apply .plan
    module.lambda_function.aws_lambda_function.this[0]: Modifying... [id=clear-earwig-lambda-async]
    module.lambda_function.aws_lambda_function.this[0]: Modifications complete after 7s [id=clear-earwig-lambda-async]
    
    Apply complete! Resources: 0 added, 1 changed, 0 destroyed.
    

@Infra-Red Infra-Red marked this pull request as ready for review October 2, 2021 13:13
@antonbabenko
Copy link
Member

Can you also update a complete example to show compatible_architectures in Lambda Layer? Then this PR will be good to merge.

@Infra-Red
Copy link
Contributor Author

Thanks @antonbabenko, compete example has been updated to include compatible_architectures in Lambda layers.

@antonbabenko antonbabenko merged commit 3873c10 into terraform-aws-modules:master Oct 2, 2021
@antonbabenko
Copy link
Member

Thank you, @Infra-Red !

v2.20.0 has been just released.

@Infra-Red Infra-Red deleted the arch-support branch October 2, 2021 19:37
@github-actions
Copy link

github-actions bot commented Nov 9, 2022

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support selection of instruction set architecture
2 participants