Move bootstrap Makefile into module directory

This commit is contained in:
cloudneutral 2025-12-24 14:59:20 +08:00
parent 6943ab67fc
commit 6fa07cad3a
5 changed files with 53 additions and 81 deletions

View File

@ -1,45 +0,0 @@
# ---------------------------------------------------------
# Root Makefile - orchestrate bootstrap modules
# ---------------------------------------------------------
AWS_BOOTSTRAP_DIR = aws-cloud/bootstrap
BOOTSTRAP_S3_DIR = $(AWS_BOOTSTRAP_DIR)/state
BOOTSTRAP_DYNAMODB_DIR = $(AWS_BOOTSTRAP_DIR)/lock
BOOTSTRAP_IAM_DIR = $(AWS_BOOTSTRAP_DIR)/identity
# --------------------------------------------
# Bootstrap targets
# --------------------------------------------
bootstrap-init:
make -C $(BOOTSTRAP_S3_DIR) init
make -C $(BOOTSTRAP_DYNAMODB_DIR) init
make -C $(BOOTSTRAP_IAM_DIR) init
bootstrap-apply:
make -C $(BOOTSTRAP_S3_DIR) apply
make -C $(BOOTSTRAP_DYNAMODB_DIR) apply
make -C $(BOOTSTRAP_IAM_DIR) apply
@echo "🎉 All bootstrap modules completed."
# --------------------------------------------
# Run all bootstraps in order
# --------------------------------------------
bootstrap-plan:
make -C $(BOOTSTRAP_S3_DIR) plan
make -C $(BOOTSTRAP_DYNAMODB_DIR) plan
make -C $(BOOTSTRAP_IAM_DIR) plan
bootstrap-output:
make -C $(BOOTSTRAP_S3_DIR) output
make -C $(BOOTSTRAP_DYNAMODB_DIR) output
make -C $(BOOTSTRAP_IAM_DIR) output
bootstrap-destroy:
make -C $(BOOTSTRAP_S3_DIR) destroy
make -C $(BOOTSTRAP_DYNAMODB_DIR) destroy
make -C $(BOOTSTRAP_IAM_DIR) destroy
bootstrap-reinit: bootstrap-destroy bootstrap

View File

@ -0,0 +1,50 @@
# ---------------------------------------------------------
# Bootstrap Makefile - orchestrate bootstrap modules
# ---------------------------------------------------------
ifndef BOOTSTRAP_CONFIG_PATH
$(error BOOTSTRAP_CONFIG_PATH is required)
endif
BOOTSTRAP_CONFIG_ABS := $(abspath $(BOOTSTRAP_CONFIG_PATH))
BOOTSTRAP_ENV := BOOTSTRAP_CONFIG_PATH="$(BOOTSTRAP_CONFIG_ABS)" TF_VAR_bootstrap_config_path="$(BOOTSTRAP_CONFIG_ABS)"
BOOTSTRAP_S3_DIR = state
BOOTSTRAP_DYNAMODB_DIR = lock
BOOTSTRAP_IAM_DIR = identity
# --------------------------------------------
# Bootstrap targets
# --------------------------------------------
bootstrap-init:
$(BOOTSTRAP_ENV) make -C $(BOOTSTRAP_S3_DIR) init
$(BOOTSTRAP_ENV) make -C $(BOOTSTRAP_DYNAMODB_DIR) init
$(BOOTSTRAP_ENV) make -C $(BOOTSTRAP_IAM_DIR) init
bootstrap-apply:
$(BOOTSTRAP_ENV) make -C $(BOOTSTRAP_S3_DIR) apply
$(BOOTSTRAP_ENV) make -C $(BOOTSTRAP_DYNAMODB_DIR) apply
$(BOOTSTRAP_ENV) make -C $(BOOTSTRAP_IAM_DIR) apply
@echo "🎉 All bootstrap modules completed."
# --------------------------------------------
# Run all bootstraps in order
# --------------------------------------------
bootstrap-plan:
$(BOOTSTRAP_ENV) make -C $(BOOTSTRAP_S3_DIR) plan
$(BOOTSTRAP_ENV) make -C $(BOOTSTRAP_DYNAMODB_DIR) plan
$(BOOTSTRAP_ENV) make -C $(BOOTSTRAP_IAM_DIR) plan
bootstrap-output:
$(BOOTSTRAP_ENV) make -C $(BOOTSTRAP_S3_DIR) output
$(BOOTSTRAP_ENV) make -C $(BOOTSTRAP_DYNAMODB_DIR) output
$(BOOTSTRAP_ENV) make -C $(BOOTSTRAP_IAM_DIR) output
bootstrap-destroy:
$(BOOTSTRAP_ENV) make -C $(BOOTSTRAP_S3_DIR) destroy
$(BOOTSTRAP_ENV) make -C $(BOOTSTRAP_DYNAMODB_DIR) destroy
$(BOOTSTRAP_ENV) make -C $(BOOTSTRAP_IAM_DIR) destroy
bootstrap-reinit: bootstrap-destroy bootstrap

