https://github.com/imjoseangel/terraform-aws-localstack
Terraform AWS with Localstack
https://github.com/imjoseangel/terraform-aws-localstack
Last synced: 7 months ago
JSON representation
Terraform AWS with Localstack
- Host: GitHub
- URL: https://github.com/imjoseangel/terraform-aws-localstack
- Owner: imjoseangel
- License: mit
- Created: 2021-07-10T21:34:48.000Z (about 4 years ago)
- Default Branch: devel
- Last Pushed: 2024-05-10T04:57:33.000Z (over 1 year ago)
- Last Synced: 2024-05-15T20:13:55.127Z (over 1 year ago)
- Language: HCL
- Homepage:
- Size: 213 KB
- Stars: 5
- Watchers: 3
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# Terraform AWS
[](https://github.com/imjoseangel/terraform-aws/actions/workflows/terraform.yml)
## 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](https://github.com/localstack/localstack). All the test are running automatically and using GitHub Actions.
### NOTES
* Automatically test the code with [LocalStack](https://github.com/localstack/localstack).
* Automatically uses [tfsec](https://github.com/tfsec/tfsec) for security testing.
* Implements [pre-commit](https://pre-commit.com/) for static testing
* Implements [EditorConfig](https://editorconfig.org/) for file format.### How to use this repository
Configure the following environment variables for your local tests:
```bash
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
```In a local dev environment, these could be setup as:
```bash
export AWS_ACCESS_KEY_ID=test
export AWS_SECRET_ACCESS_KEY=test
```Recommended the use of localstack in docker running:
```bash
docker-compose -f docker-compose.yaml up -d
```## CI Reference
Check the [GitHub Actions](.github/workflows/terraform.yml) for pipeline testing reference. Different techniques has been applied to test Terraform code, whether statically and with [LocalStack](https://github.com/localstack/localstack).
### Password protection
For **Production environments** use a protected pipeline with a secret manager solution (Recommended [Hashicorp Vault](https://www.vaultproject.io/)).
Check how the passwords are used under [GitHub Actions](.github/workflows/terraform.yml) for pipeline testing or production deployment reference.
[GitGuardian](https://github.com/GitGuardian) is enabled in the repository to avoid secret leaks.
### Pre-commit and editor config
* Use [pre-commit](https://pre-commit.com/) hooks in this repository to ensure security and formatting for terraform, detect passwords and other static checks before uploading code.
* Use [EditorConfig](https://editorconfig.org/) 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](http://github.com/imjoseangel)
## License
[MIT](LICENSE)