https://github.com/jottenlips/lambda-terraform-example
Deploy a single lambda function using terraform
https://github.com/jottenlips/lambda-terraform-example
example git guide infrastructure-as-code lambda python terraform
Last synced: 11 months ago
JSON representation
Deploy a single lambda function using terraform
- Host: GitHub
- URL: https://github.com/jottenlips/lambda-terraform-example
- Owner: jottenlips
- Created: 2022-07-28T20:01:57.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-07-28T20:05:45.000Z (over 3 years ago)
- Last Synced: 2025-03-19T05:34:20.458Z (11 months ago)
- Topics: example, git, guide, infrastructure-as-code, lambda, python, terraform
- Language: HCL
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Infrastructure as Code Tutorial (Terraform)
Install Terraform
Run these brew commands in your terminal or follow the install guide.
https://learn.hashicorp.com/tutorials/terraform/install-cli
```
$ brew tap hashicorp/tap
```
```
$ brew install hashicorp/tap/terraform
```
Make a bucket and dynamodb table to store terraform state
```
$ aws s3api create-bucket --bucket $BUCKET_NAME --region us-east-1 --create-bucket-configuration LocationConstraint=us-east-1
$ aws s3api put-bucket-encryption --bucket $BUCKET_NAME --server-side-encryption-configuration "{\"Rules\": [{\"ApplyServerSideEncryptionByDefault\":{\"SSEAlgorithm\": \"AES256\"}}]}"
$ aws dynamodb create-table --table-name terraform-lock-table --attribute-definitions AttributeName=LockID,AttributeType=S --key-schema AttributeName=LockID,KeyType=HASH --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
```
$BUCKET_NAME must be unique in all .tf files
Run init
```
$ terraform init
```
This command will show you what will change in the cloud.
```
$ terraform plan
```
This command will apply your changes
```
$ terraform apply
```
This code repo contains the minimum config needed to deploy an AWS Lambda to run a python function in the cloud.