Harnessing the Power of the Three Musketeers with Terraform

Harnessing the Power of the Three Musketeers with Terraform

1 min read

Pre-requisites

In essence, this blog post showcases the powerful synergy of the Three Musketeers pattern (Docker, docker-compose, Makefile) when combined with Terraform. I firmly believe that this blend significantly simplifies the process of terraforming. If an individual wishes to modify the code, they simply need to delve into AWS and construct a Docker image.

Dockerfile:

FROM hashicorp/terraform:1.2.4
WORKDIR /infra
ENTRYPOINT [""]
ENV PYTHONUNBUFFERED=1

RUN \
  apk update && \
  apk add  --no-cache python3  curl bash py-pip jq && \
  ln -sf python3 /usr/bin/python && \
  python3 -m ensurepip && \
  apk add --virtual=build gcc libffi-dev musl-dev openssl-dev python3-dev make curl && \
  pip3 install awscli --no-cache-dir && \
  apk del --purge build

COPY ./ ./

In this Docker, we’re utilizing the Terraform image, ensuring everyone operates on the same Terraform version. It’s evident that it sets up the AWS CLI. Therefore, if you’re considering working with different cloud platforms, it would be beneficial to install their respective CLIs as well.

The GitHub repository, https://github.com/KamilBlaz/api_gw_lambda, provides a comprehensive guide in its README on initiating a project of this nature. This project focuses on the creation of an API gateway and Lambda, offering a valuable hands-on experience.

Summary

In this article, I showed you can leverage the Three Musketeers pattern to simplify the process of terraforming.

Share this post