Project Griffin - Terraform

Check out the most recent source code

Now that we have the barebones of our application, we can start to build out the infrastructure that will support it. We will use Terraform to define our infrastructure as code. This will allow us to version control our infrastructure and easily deploy it to multiple environments.

We're using Amazon's ECS to host our Node.js container, so we'll first need to define the ECS cluster name, and define an IAM role for ECS to assume. The IAM role allows ECS to perform operations on our behalf like pulling our container image from ECR or publishing logs to cloudwatch.

ECS Name and IAM Role

Next, we'll define the ECS task definition. This is where we define the container image we want to run, the resources it needs, and the environment variables it requires. We'll also define the ECS service, which is responsible for running and maintaining a specified number of tasks.

ECS Name and IAM Role