Skip to content

Add Terraform module for multi-environment deployments#35

Merged
AntonioCS merged 1 commit intomainfrom
feature/module-terraform
Dec 15, 2025
Merged

Add Terraform module for multi-environment deployments#35
AntonioCS merged 1 commit intomainfrom
feature/module-terraform

Conversation

@AntonioCS
Copy link
Owner

Summary

New terraform module providing reusable workflow automation for multi-environment Terraform deployments.

Features

  • Configurable variables: tf_bin, tf_env_dir, tf_shared_vars, tf_auto_approve_envs, tf_destroy_confirm, tf_chdir_flag
  • Helper functions: tf_run, tf_run_vars, tf_build_chdir, tf_build_var_file, tf_is_auto_approve_env
  • Pattern targets: terraform/init/%, terraform/plan/%, terraform/apply/%, terraform/destroy/%, terraform/validate/%, terraform/output/%, terraform/state/list/%, terraform/refresh/%
  • Utility targets: terraform/fmt, terraform/fmt/check, terraform/version
  • Safety features: Confirmation prompts for destroy, auto-approve only for configured environments

Usage

# Add module to project
make mb/modules/add/terraform

# Configure in bind-hub/configs/terraform_config.mk
tf_env_dir := infra/environments
tf_shared_vars := ../../shared/common.tfvars

# Use
make terraform/init/local
make terraform/plan/dev
make terraform/apply/prod

Test plan

  • Run make test=terraform - 15 tests, 36 assertions pass
  • Run full test suite make - 63 tests, 142 assertions pass

Closes Trello card: https://trello.com/c/zvPHcUfv

@AntonioCS AntonioCS force-pushed the feature/module-terraform branch 4 times, most recently from 799a7a6 to 94af3c8 Compare December 15, 2025 14:58
mod_info.mk:
- Module metadata (v1.0.0, no dependencies)

mod_config.mk:
- tf_bin, tf_env_dir, tf_shared_vars configuration
- tf_auto_approve_envs for environment-specific auto-approve
- tf_destroy_confirm for destroy operation safety
- tf_chdir_flag for terraform 0.14+ compatibility

terraform.mk:
- tf_build_chdir: Build -chdir argument
- tf_build_var_file: Build -var-file argument
- tf_is_auto_approve_env: Check if env allows auto-approve
- tf_run: Execute terraform command (auto-includes shared vars if set)
- Pattern targets: init, plan, apply, destroy, validate, output, state/list, refresh
- Utility targets: fmt, fmt/check, version

terraform_test.mk:
- 14 tests, 33 assertions covering all functions
@AntonioCS AntonioCS force-pushed the feature/module-terraform branch from 94af3c8 to e7ba011 Compare December 15, 2025 15:05
@AntonioCS AntonioCS merged commit 986b2a5 into main Dec 15, 2025
1 check passed
@AntonioCS AntonioCS deleted the feature/module-terraform branch December 15, 2025 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant