Skip to content

A terraform project to deploy a simple nodejs based hello-world app.

Notifications You must be signed in to change notification settings

sagarising/hello-world-terraform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pre-requisite

Setup

  1. Apply the remote_state terraform project. This will create s3 bucket and lock table for keeping remote state for other tf projects.
cd infra/accounts/dev/remote_state; terraform init; terraform apply
  1. Apply the ecs terraform project.
cd infra/accounts/dev/ecs; terraform init; terraform apply

This will output

  • URL to access the web server.
  • ECR repo url where docker images should be pushed.

Development

  1. Make desired code changes to src directory.
  2. Run docker build
cd src; docker build -t <docker_ecr_repo_url>:<version> .
  1. Docker login into the ECR repo
aws ecr get-login-password --region <region> | docker login --username AWS --password-stdin <ecr_repo_url>
  1. Publish docker image
docker push <docker_ecr_repo_url>:<version>
  1. Apply the ecs terraform project with the version provided in above step
cd infra/accounts/dev/ecs; terraform apply -var="release_version=<release_version>"

TODO

  • Use EC2 rather than fargate to reduce infra cost
  • Use terragrunt for making terraform code DRY in case new env is added.

About

A terraform project to deploy a simple nodejs based hello-world app.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published