Skip to content

POC Project with Terraform IaC. It includes a ECS service running Nginx container and Cognito Authorization.

Notifications You must be signed in to change notification settings

dtelaroli/terraform-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform Test

POC Project with Terraform IaC. It includes a ECS service running Nginx container and Cognito Authorization.

Architecture

diagram

AWS credentials

Use aws-vault to manage your credentials or another of your preference.

Resources

Name Description
backend resources to configure terraform S3 remote state and lock table
shared shared resources used by applications
modules reusable modules
applications you find all applications here

Requirements

Deployment

There is a order to apply all resources:

  1. backend
  2. shared
  3. applications
aws-vault exec <your-profile> -d 12h --

cd backend
terraform init
terraform plan -out plan.apply
terraform apply plan.apply

cd -
cd shared
terraform init
terraform plan -out plan.apply
terraform apply plan.apply

cd -
cd applications/nginx-app
terraform init
terraform workspace new stg
terraform workspace new prd
terraform plan -out plan.apply
terraform apply plan.apply

cd -

Testing

There is a basic test in test folder.

Verifications

Terraform fmt

terraform fmt --recursive

Checkov

# with local installation
checkov -d .

# with docker
docker run -v $(pwd):/data --rm -it bridgecrew/checkov -d /data --quiet

Running tests

aws-vault exec <your-profile> -d 12h --

cd test
go test

cd -

Clean Up

There is a order to destroy all resources:

  1. applications
  2. shared
  3. backend
cd applications/nginx-app
terraform init
terraform plan -out plan.destroy -destroy
terraform apply plan.destroy

cd -
cd shared
terraform init
terraform plan -out plan.destroy -destroy
terraform apply plan.destroy

cd -
cd backend
terraform init
terraform plan -out plan.destroy -destroy
terraform apply plan.destroy

cd -

Roadmap

  • Add moto for mocked tests
  • Add ECR Repository to build a custom image
  • Automated plan/apply with Atlantis or Github Actions

About

POC Project with Terraform IaC. It includes a ECS service running Nginx container and Cognito Authorization.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published