diff --git a/terraform-lambda-ecr-integration/README.md b/terraform-lambda-ecr-integration/README.md index e8d95f6a78..e5b75562cc 100644 --- a/terraform-lambda-ecr-integration/README.md +++ b/terraform-lambda-ecr-integration/README.md @@ -2,7 +2,7 @@ This pattern will provision Amazon Elastic Container Registry (ECR), push the code into the Container Registry along with AWS Lambda function to execute the container. -As part of the build process, a container will be built, pushed into ECR, and ultimately deployed as an AWS Lambda function. When an AWS Lambda is executed, the container's example bash script will run. Following the completion of the AWS lambda function execution, logs will be published to AWS Cloudwatch. The security component is likewise handled by KMS Keys and IAM Roles. +As part of the build process, a container will be built, pushed into ECR, and ultimately deployed as an AWS Lambda function. When an AWS Lambda is executed, the container's example bash script will run. Following the completion of the AWS lambda function execution, logs will be published to AWS CloudWatch. The security component is likewise handled by KMS Keys and IAM Roles. ## Getting started with Terraform Serverless Patterns @@ -14,27 +14,27 @@ You also need [docker](https://www.docker.com/) and md5 to be installed on your The deployment will require you to provide the AWS VPC id along with the Subnet id(s) where you want this pattern to be deployed. -Optionally, you can also specify env and organization (tagging purposes), timeout and memory_size (AWS Lmabda function compute purposes) and lastly logging_level to specify the logging level for your function. These values default to entires in the variable.tf file if not provided at deployment. +Optionally, you can also specify env and organization (tagging purposes), timeout and memory_size (AWS Lambda function compute purposes) and lastly logging_level to specify the logging level for your function. These values default to entires in the variable.tf file if not provided at deployment. ```shell # terraform init terraform init # terraform plan with sample values for vpc and subnet -terraform plan -var="aws_vpc_id=vpc-xxxx" -var='aws_subnets=["subnet-xxxx","subnet-xxxx","subnet-xxxx"]' +terraform plan -var="aws_vpc_id=vpc-xxxx" -var='aws_subnets=["subnet-xxxx","subnet-xxxx","subnet-xxxx"]' # terraform apply terraform apply -var="aws_vpc_id=vpc-xxxx" -var='aws_subnets=["subnet-xxxx","subnet-xxxx","subnet-xxxx"]' ``` -Once deployed you can execute the Lambda function from the AWS Lambda Console or via AWS CLI. The logs will be published to Amazon Cloudwatch. +Once deployed you can execute the Lambda function from the AWS Lambda Console or via AWS CLI. The logs will be published to Amazon CloudWatch. ```shell aws lambda invoke \ --function-name testing-serverlessland-ecr-lambda \ --cli-binary-format raw-in-base64-out \ --log-type Tail --query 'LogResult' --output text \ - response.json | base64 --decode + response.json | base64 --decode ``` diff --git a/terraform-lambda-ecr-integration/bin/build.sh b/terraform-lambda-ecr-integration/bin/build.sh index c2a26406b7..cc48563823 100755 --- a/terraform-lambda-ecr-integration/bin/build.sh +++ b/terraform-lambda-ecr-integration/bin/build.sh @@ -36,7 +36,7 @@ aws ecr get-login-password --region ${TARGET_AWS_REGION} | docker login --userna } # Build image -docker build --no-cache -t ${IMAGE_NAME} ${BUILD_FOLDER} --platform linux/amd64 +docker build --no-cache --provenance=false -t ${IMAGE_NAME} ${BUILD_FOLDER} --platform linux/amd64 # Docker Tag and Push docker tag ${IMAGE_NAME}:latest ${IMAGE_URI}:latest diff --git a/terraform-lambda-ecr-integration/main.tf b/terraform-lambda-ecr-integration/main.tf index f8a6650e81..73cbeaba06 100644 --- a/terraform-lambda-ecr-integration/main.tf +++ b/terraform-lambda-ecr-integration/main.tf @@ -14,7 +14,7 @@ locals { organization = var.organization env = var.env } - region = data.aws_region.current.name + region = data.aws_region.current.id account_id = data.aws_caller_identity.current.account_id standard_resource_name = "${var.env}-${var.organization}-ecr-lambda" ecr_base_arn = "${local.account_id}.dkr.ecr.${local.region}.amazonaws.com" diff --git a/terraform-lambda-ecr-integration/versions.tf b/terraform-lambda-ecr-integration/versions.tf index aeb24d5749..ab6ff491b4 100644 --- a/terraform-lambda-ecr-integration/versions.tf +++ b/terraform-lambda-ecr-integration/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 5.24" + version = "~> 6.0" } external = { source = "hashicorp/external" @@ -15,4 +15,4 @@ terraform { version = ">= 3.2" } } -} \ No newline at end of file +}