From ab64194aec002a10b5f67a09430736643b05c06e Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Mon, 17 Nov 2025 10:28:23 +0800 Subject: [PATCH] refactor(makefile): standardize bootstrap Makefiles across DynamoDB, IAM, and S3 --- iac-template/terraform-standard/Makefile | 20 +++++++++---------- .../bootstrap-dynamodb/Makefile | 10 ++++++---- .../terraform-standard/bootstrap-iam/Makefile | 10 +++++----- .../terraform-standard/bootstrap-s3/Makefile | 10 ++++++---- 4 files changed, 26 insertions(+), 24 deletions(-) diff --git a/iac-template/terraform-standard/Makefile b/iac-template/terraform-standard/Makefile index 789a98db..550add1d 100644 --- a/iac-template/terraform-standard/Makefile +++ b/iac-template/terraform-standard/Makefile @@ -10,23 +10,21 @@ BOOTSTRAP_IAM_DIR = bootstrap-iam # Bootstrap targets # -------------------------------------------- -bootstrap: bootstrap-s3 bootstrap-dynamodb bootstrap-iam +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." -bootstrap-s3: - make -C $(BOOTSTRAP_S3_DIR) bootstrap - -bootstrap-dynamodb: - make -C $(BOOTSTRAP_DYNAMODB_DIR) bootstrap - -bootstrap-iam: - make -C $(BOOTSTRAP_IAM_DIR) bootstrap - # -------------------------------------------- # Run all bootstraps in order # -------------------------------------------- - bootstrap-plan: make -C $(BOOTSTRAP_S3_DIR) plan make -C $(BOOTSTRAP_DYNAMODB_DIR) plan diff --git a/iac-template/terraform-standard/bootstrap-dynamodb/Makefile b/iac-template/terraform-standard/bootstrap-dynamodb/Makefile index 78f76d6f..8945babf 100644 --- a/iac-template/terraform-standard/bootstrap-dynamodb/Makefile +++ b/iac-template/terraform-standard/bootstrap-dynamodb/Makefile @@ -1,13 +1,15 @@ -bootstrap: +init: terraform init --upgrade + +apply: init terraform apply \ -var="table_name=svc-plus-iac-state-dynamodb-lock" \ -var="region=ap-northeast-1" \ -auto-approve -plan: +plan: init terraform plan -var="table_name=svc-plus-iac-state-dynamodb-lock" -var="region=ap-northeast-1" -output: +output: init terraform output -destroy: +destroy: init terraform destroy diff --git a/iac-template/terraform-standard/bootstrap-iam/Makefile b/iac-template/terraform-standard/bootstrap-iam/Makefile index c3ca7b2f..a6af46c8 100644 --- a/iac-template/terraform-standard/bootstrap-iam/Makefile +++ b/iac-template/terraform-standard/bootstrap-iam/Makefile @@ -1,15 +1,15 @@ -bootstrap: +init: terraform init --upgrade +apply: init terraform apply \ -var="region=ap-northeast-1" \ -var="account_name=dev" \ -var="role_name=TerraformDeployRole-Dev" \ -auto-approve terraform output - -plan: +plan: init terraform plan -var="region=ap-northeast-1" -var="account_name=dev" -var="role_name=TerraformDeployRole-Dev" -output: +output: init terraform output -destroy: +destroy: init terraform destroy diff --git a/iac-template/terraform-standard/bootstrap-s3/Makefile b/iac-template/terraform-standard/bootstrap-s3/Makefile index 9e8bb9a0..6e23027f 100644 --- a/iac-template/terraform-standard/bootstrap-s3/Makefile +++ b/iac-template/terraform-standard/bootstrap-s3/Makefile @@ -1,12 +1,14 @@ -bootstrap: +init: terraform init --upgrade + +apply: init terraform apply -var="bucket_name=svc-plus-iac-state" -var=region=ap-northeast-1 -auto-approve terraform output -plan: +plan: init terraform plan -var="bucket_name=svc-plus-iac-state" -var=region=ap-northeast-1 -output: +output: init terraform output -destroy: +destroy: init terraform destroy