imjoseangel / terraform-aws-localstack

Terraform AWS with Localstack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Terraform AWS

Terraform CI

Deploys an AWS EC2 and DynamoDB on LocalStack

The following repository shows the way to create an EC2 instance connected to a DynamoDB with LocalStack. All the test are running automatically and using GitHub Actions.

NOTES

How to use this repository

Configure the following environment variables for your local tests:

AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY

In a local dev environment, these could be setup as:

export AWS_ACCESS_KEY_ID=test
export AWS_SECRET_ACCESS_KEY=test

Recommended the use of localstack in docker running:

docker-compose -f docker-compose.yaml up -d

CI Reference

Check the GitHub Actions for pipeline testing reference. Different techniques has been applied to test Terraform code, whether statically and with LocalStack.

Password protection

For Production environments use a protected pipeline with a secret manager solution (Recommended Hashicorp Vault).

Check how the passwords are used under GitHub Actions for pipeline testing or production deployment reference.

GitGuardian is enabled in the repository to avoid secret leaks.

Pre-commit and editor config

  • Use pre-commit hooks in this repository to ensure security and formatting for terraform, detect passwords and other static checks before uploading code.

  • Use EditorConfig in your IDE for file formatting.

Makefile

A makefile has been added to make the cleaning and test easier. Run make help to review options.

Terraform

The solution reflected in this repository connects an EC2 instance with DynamoDB by using IAM Policies. Official AWS Modules have been used for EC2 and security group and avoided for the rest of the components for the sake of simplicity. I always recommend local maintained and secured modules with local policies.

Authors

Originally created by imjoseangel

License

MIT

About

Terraform AWS with Localstack

License:MIT License


Languages

Language:HCL 50.8%Language:Shell 32.4%Language:Makefile 8.5%Language:Python 8.3%