Skip to content

Commit

Permalink
add provisioned clusters
Browse files Browse the repository at this point in the history
  • Loading branch information
morga471 committed Jun 28, 2025
1 parent 91a0550 commit 17af274
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 37 deletions.
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@
[submodule "lab/clusters/csvd-platform-lab-srn"]
path = lab/clusters/csvd-platform-lab-srn
url = git@github.e.it.census.gov:sct-engineering/csvd-platform-lab-srn
[submodule "lab/clusters/csvd-platform-lab-dja"]
path = lab/clusters/csvd-platform-lab-dja
url = git@github.e.it.census.gov:sct-engineering/csvd-platform-lab-dja
[submodule "lab/clusters/eks-ois-eem-cribl-prod"]
path = lab/clusters/eks-ois-eem-cribl-prod
url = git@github.e.it.census.gov:sct-engineering/eks-ois-eem-cribl-prod
37 changes: 21 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
.PHONY: help config init validate plan fmt check clean deploy-to-pipeline tail parse trigger-template
# Default values
ENV ?= development
AWS_REGION ?= us-gov-east-1
AWS_ACCOUNT_ID ?= 066921446319
ACCOUNT_NAME ?= ent-ew-logging-prod
AWS_PROFILE ?= 066921446319-ent-gov-logging-prod
CLUSTER_NAME ?= eks-ois-eem-cribl-prod
REGION_DIR ?= us-gov-east-1
CLUSTER_DIR ?= csvd-platform-lab-mcm
CLUSTER_DIR ?= ois-eem-cribl-prod

help:
@echo "Available targets:"
Expand All @@ -20,21 +25,21 @@ help:
config:
@echo "Loading configuration..."

# Detect configuration files
$(eval ACCOUNT_HCL=lab/$(ENV)/account.hcl)
$(eval REGION_HCL=lab/$(ENV)/$(REGION_DIR)/region.hcl)
$(eval CLUSTER_HCL=lab/$(ENV)/$(REGION_DIR)/vpc/$(CLUSTER_DIR)/cluster.hcl)

@if [ ! -f "$(ACCOUNT_HCL)" ]; then echo "Error: $(ACCOUNT_HCL) not found"; exit 1; fi
@if [ ! -f "$(REGION_HCL)" ]; then echo "Error: $(REGION_HCL) not found"; exit 1; fi
@if [ ! -f "$(CLUSTER_HCL)" ]; then echo "Error: $(CLUSTER_HCL) not found"; exit 1; fi

# Extract values from HCL files
$(eval AWS_ACCOUNT_ID=$(shell grep -oP 'aws_account_id\s*=\s*"\K[^"]+' $(ACCOUNT_HCL)))
$(eval ACCOUNT_NAME=$(shell grep -oP 'account_name\s*=\s*"\K[^"]+' $(ACCOUNT_HCL)))
$(eval AWS_PROFILE=$(shell echo $(AWS_ACCOUNT_ID)-$(shell echo $(ACCOUNT_NAME) | sed 's/-ew/-gov/')))
$(eval AWS_REGION=$(shell grep -oP 'aws_region\s*=\s*"\K[^"]+' $(REGION_HCL)))
$(eval CLUSTER_NAME=$(shell grep -oP 'cluster_name\s*=\s*"\K[^"]+' $(CLUSTER_HCL)))
# # Detect configuration files
# $(eval ACCOUNT_HCL=lab/$(ENV)/account.hcl)
# $(eval REGION_HCL=lab/$(ENV)/$(REGION_DIR)/region.hcl)
# $(eval CLUSTER_HCL=lab/$(ENV)/$(REGION_DIR)/vpc/$(CLUSTER_DIR)/cluster.hcl)

# @if [ ! -f "$(ACCOUNT_HCL)" ]; then echo "Error: $(ACCOUNT_HCL) not found"; exit 1; fi
# @if [ ! -f "$(REGION_HCL)" ]; then echo "Error: $(REGION_HCL) not found"; exit 1; fi
# @if [ ! -f "$(CLUSTER_HCL)" ]; then echo "Error: $(CLUSTER_HCL) not found"; exit 1; fi

# # Extract values from HCL files
# $(eval AWS_ACCOUNT_ID=$(shell grep -oP 'aws_account_id\s*=\s*"\K[^"]+' $(ACCOUNT_HCL)))
# $(eval ACCOUNT_NAME=$(shell grep -oP 'account_name\s*=\s*"\K[^"]+' $(ACCOUNT_HCL)))
# $(eval AWS_PROFILE=$(shell echo $(AWS_ACCOUNT_ID)-$(shell echo $(ACCOUNT_NAME) | sed 's/-ew/-gov/')))
# $(eval AWS_REGION=$(shell grep -oP 'aws_region\s*=\s*"\K[^"]+' $(REGION_HCL)))
# $(eval CLUSTER_NAME=$(shell grep -oP 'cluster_name\s*=\s*"\K[^"]+' $(CLUSTER_HCL)))

# Calculate derived values
$(eval REGION_SHORT=$(shell echo $(AWS_REGION) | sed 's/\([a-z]\)[a-z]*-/\1/g'))
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ 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
make trigger-template # trigger lambda with config.json to generate new cluster repo
```

### Manual Terragrunt Commands
Expand Down
36 changes: 18 additions & 18 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
{
"body": {
"project_name": "csvd-platform-lab-mcm",
"project_name": "eks-ois-eem-cribl-prod",
"owning_team": "tf-module-admins",
"template_settings": {
"environment": "development",
"environment": "production",
"region": "us-gov-east-1",
"cluster_dir": "csvd-platform-lab-mcm",
"cluster_dir": "ois-eem-cribl-prod",
"enable_all_modules": true,
"account": {
"account_name": "lab-dev-ew",
"aws_account_id": "224384469011",
"aws_profile": "224384469011-lab-dev-ew",
"environment_abbr": "dev"
"account_name": "ent-ew-logging-prod",
"aws_account_id": "066921446319",
"aws_profile": "066921446319-ent-gov-logging-prod",
"environment_abbr": "prod"
},
"vpc": {
"vpc_name": "vpc3-lab-dev",
"vpc_domain_name": "dev.lab.csp2.census.gov"
"vpc_name": "vpc1-inf-services",
"vpc_domain_name": "services.inf.csp1.census.gov"
},
"cluster": {
"cluster_name": "csvd-platform-lab-mcm",
"cluster_mailing_list": "matthew.c.morgan@census.gov",
"cluster_name": "ois-eem-cribl-prod",
"cluster_mailing_list": "ois.acmt.list@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",
"organization": "CHANGEME",
"finops_project_name": "CHANGEME",
"finops_project_number": "CHANGEME",
"finops_project_role": "CHANGEME",
"tags": {
"slim:schedule": "8:00-17:00",
"environment": "development",
"owner": "matthew.c.morgan@census.gov",
"slim:schedule": "CHANGEME",
"environment": "production",
"owner": "OIS Security Engineering",
"managed_by": "terragrunt"
}
}
Expand Down
1 change: 1 addition & 0 deletions lab/clusters/csvd-platform-lab-dja
Submodule csvd-platform-lab-dja added at 16c1db
2 changes: 1 addition & 1 deletion lab/clusters/csvd-platform-lab-mcm
2 changes: 1 addition & 1 deletion lab/clusters/csvd-platform-lab-srn
1 change: 1 addition & 0 deletions lab/clusters/eks-ois-eem-cribl-prod
Submodule eks-ois-eem-cribl-prod added at 79e352

0 comments on commit 17af274

Please sign in to comment.