Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…tools-python into develop

* 'develop' of https://github.com/awslabs/aws-lambda-powertools-python:
  docs: Terraform reference for SAR Lambda Layer (aws-powertools#716)
  chore(deps-dev): bump flake8-bugbear from 21.9.1 to 21.9.2 (aws-powertools#712)
  chore(deps): bump boto3 from 1.18.49 to 1.18.51 (aws-powertools#713)
  chore(deps): bump boto3 from 1.18.41 to 1.18.49 (aws-powertools#703)
  chore(deps): bump codecov/codecov-action from 2.0.2 to 2.1.0 (aws-powertools#675)
  • Loading branch information
heitorlessa committed Oct 1, 2021
2 parents 573ef89 + 68c810e commit fd516d2
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Complexity baseline
run: make complexity-baseline
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2.0.2
uses: codecov/codecov-action@v2.1.0
with:
file: ./coverage.xml
# flags: unittests
Expand Down
48 changes: 48 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,54 @@ If using SAM, you can include this SAR App as part of your shared Layers stack,
)
```

=== "Terraform"

> Credits to [Dani Comnea](https://github.com/DanyC97) for providing the Terraform equivalent.

```terraform hl_lines="12-13 15-20 23-25 40"
terraform {
required_version = "~> 0.13"
required_providers {
aws = "~> 3.50.0"
}
}

provider "aws" {
region = "us-east-1"
}

resource "aws_serverlessapplicationrepository_cloudformation_stack" "deploy_sar_stack" {
name = "aws-lambda-powertools-python-layer"

application_id = data.aws_serverlessapplicationrepository_application.sar_app.application_id
semantic_version = data.aws_serverlessapplicationrepository_application.sar_app.semantic_version
capabilities = [
"CAPABILITY_IAM",
"CAPABILITY_NAMED_IAM"
]
}

data "aws_serverlessapplicationrepository_application" "sar_app" {
application_id = "arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer"
semantic_version = var.aws_powertools_version
}

variable "aws_powertools_version" {
type = string
default = "1.20.2"
description = "The AWS Powertools release version"
}

output "deployed_powertools_sar_version" {
value = data.aws_serverlessapplicationrepository_application.sar_app.semantic_version
}

# Fetch Lambda Powertools Layer ARN from deployed SAR App
output "aws_lambda_powertools_layer_arn" {
value = aws_serverlessapplicationrepository_cloudformation_stack.deploy_sar_stack.outputs.LayerVersionArn
}
```

??? tip "Example of least-privileged IAM permissions to deploy Layer"

> Credits to [mwarkentin](https://github.com/mwarkentin) for providing the scoped down IAM permissions.
Expand Down
25 changes: 13 additions & 12 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ bandit = "^1.7.0"
radon = "^5.1.0"
xenon = "^0.8.0"
flake8-eradicate = "^1.1.0"
flake8-bugbear = "^21.9.1"
flake8-bugbear = "^21.9.2"
mkdocs-material = "^7.3.0"
mkdocs-git-revision-date-plugin = "^0.3.1"
mike = "^0.6.0"
Expand Down

0 comments on commit fd516d2

Please sign in to comment.