From 6eac9597c1d54dbff46ff50dfff475a8ba41e3ee Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 17 Sep 2025 16:01:03 -0400 Subject: [PATCH] udpating stuff and things --- defaults.tf | 11 ++++------- locals.tf | 33 --------------------------------- main.tf | 30 ++++++++++++++++++++++++++++++ variables.tf | 17 ++++++++++++++--- 4 files changed, 48 insertions(+), 43 deletions(-) diff --git a/defaults.tf b/defaults.tf index 0fb6589..5842ce5 100644 --- a/defaults.tf +++ b/defaults.tf @@ -11,9 +11,6 @@ locals { template_owner = "SCT-Engineering" } - # Default module enablement - enable_all_modules = true - # Static EKS configuration for Karpenter bootstrap node group eks_defaults = { instance_disk_size = 200 @@ -23,10 +20,10 @@ locals { enable_cluster_creator_admin_permissions = true } - # Default organization settings + # Organization settings - now configurable through finops variable organization_defaults = { - finops_project_name = "csvd_platformbaseline" - finops_project_number = "fs0000000078" - finops_project_role = "csvd_platformbaseline_app" + finops_project_name = var.finops.project_name + finops_project_number = var.finops.project_number + finops_project_role = var.finops.project_role } } \ No newline at end of file diff --git a/locals.tf b/locals.tf index 722b02f..fc17610 100644 --- a/locals.tf +++ b/locals.tf @@ -120,40 +120,7 @@ locals { namespaces = local.all_namespaces } - # Updated config_json to use new simplified interface and local defaults - config_json = jsonencode({ - environment = var.environment - region = var.region - cluster_dir = "platform-cluster" - enable_all_modules = local.enable_all_modules - account = { - account_name = var.cluster_config.account_name - aws_account_id = var.cluster_config.aws_account_id - aws_profile = local.aws_profile - environment_abbr = var.cluster_config.environment_abbr - } - vpc = { - vpc_name = var.cluster_config.vpc_name - vpc_domain_name = var.cluster_config.vpc_domain_name - } - cluster = { - cluster_name = var.name - cluster_mailing_list = var.cluster_config.cluster_mailing_list - eks_instance_disk_size = local.eks_defaults.instance_disk_size - eks_ng_desired_size = local.eks_defaults.ng_desired_size - eks_ng_max_size = local.eks_defaults.ng_max_size - eks_ng_min_size = local.eks_defaults.ng_min_size - enable_cluster_creator_admin_permissions = local.eks_defaults.enable_cluster_creator_admin_permissions - tags = var.cluster_config.tags - } - modules = var.enable_modules - }) - managed_extra_files = concat([ - { - path = "config.json" - content = local.config_json - }, { path = "_envcommon/default-versions.hcl" content = templatefile("${path.module}/templates/default-versions.hcl", local.default_versions) diff --git a/main.tf b/main.tf index 7cf466c..c188c00 100644 --- a/main.tf +++ b/main.tf @@ -1,5 +1,35 @@ locals { rendered_files = { + "config.json" : jsonencode({ + environment = var.environment + region = var.region + cluster_dir = var.name + enable_all_modules = true + account = { + account_name = var.cluster_config.account_name + aws_account_id = var.cluster_config.aws_account_id + aws_profile = local.aws_profile + environment_abbr = var.cluster_config.environment_abbr + } + vpc = { + vpc_name = var.cluster_config.vpc_name + vpc_domain_name = var.cluster_config.vpc_domain_name + } + cluster = { + cluster_name = var.name + cluster_mailing_list = var.cluster_config.cluster_mailing_list + eks_instance_disk_size = local.eks_defaults.instance_disk_size + eks_ng_desired_size = local.eks_defaults.ng_desired_size + eks_ng_max_size = local.eks_defaults.ng_max_size + eks_ng_min_size = local.eks_defaults.ng_min_size + organization = var.cluster_config.organization + finops_project_name = local.organization_defaults.finops_project_name + finops_project_number = local.organization_defaults.finops_project_number + finops_project_role = local.organization_defaults.finops_project_role + tags = var.cluster_config.tags + } + modules = var.enable_modules + }), "root.hcl" : templatefile("${path.module}/templates/root.hcl.tf.tpl", { environment = var.environment }), diff --git a/variables.tf b/variables.tf index 79a72bf..8c7859a 100644 --- a/variables.tf +++ b/variables.tf @@ -6,7 +6,7 @@ variable "name" { variable "organization" { description = "The organization to create the repository in." type = string - default = "HappyPathway" + default = "SCT-Engineering" } variable "environment" { @@ -33,6 +33,17 @@ variable "cluster_config" { }) } +# Organization/FinOps settings - configurable per usage +variable "finops" { + description = "FinOps configuration for cost tracking and billing" + type = object({ + project_name = optional(string, "csvd_platformbaseline") + project_number = optional(string, "fs0000000078") + project_role = optional(string, "csvd_platformbaseline_app") + }) + default = {} +} + variable "repository_teams" { description = "A map of teams and their permissions to grant on the repository." type = map(string) @@ -42,13 +53,13 @@ variable "repository_teams" { variable "github_server_url" { description = "GitHub Enterprise server URL (e.g., https://github.e.it.census.gov)" type = string - default = "https://api.github.com" + default = "https://github.e.it.census.gov" } variable "is_private" { description = "Whether the repository should be private." type = bool - default = true + default = false } variable "force_name" {