π§¬Teraform Compliance - 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
The 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:
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 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 comply
make complyThis command tests the Terraform Plan output against a set of security and compliance / company rules against Infrastructure as Code, using Terraform Compliance.
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