Skip to content

Commit

Permalink
Refactor repository and cluster configuration: unify naming and updat…
Browse files Browse the repository at this point in the history
…e descriptions in main.tf and variables.tf
  • Loading branch information
Your Name committed Sep 11, 2025
1 parent 7df2ccd commit 70c4768
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 43 deletions.
3 changes: 1 addition & 2 deletions examples/basic/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ provider "github" {
module "eks_deployment" {
source = "../../"

# Repository configuration
# Repository and cluster configuration - single name for both
name = "eks-test-cluster"
template_repo_org = "SCT-Engineering"
repository_template = "template-eks-cluster"
Expand All @@ -37,7 +37,6 @@ module "eks_deployment" {
aws_profile = "default"
vpc_name = "vpc3-csvd-dev"
vpc_domain_name = "dev.inf.csp1.census.gov"
cluster_name = "dev-eks-01"
cluster_mailing_list = "david.j.arnold.jr@census.gov"
eks_instance_disk_size = 100
eks_ng_desired_size = 3
Expand Down
56 changes: 20 additions & 36 deletions examples/centralized-management/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ provider "github" {
module "prod_eks_cluster" {
source = "../../"

# Repository configuration
repository_name = "eks-prod-cluster"
repository_template_owner = "HappyPathway"
repository_template = "template-eks-cluster"
# Repository and cluster configuration - single name for both
name = "eks-prod-cluster" # This name is used for both the repository and cluster
template_repo_org = "HappyPathway"
repository_template = "template-eks-cluster"
repository_teams = {
"platform-team" = "admin",
"prod-sre-team" = "maintain",
Expand All @@ -32,22 +32,14 @@ module "prod_eks_cluster" {
region = "us-gov-west-1"
github_server_url = var.github_server_url

# Account configuration
account_config = {
account_name = "prod-account"
aws_account_id = var.prod_account_id
environment_abbr = "prod"
}

# VPC configuration
vpc_config = {
vpc_name = "prod-vpc"
vpc_domain_name = "prod.example.com"
}

# Cluster configuration
cluster_config = {
cluster_name = "prod-eks-01"
account_name = "prod-account"
aws_account_id = var.prod_account_id
environment_abbr = "prod"
aws_profile = "default"
vpc_name = "prod-vpc"
vpc_domain_name = "prod.example.com"
cluster_mailing_list = "prod-alerts@example.com"
eks_instance_disk_size = 200
eks_ng_desired_size = 5
Expand Down Expand Up @@ -75,10 +67,10 @@ module "prod_eks_cluster" {
module "dev_eks_cluster" {
source = "../../"

# Repository configuration
repository_name = "eks-dev-cluster"
repository_template_owner = "HappyPathway"
repository_template = "template-eks-cluster"
# Repository and cluster configuration - single name for both
name = "eks-dev-cluster" # This name is used for both the repository and cluster
template_repo_org = "HappyPathway"
repository_template = "template-eks-cluster"
repository_teams = {
"platform-team" = "admin",
"dev-team" = "maintain",
Expand All @@ -91,22 +83,14 @@ module "dev_eks_cluster" {
region = "us-gov-west-1"
github_server_url = var.github_server_url

# Account configuration
account_config = {
account_name = "dev-account"
aws_account_id = var.dev_account_id
environment_abbr = "dev"
}

# VPC configuration
vpc_config = {
vpc_name = "dev-vpc"
vpc_domain_name = "dev.example.com"
}

# Cluster configuration
cluster_config = {
cluster_name = "dev-eks-01"
account_name = "dev-account"
aws_account_id = var.dev_account_id
environment_abbr = "dev"
aws_profile = "default"
vpc_name = "dev-vpc"
vpc_domain_name = "dev.example.com"
cluster_mailing_list = "dev-alerts@example.com"
eks_instance_disk_size = 100
eks_ng_desired_size = 2
Expand Down
6 changes: 3 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ locals {
aws_region = var.region
}),
"environment/region/vpc/cluster/cluster.hcl" : templatefile("${path.module}/templates/cluster.hcl.tf.tpl", {
cluster_name = var.cluster_config.cluster_name,
cluster_name = var.name,
cluster_mailing_list = var.cluster_config.cluster_mailing_list,
eks_instance_disk_size = var.cluster_config.eks_instance_disk_size,
eks_ng_desired_size = var.cluster_config.eks_ng_desired_size,
Expand All @@ -35,7 +35,7 @@ locals {
}),
"README.md" : templatefile("${path.module}/templates/README.md.tf.tpl", {
environment = var.environment,
cluster_name = var.cluster_config.cluster_name,
cluster_name = var.name,
aws_region = var.region
})
}
Expand All @@ -46,7 +46,7 @@ module "github_repo" {

name = var.name
repo_org = var.organization
github_repo_description = "EKS Cluster Configuration for ${var.cluster_config.cluster_name}"
github_repo_description = "EKS Cluster Configuration for ${var.name}"
github_repo_topics = ["eks", "kubernetes", "terraform", "infrastructure"]
force_name = var.force_name

Expand Down
3 changes: 1 addition & 2 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
variable "name" {
description = "The name of the repository."
description = "The name of the repository and EKS cluster. This name will be used for both the GitHub repository and the EKS cluster."
type = string
}

Expand Down Expand Up @@ -165,7 +165,6 @@ variable "namespaces" {
variable "cluster_config" {
description = "Configuration for the EKS cluster"
type = object({
cluster_name = string
account_name = string
aws_account_id = string
aws_profile = string
Expand Down

0 comments on commit 70c4768

Please sign in to comment.