View File

@ -10,17 +10,6 @@ terraform {
source = "${get_parent_terragrunt_dir()}/..//bootstrap/identity"
}
locals {
tg_root = get_env("TG_ROOT", get_parent_terragrunt_dir())
repo_root = abspath("${local.tg_root}/../../../../../")
gitops_root = "${local.repo_root}/gitops"
tf_config_env = trimspace(get_env("TF_CONFIG", ""))
bootstrap_config_path = local.tf_config_env != "" ? (
startswith(local.tf_config_env, "/") ? local.tf_config_env : abspath("${local.repo_root}/${local.tf_config_env}")
) : abspath("${local.gitops_root}/${get_env("GITOPS_BOOTSTRAP_CONFIG", "config/bootstrap.yaml")}")
}
inputs = {
bootstrap_config_path = local.bootstrap_config_path
bootstrap_config_path = get_env("BOOTSTRAP_CONFIG_PATH", "")
}

View File

@ -10,17 +10,6 @@ terraform {
source = "${get_parent_terragrunt_dir()}/..//bootstrap/lock"
}
locals {
tg_root = get_env("TG_ROOT", get_parent_terragrunt_dir())
repo_root = abspath("${local.tg_root}/../../../../../")
gitops_root = "${local.repo_root}/gitops"
tf_config_env = trimspace(get_env("TF_CONFIG", ""))
bootstrap_config_path = local.tf_config_env != "" ? (
startswith(local.tf_config_env, "/") ? local.tf_config_env : abspath("${local.repo_root}/${local.tf_config_env}")
) : abspath("${local.gitops_root}/${get_env("GITOPS_BOOTSTRAP_CONFIG", "config/bootstrap.yaml")}")
}
inputs = {
bootstrap_config_path = local.bootstrap_config_path
bootstrap_config_path = get_env("BOOTSTRAP_CONFIG_PATH", "")
}

View File

@ -6,17 +6,6 @@ terraform {
source = "${get_parent_terragrunt_dir()}/..//bootstrap/state"
}
locals {
tg_root = get_env("TG_ROOT", get_parent_terragrunt_dir())
repo_root = abspath("${local.tg_root}/../../../../../")
gitops_root = "${local.repo_root}/gitops"
tf_config_env = trimspace(get_env("TF_CONFIG", ""))
bootstrap_config_path = local.tf_config_env != "" ? (
startswith(local.tf_config_env, "/") ? local.tf_config_env : abspath("${local.repo_root}/${local.tf_config_env}")
) : abspath("${local.gitops_root}/${get_env("GITOPS_BOOTSTRAP_CONFIG", "config/bootstrap.yaml")}")
}
inputs = {
bootstrap_config_path = local.bootstrap_config_path
bootstrap_config_path = get_env("BOOTSTRAP_CONFIG_PATH", "")
}