forked from aws-powertools/powertools-lambda-python
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsar_main.tf
41 lines (34 loc) · 1.24 KB
/
sar_main.tf
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
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.26.1"
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
}