Terraform modules of AWS Lambda with Docker image
-
Check out the repository.
$ git clone https://github.com/dceoy/terraform-aws-docker-based-lambda.git $ cd terraform-aws-docker-based-lambda
-
Install AWS CLI and set
~/.aws/config
and~/.aws/credentials
. -
Install Terraform and Terragrunt.
-
Build the Docker image.
$ ./docker_buildx_bake.sh
-
Initialize Terraform working directories.
$ terragrunt run-all init --terragrunt-working-dir='envs/dev/' -upgrade -reconfigure
-
Generates a speculative execution plan. (Optional)
$ terragrunt run-all plan --terragrunt-working-dir='envs/dev/'
-
Creates or updates infrastructure.
$ terragrunt run-all apply --terragrunt-working-dir='envs/dev/' --terragrunt-non-interactive
$ aws lambda invoke --function-name lambda-hello-world /dev/stdout
$ terragrunt run-all destroy --terragrunt-working-dir='envs/dev/' --terragrunt-non-interactive