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

docs: Terraform reference for SAR Lambda Layer #716

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,47 @@ If using SAM, you can include this SAR App as part of your shared Layers stack,
)
```

=== "Terraform"

```terraform hl_lines="24-25"
DanyC97 marked this conversation as resolved.
Show resolved Hide resolved
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.app.semantic_version
}
```

??? 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