Skip to content

utilizable/terraform-module-ansible

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform Module

This repository serves as a generic terraform template, enhanced with a Makefile and Docker Compose for streamlined setup and usage.

🪜 Repository Structure

utilizable/github-actions-semver-tagging

utilizable/terraform-module

utilizable/terrafrom-module-ansible

Table of Contents

🧰 Requirements

(Back to top)

Make sure you have installed both - latest docker and gnu make!

⚡️ Quick start

(Back to top)

  1. Clone repository
  2. adjust .env
  3. execute make init

📔 Module Options

(Back to top)

Module is based on example provider.

Input Variables

# ./terraform/main.tf
...

Environment Requirements

# ./build/.env
...

⚙️ Configuration

(Back to top)

You can overload default .env configuration file using ENV_FILE variable.

Command Line:

ENV_FILE=.env.override make apply
export ENV_FILE=.env.override
make apply

Github Actions:

- name: Terraform apply
  run: |
    echo "${{ secrets.ENV_PRODUCTION }}" > .env.override
    ENV_FILE=.env.override make apply

📒 Make stages

(Back to top)

Stages definied in makefile.

  • make prune - Wipe all docker-related resources associated with the current project,
  • make show - Show executed containers (dokcer-compose ps -a),
  • make backend - Setup MinIO S3 backend with pre-definied bucket (backend_bucket variable based),
  • make init - Execute terraform init for modules located in ./terraform inside docker container,
  • make plan - Execute terraform plan for modules located in ./terraform inside docker container,
  • make apply - Execute terraform apply for modules located in ./terraform inside docker container,
  • make destroy - Execute terraform destroy for modules located in ./terraform inside docker container.

🗄 Repository structure

(Back to top)

  • ./terraform terraform related resources, workdir for compose-containers,
  • ./build/compose.yml each step contains its own docker container,
  • ./Makefile entrypoint,
  • ./build/.env default configurations.

🔖 Versioning model

(Back to top)

Versions have the format <MAJOR>.<MINOR>(.<PATCH>)? where:

  • <MAJOR> Triggered manualy from default branch,
  • <MINOR> Triggered automaticly after each push from default branch,
  • <PATCH> Triggered automaticly after each push from fix/[0-9].[0-9].x branch.