File size: 1,302 Bytes
e9d47d5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | 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:us-east-1:057560766410:applications/aws-lambda-powertools-python-layer"
semantic_version = var.aws_powertools_version
}
variable "aws_powertools_version" {
type = string
default = "2.43.1"
description = "The Powertools for AWS Lambda (Python) release version"
}
output "deployed_powertools_sar_version" {
value = data.aws_serverlessapplicationrepository_application.sar_app.semantic_version
}
# Fetch Powertools for AWS Lambda (Python) Layer ARN from deployed SAR App
output "aws_lambda_powertools_layer_arn" {
value = aws_serverlessapplicationrepository_cloudformation_stack.deploy_sar_stack.outputs.LayerVersionArn
}
|