거의 모든 지원되는 AWS Lambda 리소스를 생성하고 기능 및 계층에 필요한 Lambda 의존성을 구축하고 포장하는 Terraform Module.
이 Terraform 모듈은 Serverless.tf 프레임 워크의 일부이며 Terraform에서 서버리스로 작업 할 때 모든 작업을 단순화하는 것을 목표로합니다.
serverless.tf
모듈과의 통합을 지원합니다 (예제 참조). module "lambda_function" {
source = " terraform-aws-modules/lambda/aws "
function_name = " my-lambda1 "
description = " My awesome lambda function "
handler = " index.lambda_handler "
runtime = " python3.12 "
source_path = " ../src/lambda-function1 "
tags = {
Name = " my-lambda1 "
}
}
module "lambda_function" {
source = " terraform-aws-modules/lambda/aws "
function_name = " lambda-with-layer "
description = " My awesome lambda function "
handler = " index.lambda_handler "
runtime = " python3.12 "
publish = true
source_path = " ../src/lambda-function1 "
store_on_s3 = true
s3_bucket = " my-bucket-id-with-lambda-builds "
layers = [
module . lambda_layer_s3 . lambda_layer_arn ,
]
environment_variables = {
Serverless = " Terraform "
}
tags = {
Module = " lambda-with-layer "
}
}
module "lambda_layer_s3" {
source = " terraform-aws-modules/lambda/aws "
create_layer = true
layer_name = " lambda-layer-s3 "
description = " My amazing lambda layer (deployed from S3) "
compatible_runtimes = [ " python3.12 " ]
source_path = " ../src/lambda-layer "
store_on_s3 = true
s3_bucket = " my-bucket-id-with-lambda-builds "
}
module "lambda_function_existing_package_local" {
source = " terraform-aws-modules/lambda/aws "
function_name = " my-lambda-existing-package-local "
description = " My awesome lambda function "
handler = " index.lambda_handler "
runtime = " python3.12 "
create_package = false
local_existing_package = " ../existing_package.zip "
}
기능 코드 및 인프라 리소스 (예 : IAM 권한, 정책, 이벤트 등)를 별도의 흐름 (예 : 다른 리포지토리, 팀, CI/CD 파이프 라인)으로 관리하려는 경우.
ignore_source_code_hash = true
를 설정하여 모듈을 사용하여 배포 (및 롤백)를 끄는 소스 코드 추적을 비활성화하고 더미 함수를 배포하십시오.
인프라와 더미 함수가 배포되면 외부 도구를 사용하여 기능의 소스 코드 (예 : AWS CLI 사용)를 업데이트하고 Terraform을 통해이 모듈을 계속 사용하여 인프라를 관리 할 수 있습니다.
local_existing_package
값의 변경 사항은 Terraform을 통해 배포를 유발할 수 있습니다.
module "lambda_function_externally_managed_package" {
source = " terraform-aws-modules/lambda/aws "
function_name = " my-lambda-externally-managed-package "
description = " My lambda function code is deployed separately "
handler = " index.lambda_handler "
runtime = " python3.12 "
create_package = false
local_existing_package = " ./lambda_functions/code.zip "
ignore_source_code_hash = true
}
이 모듈은 사전 제작 된 패키지를 S3 버킷에 복사하지 않습니다. 이 모듈은 로컬 및 S3 버킷에 구축되는 패키지 만 저장할 수 있습니다.
locals {
my_function_source = " ../path/to/package.zip "
}
resource "aws_s3_bucket" "builds" {
bucket = " my-builds "
acl = " private "
}
resource "aws_s3_object" "my_function" {
bucket = aws_s3_bucket . builds . id
key = " ${ filemd5 (local . my_function_source ) } .zip "
source = local . my_function_source
}
module "lambda_function_existing_package_s3" {
source = " terraform-aws-modules/lambda/aws "
function_name = " my-lambda-existing-package-local "
description = " My awesome lambda function "
handler = " index.lambda_handler "
runtime = " python3.12 "
create_package = false
s3_existing_package = {
bucket = aws_s3_bucket.builds.id
key = aws_s3_object.my_function.id
}
}
module "lambda_function_container_image" {
source = " terraform-aws-modules/lambda/aws "
function_name = " my-lambda-existing-package-local "
description = " My awesome lambda function "
create_package = false
image_uri = " 132367819851.dkr.ecr.eu-west-1.amazonaws.com/complete-cow:1.0 "
package_type = " Image "
}
module "lambda_layer_local" {
source = " terraform-aws-modules/lambda/aws "
create_layer = true
layer_name = " my-layer-local "
description = " My amazing lambda layer (deployed from local) "
compatible_runtimes = [ " python3.12 " ]
source_path = " ../fixtures/python-app1 "
}
module "lambda_layer_s3" {
source = " terraform-aws-modules/lambda/aws "
create_layer = true
layer_name = " my-layer-s3 "
description = " My amazing lambda layer (deployed from S3) "
compatible_runtimes = [ " python3.12 " ]
source_path = " ../fixtures/python-app1 "
store_on_s3 = true
s3_bucket = " my-bucket-id-with-lambda-builds "
}
Lambda@Edge 기능을 미국 동부 (N. Virginia) 지역 ( us-east-1
)에 배포하십시오. Lambda 기능에 대한 요구 사항 및 제한 사항을 참조하십시오.
module "lambda_at_edge" {
source = " terraform-aws-modules/lambda/aws "
lambda_at_edge = true
function_name = " my-lambda-at-edge "
description = " My awesome lambda@edge function "
handler = " index.lambda_handler "
runtime = " python3.12 "
source_path = " ../fixtures/python-app1 "
tags = {
Module = " lambda-at-edge "
}
}
module "lambda_function_in_vpc" {
source = " terraform-aws-modules/lambda/aws "
function_name = " my-lambda-in-vpc "
description = " My awesome lambda function "
handler = " index.lambda_handler "
runtime = " python3.12 "
source_path = " ../fixtures/python-app1 "
vpc_subnet_ids = module . vpc . intra_subnets
vpc_security_group_ids = [ module . vpc . default_security_group_id ]
attach_network_policy = true
}
module "vpc" {
source = " terraform-aws-modules/vpc/aws "
name = " my-vpc "
cidr = " 10.10.0.0/16 "
# Specify at least one of: intra_subnets, private_subnets, or public_subnets
azs = [ " eu-west-1a " , " eu-west-1b " , " eu-west-1c " ]
intra_subnets = [ " 10.10.101.0/24 " , " 10.10.102.0/24 " , " 10.10.103.0/24 " ]
}
IAM 정책을 Lambda Function에서 사용하는 IAM 역할에 첨부하는 6 가지 지원 방법이 있습니다.
policy_json
-json string 또는 heredoc, attach_policy_json = true
.policy_jsons
attach_policy_jsons = true
및 number_of_policy_jsons > 0
일 때 JSON 문자열 또는 heredoc 목록.policy
attach_policy = true
일 때 기존 IAM 정책의 ARN.policies
- attach_policies = true
및 number_of_policies > 0
인 경우 기존 IAM 정책의 ARN 목록.policy_statements
IAM 정책으로 생성 될 iAM 문을 정의하기위한지도의 맵. attach_policy_statements = true
가 필요합니다. 자세한 내용은 examples/complete
참조하십시오.assume_role_policy_statements
LAMBDA 기능 역할 (신뢰 관계)을 가정하기위한 IAM 정책으로 생성 될 IAM 문을 정의하는 맵의 맵. 자세한 내용은 examples/complete
참조하십시오. 특정 리소스가 Lambda 기능을 호출 할 수 있도록 Lambda 권한을 지정해야합니다.
module "lambda_function" {
source = " terraform-aws-modules/lambda/aws "
# ...omitted for brevity
allowed_triggers = {
Config = {
principal = " config.amazonaws.com "
principal_org_id = " o-abcdefghij "
}
APIGatewayAny = {
service = " apigateway "
source_arn = " arn:aws:execute-api:eu-west-1:135367859851:aqnku8akd0/*/*/* "
},
APIGatewayDevPost = {
service = " apigateway "
source_arn = " arn:aws:execute-api:eu-west-1:135367859851:aqnku8akd0/dev/POST/* "
},
OneRule = {
principal = " events.amazonaws.com "
source_arn = " arn:aws:events:eu-west-1:135367859851:rule/RunDaily "
}
}
}
때로는 자원을 조건부로 만들 수있는 방법이 필요하지만 Terraform은 내부 module
블록 내부 count
사용하지 않으므로 솔루션은 인수 create
지정하는 것입니다.
module "lambda" {
source = " terraform-aws-modules/lambda/aws "
create = false # to disable all resources
create_package = false # to control build package process
create_function = false # to control creation of the Lambda Function and related resources
create_layer = false # to control creation of the Lambda Layer and related resources
create_role = false # to control creation of the IAM role and policies required for Lambda Function
attach_cloudwatch_logs_policy = false
attach_dead_letter_policy = false
attach_network_policy = false
attach_tracing_policy = false
attach_async_event_policy = false
# ... omitted
}
이것은 모듈에 의해 수행 된 가장 복잡한 부분 중 하나이며 일반적으로 내부를 알 필요가 없습니다.
package.py
는 파이썬 스크립트입니다. Python 3.6 또는 새로운 것이 설치되어 있는지 확인하십시오. 스크립트의 주요 기능은 파일의 내용을 기반으로 Zip-Archive의 파일 이름을 생성하고 Zip-Archive가 이미 작성되었는지 확인하고 필요한 경우에만 Zip-Archive를 작성하는 것입니다 ( plan
아닌 apply
중). .
파일의 동일한 내용으로 생성 된 Zip-Archive의 해시는 항상 동일하며 컨텐츠가 수정되지 않는 한 Lambda 리소스의 불필요한 힘 업데이트를 방지합니다. 동일한 컨텐츠에 대해 다른 파일 이름이 필요한 경우 추가 문자열 인수 hash_extra
지정할 수 있습니다.
동일한 source_path
로 패키지를 생성하기 위해이 모듈을 한 번에 여러 번 호출 할 때 동일한 파일에 동시 쓰기로 인해 Zip-Ararchives가 손상됩니다. hash_extra
에 대한 다른 값을 설정하여 다른 아카이브를 만들거나 외부에서 한 번 패키지를 만들고 (이 모듈 사용) local_existing_package
를 만들고 다른 Lambda 리소스를 생성하기 위해 두 가지 솔루션이 있습니다 (이 모듈 사용)를 통과하십시오.
건축 및 포장은 역사적으로 디버그하기가 어려웠으므로 (특히 TerraForm의 경우) 사용자가 디버그 정보를보다 쉽게 볼 수 있도록 노력했습니다. 디버그 - DEBUG
- 계획 단계에서 발생하는 일과 DEBUG2
적용한 경우 ZIP 파일 컨텐츠 필터링 방법 만 보려면 모든 로깅 값, DEBUG3
to DUMP_ENV
볼 수 있습니다. 모든 로깅 값과 ENV 변수를 참조하십시오 (비밀이 포함되어 있으므로 ENV 변수를 공유하십시오!).
사용자는 다음과 같은 디버그 레벨을 지정할 수 있습니다.
export TF_LAMBDA_PACKAGE_LOG_LEVEL=DEBUG2
terraform apply
사용자는 일부 상황에서 도움이 될 수있는 patterns
으로 HEREDOC 문자열의 주석을 활성화 할 수 있습니다. 이를 수행하려면이 환경 변수를 설정합니다.
export TF_LAMBDA_PACKAGE_PATTERN_COMMENTS=true
terraform apply
로컬 또는 Docker에 배치 패키지를 구축 할 때 원하는 유연성을 달성하기 위해 다양한 방법으로 source_path
지정할 수 있습니다. 절대 또는 상대 경로를 사용할 수 있습니다. TerraForm 파일을 하위 디렉토리에 배치 한 경우 TerraForm 파일의 위치가 아닌 terraform plan
실행되는 디렉토리에서 상대 경로가 지정됩니다.
로컬로 구축 할 때는 패키지를 만들 때 소스 디렉토리의 어느 곳에서나 파일을 복사하지 않으므로 빠른 파이썬 정규 표현식을 사용하여 일치하는 파일 및 디렉토리를 찾아 포장이 매우 빠르고 이해하기 쉽습니다.
source_path
문자열로 설정되면 해당 경로의 내용이 배포 패키지를 생성하는 데 사용됩니다.
source_path = "src/function1"
source_path
디렉토리 목록으로 설정되면 각각의 내용이 가져오고 하나의 아카이브가 생성됩니다.
이는 여러 종속성을 가진 여러 소스에서 배포 패키지를 작성하는 가장 완전한 방법입니다. 이 예제는 사용 가능한 옵션 중 일부를 보여줍니다 (예 : 예제/빌드 패키지 및 예제/런타임 참조).
source_path = [
" src/main-source " ,
" src/another-source/index.py " ,
{
path = " src/function1-dep " ,
patterns = [
" !.*/.* \ .txt " , # Skip all txt files recursively
]
}, {
path = " src/python-app1 " ,
pip_requirements = true ,
pip_tmp_dir = " /tmp/dir/location "
prefix_in_zip = " foo/bar1 " ,
}, {
path = " src/python-app2 " ,
pip_requirements = " requirements-large.txt " ,
patterns = [
" !vendor/colorful-0.5.4.dist-info/RECORD " ,
" !vendor/colorful-.+.dist-info/.* " ,
" !vendor/colorful/__pycache__/?.* " ,
]
}, {
path = " src/nodejs14.x-app1 " ,
npm_requirements = true ,
npm_tmp_dir = " /tmp/dir/location "
prefix_in_zip = " foo/bar1 " ,
}, {
path = " src/python-app3 " ,
commands = [
" npm install " ,
" :zip "
],
patterns = [
" !.*/.* \ .txt " , # Skip all txt files recursively
" node_modules/.+ " , # Include all node_modules
],
}, {
path = " src/python-app3 " ,
commands = [ " go build " ],
patterns = << END
bin/.*
abc/def/.*
END
}
]
몇 가지 메모 :
python
또는 nodejs
로 시작하는 경우, 빌드 프로세스는 requirements.txt
을 자동으로 빌드하고 package.json
종속성을 구축하면 소스 폴더에서 찾을 수 있습니다. 이 동작을 사용자 정의하려면 아래 설명대로 객체 표기법을 사용하십시오.path
제외한 모든 인수는 선택 사항입니다.patterns
- 파이썬 Regex 파일 이름의 목록은 만족해야합니다. 기본값은 patterns = [".*"]
와 동일한 "모든 것을 포함"입니다. 이것은 또한 멀티 린 HEREDOC 문자열로 지정할 수 있습니다 (주석 허용되지 않음). 유효한 패턴의 일부 예 :commands
옵션과 다중 명령을 체인하는 경우 마지막 명령의 종료 코드 만 성공을 확인합니다. 빠르게 실패하기를 원한다면 Bash 옵션 set -e
또는 PowerShell 옵션 $ErrorActionPreference="Stop"
으로 명령을 시작하십시오. !. * /. * .txt # Filter all txt files recursively
node_modules/. * # Include empty dir or with a content if it exists
node_modules/.+ # Include full non empty node_modules dir with its content
node_modules/ # Include node_modules itself without its content
# It's also a way to include an empty dir if it exists
node_modules # Include a file or an existing dir only
!abc/. * # Filter out everything in an abc folder
abc/def/. * # Re-include everything in abc/def sub folder
!abc/def/hgk/. * # Filter out again in abc/def/hgk sub folder
commands
- 실행할 명령 목록. 지정된 경우,이 인수는 pip_requirements
및 npm_requirements
대체합니다.:zip [source] [destination]
은 현재 작업 디렉토리 (첫 번째 인수)의 내용을 생성하고 경로 (두 번째 인수)의 내용을 생성하는 특수 명령입니다.pip_requirements
pip install
실행할지 여부를 제어합니다. 이 기능을 비활성화하려면 false
로 설정하고 pip install
true
하려면 path
에서 찾을 requirements.txt
있습니다. 또는 대신 사용하려는 다른 파일 이름으로 설정하십시오. source_path
경로를 포함하는 문자열 (맵 목록이 아닌)으로 전달되면 requirements.txt
가 있으면 pip install
자동으로 실행됩니다.pip_tmp_dir
PIP 설치의 임시 디렉토리를 만들기 위해 기본 디렉토리를 설정하십시오. Docker Builds의 Docker에 유용 할 수 있습니다.poetry_install
poetry export
및 pip install
실행할지 여부를 제어합니다. 이 기능을 비활성화하려면 false
로 설정하십시오. pyproject.toml
및 poetry.lock
path
poetry export
실행하려면 true
. source_path
경로를 포함하는 문자열 (지도 목록이 아닌)으로 전달되면 빌드 시스템 poetry
있는 pyproject.toml
존재하면 poetry export
및 pip install
자동으로 실행됩니다.poetry_export_extra_args
시출 명령에 추가 할 추가시 인수 목록npm_requirements
npm install
실행할지 여부를 제어합니다. 이 기능을 비활성화하려면 false
로 설정하십시오. package.json
사용하여 npm install
true
하려면 path
에서 찾을 수 있습니다. 또는 대신 사용하려는 다른 파일 이름으로 설정하십시오.npm_tmp_dir
기본 디렉토리를 설정하여 NPM 설치의 임시 디렉토리를 만들 수 있습니다. Docker Builds의 Docker에 유용 할 수 있습니다.prefix_in_zip
지정된 경우 zip -archive 내부의 접두사로 사용됩니다. 기본적으로 모든 것이 Zip-Archive의 루트에 설치됩니다.Lambda 함수 또는 계층이 일부 종속성을 사용하는 경우 Docker에 구축하여 배포 패키지에 포함시킬 수 있습니다. 다음은 할 수있는 방법입니다.
build_in_docker = true
docker_file = "src/python-app1/docker/Dockerfile"
docker_build_root = "src/python-app1/docker"
docker_image = "public.ecr.aws/sam/build-python"
runtime = "python3.12" # Setting runtime is required when building package in Docker and Lambda Layer resource.
이 모듈을 사용하면 개인 호스트의 종속성을 설치할 수 있습니다. 이를 위해서는 전방 SSH 에이전트가 필요합니다.
docker_with_ssh_agent = true
기본적으로 사용 된 docker_image
Registry public.ecr.aws/sam/
에서 제공되며 지정한 runtime
기반으로합니다. 다시 말해, python3.12
의 런타임을 지정하고 docker_image
지정하지 않으면 docker_image
는 public.ecr.aws/sam/build-python3.12
로 해결됩니다. 이를 통해 기본적으로 runtime
Docker 컨테이너에서 사용할 수 있습니다.
docker_image
무시한 경우 이미지를 runtime
과 동기화하십시오. 계획 단계에서 Docker를 사용할 때 runtime
사용할 수 있는지 확인할 수 없습니다. 즉, 런타임이없는 이미지를 사용하면 계획이 여전히 성공하지만 적용이 실패합니다.
Docker를 구축 할 때 유연성을 추가하려면 필요한 여러 가지 추가 옵션을 전달할 수 있습니다 (사용 가능한 옵션은 Docker Run Referent 참조 참조) :
docker_additional_options = [
" -e " , " MY_ENV_VAR='My environment variable value' " ,
" -v " , " /local:/docker-vol " ,
]
Docker에서 구축 할 때 Docker Entrypoint를 무시하려면 docker_entrypoint
설정하십시오.
docker_entrypoint = " /entrypoint/entrypoint.sh "
EntryPoint는 컨테이너 내 경로에 매핑되어야하므로 EntryPoint가 포함 된 자체 이미지를 작성하거나 볼륨을 장착하여 호스트의 파일에 매핑해야합니다 (추가 Docker 옵션 전달 참조).
기본적 으로이 모듈은 배포 패키지를 생성하고이를 사용하여 Lambda Function 또는 Lambda 레이어를 만들거나 업데이트합니다.
때로는 배치 패키지 빌드 (예 : 종속성을 컴파일하고 설치)를 패키지 배포에서 두 개의 개별 단계로 분리 할 수 있습니다.
이 모듈 외부에서 로컬로 아카이브를 만들 때 create_package = false
설정 한 다음 local_existing_package = "existing_package.zip"
을 설정해야합니다. 또는 배포 패키지를 S3 버킷에 보관하고 다음과 같은 참조를 제공하는 것이 좋습니다.
create_package = false
s3_existing_package = {
bucket = " my-bucket-with-lambda-builds "
key = " existing_package.zip "
}
이것은 두 단계로 구현할 수 있습니다. CURL을 사용하여 로컬로 로컬 파일을 다운로드하고 local_existing_package
인수로 배포 패키지로의 통과 경로.
locals {
package_url = " https://raw.githubusercontent.com/terraform-aws-modules/terraform-aws-lambda/master/examples/fixtures/python-zip/existing_package.zip "
downloaded = " downloaded_package_ ${ md5 (local . package_url ) } .zip "
}
resource "null_resource" "download_package" {
triggers = {
downloaded = local.downloaded
}
provisioner "local-exec" {
command = " curl -L -o ${ local . downloaded } ${ local . package_url } "
}
}
data "null_data_source" "downloaded_package" {
inputs = {
id = null_resource.download_package.id
filename = local.downloaded
}
}
module "lambda_function_existing_package_from_remote_url" {
source = " terraform-aws-modules/lambda/aws "
function_name = " my-lambda-existing-package-local "
description = " My awesome lambda function "
handler = " index.lambda_handler "
runtime = " python3.12 "
create_package = false
local_existing_package = data . n ull_data_source . downloaded_package . outputs [ " filename " ]
}
AWS Sam CLI는 개발자가 서버리스 애플리케이션을 시작, 빌드, 테스트 및 배포 할 수 있도록 도와주는 오픈 소스 도구입니다. Sam CLI 도구는 TerraForm 응용 프로그램을 지원합니다.
Sam Cli는 두 가지 테스트 방법을 제공합니다 : 로컬 테스트 및 클라우드 테스트 (가속).
Sam Cli를 사용하면 Sam Local Invoke 명령을 사용하여 로컬로 Terraform 애플리케이션에 정의 된 Lambda 기능을 호출하고 기능 Terraform 주소 또는 기능 이름을 제공하고 hook-name
terraform
으로 설정하여 Sam Cli에게 기본 프로젝트를 알려줍니다. Terraform 응용 프로그램입니다.
TerraForm 응용 프로그램 루트 디렉토리에서 sam local invoke
명령을 다음과 같이 실행할 수 있습니다.
sam local invoke --hook-name terraform module.hello_world_function.aws_lambda_function.this[0]
이벤트를 Lambda 기능에 전달하거나 환경 변수를 덮어 쓸 수도 있습니다. 자세한 내용은 여기를 확인하십시오.
디버깅 모드에서 Lambda 기능을 호출하고 선호하는 편집기에서 Lambda 기능 소스 코드를 계단적으로 스텝 스루로 삼을 수도 있습니다. 자세한 내용은 여기를 확인하십시오.
AWS Sam Cli를 사용하여 AWS 개발 계정에서 응용 프로그램을 신속하게 테스트 할 수 있습니다. Sam Accelerate를 사용하면 Lambda 기능을 로컬에서 개발할 수 있으며 업데이트를 저장하면 Sam Cli는 업데이트 된 Lambda 기능으로 개발 계정을 업데이트합니다. 따라서 클라우드에서 테스트 할 수 있으며 버그가 있으면 코드를 빠르게 업데이트 할 수 있으며 Sam Cli는 클라우드로 밀어 넣습니다. Sam Accelerate에 대한 자세한 내용은 여기를 참조하십시오.
TerraForm Application Root Directory에서 sam sync
명령을 다음과 같이 실행할 수 있습니다.
sam sync --hook-name terraform --watch
일반적으로 LAMBDA 기능 소스 코드가 변경 될 때 리소스 업데이트됩니다. publish = true
지정되면 새 Lambda 함수 버전도 작성됩니다.
게시 된 LAMBDA 기능은 버전 번호 또는 $LATEST
사용하여 호출 할 수 있습니다. 이것은 추가 도구 나 서비스가 필요하지 않은 가장 간단한 배포 방법입니다.
Lambda 함수의 제어 된 배포 (롤링, 카나리아, 롤백)를 수행하려면 Lambda 기능 별칭을 사용해야합니다.
간단히 말해서 Lambda Alias는 Lambda 함수의 하나 버전 (배포가 완료된 경우) 또는 두 가중 버전의 Lambda 기능 (롤링 또는 카나리아 배포 중)에 대한 포인터와 같습니다.
하나의 람다 함수는 여러 별칭에서 사용할 수 있습니다. 별명을 사용하면 여러 환경이있을 때 배포 된 버전을 크게 제어 할 수 있습니다.
별칭 모듈이 있는데, 별명으로 작업을 단순화하는 것 (생성, 구성 관리, 업데이트 등). 별명을 구성하고 사용하는 방법에 대한 다양한 사용 사례에 대한 예/별명을 참조하십시오.
AWS CodeDeploy를 사용하여 배포를 수행하는 데 필요한 리소스를 생성하는 배포 모듈이 있습니다. 또한 배포를 생성하고 완료를 기다립니다. 완전한 엔드 투 엔드 빌드/업데이트/배포 프로세스는 예제/배포를 참조하십시오.
Terraform Cloud, Terraform Enterprise 및 TerraForm을 운영하기위한 다른 많은 SaaS에는 근로자에 Python이 사전 설치되어 있지 않습니다. 이 모듈을 사용할 수 있도록 Python이 설치된 대체 Docker 이미지를 제공해야합니다.
Q1 : 배포 패키지가 무언가를 변경할 때마다 재현하지 않는 이유는 무엇입니까? 또는 왜 배포 패키지가 매번 재현되는지, 콘텐츠가 변경되지 않았습니까?
답변 : 동시 처형 또는 콘텐츠 해시와 관련된 몇 가지 이유가있을 수 있습니다. 때로는 콘텐츠 해시를 계산하는 데 사용되지 않는 종속성 내부에서 변경이 발생했습니다. 또는 동일한 소스에서 여러 패키지가 동시에 생성됩니다.
hash_extra
의 값을 별개의 값으로 설정하여 강제로 강제 할 수 있습니다.
Q2 : 배포 패키지를 강제로 강제하는 방법은 무엇입니까?
답 :
builds
디렉토리에서 기존 zip-archive를 삭제하거나 소스 코드를 변경하십시오. 현재 컨텐츠 해시에 대한 zip-archive가 없으면terraform apply
중에 재현됩니다.
Q3 : null_resource.archive[0] must be replaced
답변 : 이것은 아마도 Zip-Archive가 배치되었지만 현재 로컬에 없으며 로컬로 재현해야한다는 것을 의미합니다. CI/CD 프로세스 (작업 영역이 깨끗한 경우) 또는 여러 작업 공간 에서이 문제를 해결할 때 환경 변수
TF_RECREATE_MISSING_LAMBDA_PACKAGE=false
또는 PASSrecreate_missing_package = false
모듈로 설정하고terraform apply
실행할 수 있습니다. 또는 아카이브를 만들기로 결정할 때 파일 타임 스탬프를 무시하기 위해trigger_on_package_timestamp = false
매개 변수로 전달할 수 있습니다.
Q4 :이 오류는 무엇을 의미합니까? "We currently do not support adding policies for $LATEST."
?
답변 : Lambda 함수가
publish = true
로 작성되면 새 버전이 자동으로 증가하고 자격을 갖춘 식별자 (버전 번호)를 사용할 수있게되며 Lambda 권한을 설정할 때 사용됩니다.
publish = false
(기본값) 일 때 자격이없는 식별자 ($LATEST
) 만 사용할 수있어 오류가 발생합니다.해결책은
create_current_version_allowed_triggers = false
설정하여 현재 버전에 대한 Lambda 권한 생성을 비활성화하거나 Lambda 함수 (publish = true
)를 게시하는 것입니다.
builds
디렉토리가 종종없는 CI/CD 플랫폼에서 실행되는 것처럼 Lambda 기능을 만듭니다.이름 | 버전 |
---|---|
Terraform | > = 1.0 |
AWS | > = 5.70 |
외부 | > = 1.0 |
현지의 | > = 1.0 |
널 | > = 2.0 |
이름 | 버전 |
---|---|
AWS | > = 5.70 |
외부 | > = 1.0 |
현지의 | > = 1.0 |
널 | > = 2.0 |
모듈이 없습니다.
이름 | 유형 |
---|---|
aws_cloudwatch_log_group.lambda | 의지 |
aws_iam_policy.additional_inline | 의지 |
aws_iam_policy.additional_json | 의지 |
aws_iam_policy.additional_jsons | 의지 |
aws_iam_policy.async | 의지 |
aws_iam_policy.dead_letter | 의지 |
aws_iam_policy.logs | 의지 |
AWS_IAM_POLICY.TRACING | 의지 |
aws_iam_policy.vpc | 의지 |
aws_iam_role.lambda | 의지 |
aws_iam_role_policy_attachment.additional_inline | 의지 |
aws_iam_role_policy_attachment.additional_json | 의지 |
aws_iam_role_policy_attachment.additional_jsons | 의지 |
aws_iam_role_policy_attachment.additional_many | 의지 |
aws_iam_role_policy_attachment.additional_one | 의지 |
aws_iam_role_policy_attachment.async | 의지 |
aws_iam_role_policy_attachment.dead_letter | 의지 |
aws_iam_role_policy_attachment.logs | 의지 |
AWS_IAM_ROLE_POLICY_ATTACHMENT.TRACING | 의지 |
aws_iam_role_policy_attachment.vpc | 의지 |
AWS_LAMBDA_EVENT_SORCE_MAPPING.THIS | 의지 |
AWS_LAMBDA_FUNCTION.THIS | 의지 |
aws_lambda_function_event_invoke_config. this | 의지 |
aws_lambda_function_url. this | 의지 |
AWS_LAMBDA_LAYER_VERSION.THIS | 의지 |
AWS_LAMBDA_PERMISSION.CURRENT_VERSION_TRIGGERS | 의지 |
aws_lambda_permission.unqualified_alias_triggers | 의지 |
aws_lambda_provisioned_concurrency_config.current_version | 의지 |
aws_s3_object.lambda_package | 의지 |
local_file.archive_plan | 의지 |
null_resource.archive | 의지 |
null_resource.sam_metadata_aws_lambda_function | 의지 |
null_resource.sam_metadata_aws_lambda_layer_version | 의지 |
aws_arn.log_group_arn | 데이터 소스 |
aws_caller_identity.current | 데이터 소스 |
aws_cloudwatch_log_group.lambda | 데이터 소스 |
AWS_IAM_POLICY.TRACING | 데이터 소스 |
aws_iam_policy.vpc | 데이터 소스 |
aws_iam_policy_document.additional_inline | 데이터 소스 |
aws_iam_policy_document.assume_role | 데이터 소스 |
aws_iam_policy_document.async | 데이터 소스 |
aws_iam_policy_document.dead_letter | 데이터 소스 |
aws_iam_policy_document.logs | 데이터 소스 |
AWS_PARTITION.CURRENT | 데이터 소스 |
AWS_REGION.CURRENT | 데이터 소스 |
external_external.archive_prepare | 데이터 소스 |
이름 | 설명 | 유형 | 기본 | 필수의 |
---|---|---|---|---|
허용 _triggers | 람다 권한을 생성 할 수있는 트리거의지도 | map(any) | {} | 아니요 |
아키텍처 | Lambda 기능을위한 건축 지침. 유효한 값은 [ "x86_64"] 및 [ "ARM64"]입니다. | list(string) | null | 아니요 |
artifacts_dir | 인공물을 저장 해야하는 디렉토리 이름 | string | "builds" | 아니요 |
asme_role_policy_statements입니다 | Lambda 기능 역할을 가정하기위한 동적 정책 진술지도 (신뢰 관계) | any | {} | 아니요 |
attach_async_event_policy | Async 이벤트 정책이 Lambda 기능의 IAM 역할에 추가되어야하는지 여부를 제어합니다. | bool | false | 아니요 |
attach_cloudwatch_logs_policy | Lambda 기능의 CloudWatch 로그 정책을 IAM 역할에 추가 해야하는지 여부 | bool | true | 아니요 |
attach_create_log_group_permission | CloudWatch Logs 정책에 로그 그룹 작성 권한 추가 여부를 제어합니다. | bool | true | 아니요 |
attach_dead_letter_policy | SNS/SQS Dead Letter 알림 정책이 Lambda 기능의 IAM 역할에 추가되어야하는지 여부를 제어합니다. | bool | false | 아니요 |
attach_network_policy | Lambda 기능의 IAM 역할에 VPC/네트워크 정책이 추가되어야하는지 여부 | bool | false | 아니요 |
attach_policies | Lambda 기능의 IAM 역할에 정책 목록을 추가 해야하는지 제어 | bool | false | 아니요 |
attach_policy | Lambda 기능의 IAM 역할에 정책이 추가되어야하는지 여부 | bool | false | 아니요 |
attach_policy_json | Lambda 함수의 IAM 역할에 policy_json이 추가되어야하는지 여부 | bool | false | 아니요 |
attach_policy_jsons | Lambda 함수의 IAM 역할에 policy_jsons가 추가되어야하는지 여부 | bool | false | 아니요 |
attach_policy_statements | Lambda 함수의 IAM 역할에 policy_statements가 추가되어야하는지 여부를 제어합니다. | bool | false | 아니요 |
attach_tracing_policy | Lambda 기능의 IAM 역할에 X- 선 추적 정책이 추가되어야하는지 여부 | bool | false | 아니요 |
인증 _type | Lambda 함수 URL이 사용하는 인증 유형. 인증 된 IAM 사용자에 대한 액세스를 제한하려면 'AWS_IAM'으로 설정하십시오. IAM 인증을 우회하고 공개 엔드 포인트를 만들기 위해 'None'으로 설정하십시오. | string | "NONE" | 아니요 |
build_in_docker | Docker에서 의존성을 구축할지 여부 | bool | false | 아니요 |
CloudWatch_logs_kms_key_id | 로그 데이터를 암호화 할 때 KMS 키의 ARN. | string | null | 아니요 |
CloudWatch_logs_log_group_class | 로그 그룹의 로그 클래스를 지정했습니다. 가능한 값은 STANDARD 또는 INFREQUENT_ACCESS 입니다 | string | null | 아니요 |
CloudWatch_logs_retention_in_days | 지정된 로그 그룹에서 로그 이벤트를 유지하려는 일의 수를 지정합니다. 가능한 값은 : 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827 및 3653입니다. | number | null | 아니요 |
CloudWatch_logs_skip_destroy | 파괴 시간에 로그 그룹을 유지할 것인지 (및 모든 로그가 포함될 수 있음). | bool | false | 아니요 |
CloudWatch_logs_tags | 자원에 할당 할 태그 맵. | map(string) | {} | 아니요 |
code_signing_config_arn | 코드 서명 구성의 ARN (Amazon Resource Name) | string | null | 아니요 |
compatible_architectures | 아키텍처 람다 레이어 목록은 호환됩니다. 현재 X86_64 및 ARM64를 지정할 수 있습니다. | list(string) | null | 아니요 |
compatible_runtimes | 이 레이어 목록은 호환됩니다. 최대 5 개의 런타임을 지정할 수 있습니다. | list(string) | [] | 아니요 |
코스 | Lambda Function URL에서 사용할 Cors 설정 | any | {} | 아니요 |
만들다 | 자원을 만들어야하는지 여부를 제어합니다 | bool | true | 아니요 |
create_async_event_config | Lambda 함수/별명에 대한 비동기 이벤트 구성을 생성 해야하는지 제어 | bool | false | 아니요 |
create_current_version_allowed_triggers | Lambda 함수의 현재 버전에서 트리거를 허용할지 여부 (Terraform이 현재 리소스 만 관리하기 때문에 이전 버전의 권한을 취소합니다) | bool | true | 아니요 |
create_current_version_async_event_config | Lambda 함수의 현재 버전에서 비동기 이벤트 구성을 허용할지 여부 (Terraform은 현재 리소스 만 관리하기 때문에 이전 버전의 권한을 취소합니다) | bool | true | 아니요 |
create_function | Lambda 기능 자원을 작성 해야하는지 여부를 제어합니다 | bool | true | 아니요 |
create_lambda_function_url | Lambda 함수 URL 리소스를 작성 해야하는지 여부를 제어합니다. | bool | false | 아니요 |
create_layer | Lambda 계층 자원을 생성 해야하는지 제어합니다 | bool | false | 아니요 |
create_package | Lambda 패키지를 만들어야하는지 여부를 제어합니다 | bool | true | 아니요 |
create_role | Lambda 기능의 iAM 역할을 만들어야하는지 여부를 제어합니다. | bool | true | 아니요 |
create_sam_metadata | SAM 메타 데이터 널 리소스를 작성 해야하는지 여부를 제어합니다. | bool | false | 아니요 |
create_unqualified_alias_allowed_triggers | 최신 버전을 가리키는 자격이없는 별칭에서 트리거를 허용할지 여부 | bool | true | 아니요 |
create_unqualified_alias_async_event_config | $ 최신 버전을 가리키는 자격이없는 별칭에서 비동기 이벤트 구성 허용 여부 | bool | true | 아니요 |
create_unqualified_alias_lambda_function_url | Lambda Function URL에서 $ 최신 버전을 가리키는 자격이없는 별칭 사용 여부 | bool | true | 아니요 |
dead_letter_target_arn | SNS 주제 또는 SQS 대기열의 ARN은 호출이 실패 할 때 알립니다. | string | null | 아니요 |
설명 | 람다 기능 (또는 레이어)에 대한 설명 | string | "" | 아니요 |
대상 _on_failure | 실패한 비동기 호출에 대한 대상 리소스의 ARN (Amazon Resource Name) | string | null | 아니요 |
대상 _on_success | 성공적인 비동기 호출을위한 대상 리소스의 Amazon Resource Name (ARN) | string | null | 아니요 |
docker_additional_options | Docker Run 명령으로 전달할 추가 옵션 (예 : 환경 변수, 볼륨 등을 설정하는 것 등) | list(string) | [] | 아니요 |
docker_build_root | Docker에서 구축 할 곳 | string | "" | 아니요 |
docker_entrypoint | Docker Entry Point의 경로 사용 | string | null | 아니요 |
docker_file | Docker에 건축 할 때 Dockerfile로가는 길 | string | "" | 아니요 |
docker_image | 빌드에 사용할 도커 이미지 | string | "" | 아니요 |
docker_pip_cache | 공유 PIP 캐시 폴더를 Docker 환경에 장착할지 여부 | any | null | 아니요 |
docker_with_ssh_agent | ssh_auth_sock을 Docker 환경으로 통과할지 여부 | bool | false | 아니요 |
환경 _variables | Lambda 함수의 환경 변수를 정의하는 맵. | map(string) | {} | 아니요 |
ephemeral_storage_size | Lambda 기능이 런타임에 사용할 수있는 MB의 에페메라 저장량 (/TMP) 양. 512MB ~ 10,240 MB (10GB) 사이의 유효한 값. | number | 512 | 아니요 |
event_source_mapping | 이벤트 소스 매핑의지도 | any | {} | 아니요 |
file_system_arn | 파일 시스템에 대한 액세스를 제공하는 Amazon EFS 액세스 포인트의 ARN (Amazon Resource Name). | string | null | 아니요 |
file_system_local_mount_path | /mnt /로 시작하여 함수가 파일 시스템에 액세스 할 수있는 경로. | string | null | 아니요 |
function_name | 람다 기능의 고유 한 이름 | string | "" | 아니요 |
function_tags | Lambda 함수에만 할당하는 태그 맵 | map(string) | {} | 아니요 |
매니저 | 코드의 Lambda Function EntryPoint | string | "" | 아니요 |
Hash_extra | 해싱 함수에 추가 할 문자열. 다른 기능에 대한 동일한 소스 경로를 구축 할 때 유용합니다. | string | "" | 아니요 |
INGORE_SOURCE_CODE_HASH | 함수의 소스 코드 해시에 대한 변경 사항을 무시할지 여부. 인프라 및 코드 배포를 별도로 관리하는 경우 TRUE로 설정하십시오. | bool | false | 아니요 |
image_config_command | Docker 이미지의 CMD | list(string) | [] | 아니요 |
image_config_entry_point | Docker 이미지의 항목 점 | list(string) | [] | 아니요 |
image_config_working_directory | Docker 이미지의 작업 디렉토리 | string | null | 아니요 |
image_uri | 기능의 배포 패키지를 포함하는 ECR 이미지 URI. | string | null | 아니요 |
invoke_mode | Lambda 함수 URL의 모드를 호출하십시오. 유효한 값은 버퍼링 (기본값) 및 response_stream입니다. | string | null | 아니요 |
ipv6_allowed_for_dual_stack | 듀얼 스택 서브넷에 연결된 VPC 기능에서 아웃 바운드 IPv6 트래픽이 허용됩니다. | bool | null | 아니요 |
kms_key_arn | Lambda 기능에서 사용할 KMS 키의 ARN | string | null | 아니요 |
lambda_at_edge | Lambda@Edge를 사용하여 게시를 활성화하고 타임 아웃을 제한하고 edgelambda.amazonaws.com을 허용하여 기능을 호출하는 경우 true로 설정하십시오. | bool | false | 아니요 |
lambda_at_edge_logs_all_regions | Lambda@Edge가 사용하는 IAM 정책에 와일드 카드를 지정할 것인지 모든 지역에서 로깅을 허용합니다. | bool | true | 아니요 |
lambda_role | IAM 역할 ARN은 Lambda 기능에 부착됩니다. 이것은 Lambda 기능과 Lambda 기능이 어떤 자원에 액세스 할 수 있는지에 대한 WHO / WHO / 무엇을 지배합니다. 자세한 내용은 Lambda 권한 모델을 참조하십시오. | string | "" | 아니요 |
layer_name | 생성 할 람다 레이어의 이름 | string | "" | 아니요 |
layer_skip_destroy | 이전에 배치 된 람다 레이어의 이전 버전을 유지할지 여부. | bool | false | 아니요 |
레이어 | Lambda 기능에 부착하려면 Lambda 레이어 버전 ARN (최대 5) 목록. | list(string) | null | 아니요 |
license_info | 람다 레이어에 대한 라이센스 정보. 예를 들어 라이센스의 MIT 또는 전체 URL. | string | "" | 아니요 |
local_existing_package | 기존 지퍼 파일로의 절대 경로 | string | null | 아니요 |
logging_application_log_level | 람다 함수의 응용 프로그램 로그 레벨. 유효한 값은 "추적", "디버그", "정보", "warn", "오류"또는 "치명적"입니다. | string | "INFO" | 아니요 |
logging_log_format | 람다 함수의 로그 형식. 유효한 값은 "JSON"또는 "TEXT"입니다. | string | "Text" | 아니요 |
logging_log_group | CloudWatch 로그 그룹이 로그를 보낼 수 있습니다. | string | null | 아니요 |
logging_system_log_level | 람다 함수의 시스템 로그 레벨. 유효한 값은 "디버그", "정보"또는 "WARN"입니다. | string | "INFO" | 아니요 |
maximum_event_age_in_seconds | Lambda가 몇 초 만에 처리 기능으로 보내는 요청의 최대 연령. 60에서 21600 사이의 유효한 값. | number | null | 아니요 |
maximum_retry_attempts | 함수가 오류를 반환 할 때 재 시도하는 최대 횟수. 0과 2 사이의 유효한 값. 기본값은 2입니다. | number | null | 아니요 |
memory_size | Lambda 기능이 런타임에 사용할 수있는 MB의 메모리 양. 64MB 단위로 128MB ~ 10,240MB (10GB) 사이의 유효한 값. | number | 128 | 아니요 |
숫자 _of_policies | Lambda 기능의 IAM 역할에 첨부 할 정책 수 | number | 0 | 아니요 |
숫자 _of_policy_jsons | Lambda 기능의 IAM 역할에 첨부 할 정책 수 | number | 0 | 아니요 |
package_type | Lambda 배포 패키지 유형. 유효한 옵션 : zip 또는 이미지 | string | "Zip" | 아니요 |
정책 | 람다 기능 역할에 첨부 할 정책 진술 목록 | list(string) | [] | 아니요 |
정책 | Lambda 기능 역할에 첨부 할 추가 정책 문서 ARN | string | null | 아니요 |
정책 _json | Lambda 기능 역할에 첨부 할 JSON과 같은 추가 정책 문서 | string | null | 아니요 |
정책_jsons | Lambda 기능 역할에 첨부 할 JSON으로서 추가 정책 문서 목록 | list(string) | [] | 아니요 |
정책 _name | IAM 정책 이름. role_name과 동일한 기본값을 대체합니다. | string | null | 아니요 |
정책 _path | Lambda 기능의 IAM 역할에 추가 해야하는 정책 경로 | string | null | 아니요 |
정책_statements | Lambda 기능 역할에 첨부 할 동적 정책 설명지도 | any | {} | 아니요 |
Provisioned_Concurrent_Executions | 할당하는 용량의 양. 활성화하려면 1 이상으로 설정하거나 프로비저닝 된 동시성을 비활성화하려면 0으로 설정하십시오. | number | -1 | 아니요 |
게시 | 새로운 Lambda 기능 버전으로 생성/변경을 게시할지 여부. | bool | false | 아니요 |
푸틴 _khuylo | 푸틴 대통령이 우크라이나 주권과 영토 정직성을 존중하지 않는다는 데 동의하십니까? 추가 정보 : https://en.wikipedia.org/wiki/putin_khuylo! | bool | true | 아니요 |
recreate_missing_package | 누락 된 람다 패키지가 현지에서 누락되었는지 여부 | bool | true | 아니요 |
replace_security_groups_on_destroy | (선택 사항) true 인 경우, VPC_SECURITY_GROUP_IDS에 정의 된 모든 보안 그룹은 기능이 파괴 된 후 기본 보안 그룹으로 대체됩니다. 대신 교체 할 보안 그룹의 사용자 정의 목록을 사용하려면 대체 _security_group_ids 변수를 설정하십시오. | bool | null | 아니요 |
대체 _security_group_ids | (Optional) List of security group IDs to assign to orphaned Lambda function network interfaces upon destruction. replace_security_groups_on_destroy must be set to true to use this attribute. | list(string) | null | 아니요 |
reserved_concurrent_executions | The amount of reserved concurrent executions for this Lambda Function. A value of 0 disables Lambda Function from being triggered and -1 removes any concurrency limitations. Defaults to Unreserved Concurrency Limits -1. | number | -1 | 아니요 |
role_description | Description of IAM role to use for Lambda Function | string | null | 아니요 |
role_force_detach_policies | Specifies to force detaching any policies the IAM role has before destroying it. | bool | true | 아니요 |
role_maximum_session_duration | Maximum session duration, in seconds, for the IAM role | number | 3600 | 아니요 |
role_name | Name of IAM role to use for Lambda Function | string | null | 아니요 |
role_path | Path of IAM role to use for Lambda Function | string | null | 아니요 |
role_permissions_boundary | The ARN of the policy that is used to set the permissions boundary for the IAM role used by Lambda Function | string | null | 아니요 |
role_tags | A map of tags to assign to IAM role | map(string) | {} | 아니요 |
실행 시간 | Lambda Function runtime | string | "" | 아니요 |
s3_acl | The canned ACL to apply. Valid values are private, public-read, public-read-write, aws-exec-read, authenticated-read, bucket-owner-read, and bucket-owner-full-control. Defaults to private. | string | "private" | 아니요 |
s3_bucket | S3 bucket to store artifacts | string | null | 아니요 |
s3_existing_package | The S3 bucket object with keys bucket, key, version pointing to an existing zip-file to use | map(string) | null | 아니요 |
s3_kms_key_id | Specifies a custom KMS key to use for S3 object encryption. | string | null | 아니요 |
s3_object_override_default_tags | Whether to override the default_tags from provider? NB: S3 objects support a maximum of 10 tags. | bool | false | 아니요 |
s3_object_storage_class | Specifies the desired Storage Class for the artifact uploaded to S3. Can be either STANDARD, REDUCED_REDUNDANCY, ONEZONE_IA, INTELLIGENT_TIERING, or STANDARD_IA. | string | "ONEZONE_IA" | 아니요 |
s3_object_tags | A map of tags to assign to S3 bucket object. | map(string) | {} | 아니요 |
s3_object_tags_only | Set to true to not merge tags with s3_object_tags. Useful to avoid breaching S3 Object 10 tag limit. | bool | false | 아니요 |
s3_prefix | Directory name where artifacts should be stored in the S3 bucket. If unset, the path from artifacts_dir is used | string | null | 아니요 |
s3_server_side_encryption | Specifies server-side encryption of the object in S3. Valid values are "AES256" and "aws:kms". | string | null | 아니요 |
skip_destroy | Set to true if you do not wish the function to be deleted at destroy time, and instead just remove the function from the Terraform state. Useful for Lambda@Edge functions attached to CloudFront distributions. | bool | null | 아니요 |
snap_start | (Optional) Snap start settings for low-latency startups | bool | false | 아니요 |
source_path | The absolute path to a local file or directory containing your Lambda source code | any | null | 아니요 |
store_on_s3 | Whether to store produced artifacts on S3 or locally. | bool | false | 아니요 |
태그 | A map of tags to assign to resources. | map(string) | {} | 아니요 |
timeout | The amount of time your Lambda Function has to run in seconds. | number | 3 | 아니요 |
timeouts | Define maximum timeout for creating, updating, and deleting Lambda Function resources | map(string) | {} | 아니요 |
tracing_mode | Tracing mode of the Lambda Function. Valid value can be either PassThrough or Active. | string | null | 아니요 |
trigger_on_package_timestamp | Whether to recreate the Lambda package if the timestamp changes | bool | true | 아니요 |
trusted_entities | List of additional trusted entities for assuming Lambda Function role (trust relationship) | any | [] | 아니요 |
use_existing_cloudwatch_log_group | Whether to use an existing CloudWatch log group or create new | bool | false | 아니요 |
vpc_security_group_ids | List of security group ids when Lambda Function should run in the VPC. | list(string) | null | 아니요 |
vpc_subnet_ids | List of subnet ids when Lambda Function should run in the VPC. Usually private or intra subnets. | list(string) | null | 아니요 |
이름 | 설명 |
---|---|
lambda_cloudwatch_log_group_arn | The ARN of the Cloudwatch Log Group |
lambda_cloudwatch_log_group_name | The name of the Cloudwatch Log Group |
lambda_event_source_mapping_arn | The event source mapping ARN |
lambda_event_source_mapping_function_arn | The the ARN of the Lambda function the event source mapping is sending events to |
lambda_event_source_mapping_state | The state of the event source mapping |
lambda_event_source_mapping_state_transition_reason | The reason the event source mapping is in its current state |
lambda_event_source_mapping_uuid | The UUID of the created event source mapping |
lambda_function_arn | The ARN of the Lambda Function |
lambda_function_arn_static | The static ARN of the Lambda Function. Use this to avoid cycle errors between resources (eg, Step Functions) |
lambda_function_invoke_arn | The Invoke ARN of the Lambda Function |
lambda_function_kms_key_arn | The ARN for the KMS encryption key of Lambda Function |
lambda_function_last_modified | The date Lambda Function resource was last modified |
lambda_function_name | The name of the Lambda Function |
lambda_function_qualified_arn | The ARN identifying your Lambda Function Version |
lambda_function_qualified_invoke_arn | The Invoke ARN identifying your Lambda Function Version |
lambda_function_signing_job_arn | ARN of the signing job |
lambda_function_signing_profile_version_arn | ARN of the signing profile version |
lambda_function_source_code_hash | Base64-encoded representation of raw SHA-256 sum of the zip file |
lambda_function_source_code_size | The size in bytes of the function .zip file |
lambda_function_url | The URL of the Lambda Function URL |
lambda_function_url_id | The Lambda Function URL generated id |
lambda_function_version | Latest published version of Lambda Function |
lambda_layer_arn | The ARN of the Lambda Layer with version |
lambda_layer_created_date | The date Lambda Layer resource was created |
lambda_layer_layer_arn | The ARN of the Lambda Layer without version |
lambda_layer_source_code_size | The size in bytes of the Lambda Layer .zip file |
lambda_layer_version | The Lambda Layer version |
lambda_role_arn | The ARN of the IAM role created for the Lambda Function |
lambda_role_name | The name of the IAM role created for the Lambda Function |
lambda_role_unique_id | The unique id of the IAM role created for the Lambda Function |
local_filename | The filename of zip archive deployed (if deployment was from local) |
s3_object | The map with S3 object data of zip archive deployed (if deployment was from S3) |
During development involving modifying python files, use tox to run unit tests:
tox
This will try to run unit tests which each supported python version, reporting errors for python versions which are not installed locally.
If you only want to test against your main python version:
tox -e py
You can also pass additional positional arguments to pytest which is used to run test, eg to make it verbose:
tox -e py -- -vvv
Module managed by Anton Babenko. Check out serverless.tf to learn more about doing serverless with Terraform.
Please reach out to Betajob if you are looking for commercial support for your Terraform, AWS, or serverless project.
Apache 2 Licensed. See LICENSE for full details.