diff --git a/.github/platform-tg-infra.code-workspace b/.github/platform-tg-infra.code-workspace index 05b26aa..b9434ca 100644 --- a/.github/platform-tg-infra.code-workspace +++ b/.github/platform-tg-infra.code-workspace @@ -102,6 +102,15 @@ }, { "path": "../../repo-setup" + }, + { + "path": "../../template-eks-cluster" + }, + { + "path": "../../module-decomposition" + }, + { + "path": "../../csvd-platform-lab-srn" } ] } diff --git a/Makefile b/Makefile index 83b9dcc..c3704ef 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: help config init validate plan fmt check clean deploy-to-pipeline tail parse +.PHONY: help config init validate plan fmt check clean deploy-to-pipeline tail parse trigger-template # Default values ENV ?= development REGION_DIR ?= us-gov-east-1 @@ -14,6 +14,7 @@ help: @echo " clean - Clean up Terragrunt cache and temporary files" @echo " deploy-to-pipeline - Zip and upload to S3 to trigger CodePipeline" @echo " tail - Tail the logs of the CodeBuild project" + @echo " trigger-template - Trigger template automation lambda with config.json" # Shared configuration target that exports all variables config: @@ -139,3 +140,28 @@ tail: config --since 1m \ --region $(AWS_REGION) \ --profile $(AWS_PROFILE) + +# Template automation using lambda +trigger-template: config + @echo "Triggering template automation lambda..." + @if [ ! -f "config.json" ]; then \ + echo "Error: config.json not found in current directory"; \ + exit 1; \ + fi + + @echo "Invoking lambda function with config.json payload..." + aws lambda invoke \ + --function-name arn:aws-us-gov:lambda:us-gov-west-1:229685449397:function:template-repos-template-automation \ + --payload file://config.json \ + --region us-gov-west-1 \ + --profile $(AWS_PROFILE) \ + --cli-binary-format raw-in-base64-out \ + lambda-response.json + + @echo "Lambda response:" + @cat lambda-response.json | jq '.' 2>/dev/null || cat lambda-response.json + + @echo "Cleaning up response file..." + @rm -f lambda-response.json + + @echo "Template automation lambda triggered successfully!" diff --git a/README.md b/README.md index 248d122..1edcf29 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,8 @@ make plan # Preview changes make fmt # Format files make check # Run all checks make clean # Clean up temporary files +make deploy-to-piepeline # zip files and push to s3 for codepipeline +make trigger-template # trigger lambda with config.json to generate new cluster repo ``` ### Manual Terragrunt Commands @@ -93,15 +95,6 @@ Terragrunt configurations are organized like this: Check the environment folders for more details. -## Testing - -The `/tests` folder has tools to check if everything works. To run tests: - -```bash -cd tests -./run_tests.sh -``` - ## How to Contribute 1. Make a copy of this repository @@ -109,7 +102,3 @@ cd tests 3. Make your updates 4. Run `make check` to ensure everything is correct 5. Submit a pull request - -## License - -Copyright © 2025 Your Organization. All rights reserved. diff --git a/config.json b/config.json new file mode 100644 index 0000000..fda6c3f --- /dev/null +++ b/config.json @@ -0,0 +1,40 @@ +{ + "body": { + "project_name": "csvd-platform-lab-mcm", + "owning_team": "tf-module-admins", + "template_settings": { + "environment": "development", + "region": "us-gov-east-1", + "cluster_dir": "csvd-platform-lab-mcm", + "enable_all_modules": true, + "account": { + "account_name": "lab-dev-ew", + "aws_account_id": "224384469011", + "aws_profile": "224384469011-lab-dev-ew", + "environment_abbr": "dev" + }, + "vpc": { + "vpc_name": "vpc3-lab-dev", + "vpc_domain_name": "dev.lab.csp2.census.gov" + }, + "cluster": { + "cluster_name": "csvd-platform-lab-mcm", + "cluster_mailing_list": "matthew.c.morgan@census.gov", + "eks_instance_disk_size": 200, + "eks_ng_desired_size": 2, + "eks_ng_max_size": 2, + "eks_ng_min_size": 2, + "organization": "census:ocio:csvd", + "finops_project_name": "csvd_platformbaseline", + "finops_project_number": "fs0000000078", + "finops_project_role": "csvd_platformbaseline_eks", + "tags": { + "slim:schedule": "8:00-17:00", + "environment": "development", + "owner": "matthew.c.morgan@census.gov", + "managed_by": "terragrunt" + } + } + } + } +} diff --git a/input_vars.hcl b/input_vars.hcl deleted file mode 100644 index dfeec7a..0000000 --- a/input_vars.hcl +++ /dev/null @@ -1,26 +0,0 @@ -locals { - account_name = "lab-dev-ew" - aws_account_id = "224384469011" - aws_region = "us-gov-east-1" - cluster_mailing_list = "matthew.c.morgan@census.gov" - cluster_name = "csvd-platform-lab-mcm" - eks_instance_disk_size = 100 - eks_ng_desired_size = 2 - eks_ng_max_size = 10 - eks_ng_min_size = 2 - environment = "development" - environment_abbr = "dev" - organization = "census:ocio:csvd" - finops_project_name = "csvd_platformbaseline" - finops_project_number = "fs0000000078" - finops_project_role = "csvd_platformbaseline_app" - vpc_domain_name = "dev.lab.csp2.census.gov" - vpc_name = "vpc3-lab-dev" - tags = { - "slim:schedule" = "8:00-17:00" - } - module_enablement_overrides = { - "eks-arcgis" = false - "eks-postgresql" = false - } -}