π§¬Terraform - AWS
This example contains a set of commands to manage different Terraform environments. It uses Docker Compose to provide a consistent and reproducible environment.
Setup
Before using these commands, you need to install Docker Compose.
Configuration
Backend configuration file:
${ENVIRONMENT}.backendTerraform variables file:
${ENVIRONMENT}.tfvarsTerraform plan file:
${ENVIRONMENT}.planTerraform state key:
${ENVIRONMENT}.tfstate
Usage
To use this repository, you need to create a .env file with the desired environment name:
ENVIRONMENT=devThe ENVIRONMENT variable can be set to specify which environment to use. The default value is dev. The configuration files for the specified environment should have the following naming conventions:
The available commands are:
make init
make initThis command initializes the Terraform state file. It uses the TF_BACKEND_CONFIG and TF_STATE_KEY variables defined in the Makefile to configure the backend.
make validate
make validateThis command validates the syntax of the current Terraform configuration.
make plan
make planThis command generates a Terraform plan as an output file. It uses the TF_VARIABLES and TF_PLAN variables defined in the Makefile.
make apply
make applyThis command deploys infrastructure with an expected Terraform plan file. It uses the TF_VARIABLES variable defined in the Makefile.
make destroy
make destroyThis command destroys the Terraform-deployed resources.
make clean
make cleanThis command removes leftover Terraform configuration and any leftover Docker networks.

Last updated