Skip to content

Commit

Permalink
add skip modules ability
Browse files Browse the repository at this point in the history
  • Loading branch information
morga471 committed Apr 16, 2025
1 parent 74dc304 commit a604bba
Show file tree
Hide file tree
Showing 21 changed files with 270 additions and 40 deletions.
Binary file added docs/enterprise_ecr_v1.drawio 1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions lab/_envcommon/default-versions.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,37 @@ locals {
istio_ingress_version = "${local.release_version}"
release_version = "mcmCluster" # "main"

#####################
# Module Enablement
#####################

# Core modules that should always be enabled (cannot be disabled)
core_modules = [
"eks",
"eks-karpenter",
"eks-config",
"eks-metrics-server",
"eks-cert-manager",
"eks-dns",
]

# Optional modules with their default enablement state
enabled_modules = {
"eks-arcgis" = false
"eks-gogatekeeper" = false
"eks-grafana" = true
"eks-istio" = true
"eks-k8s-dashboard" = true
"eks-karpenter" = true
"eks-keycloak" = true
"eks-kiali" = true
"eks-loki" = true
"eks-otel" = true
"eks-postgresql" = false
"eks-prometheus" = true
"eks-tempo" = true
}

#####################
# TF Providers
#####################
Expand All @@ -27,6 +58,7 @@ locals {
operator_namespace = "operator"
telemetry_namespace = "telemetry"
namespaces = {
arcgis = "arcgis"
cert-manager = "kube-system"
gogatekeeper = "kube-system"
grafana = local.telemetry_namespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ locals {
"slim:schedule" = "8:00-17:00"
"cluster:size" = "min:${local.eks_ng_min_size}-max:${local.eks_ng_max_size}-desired:${local.eks_ng_desired_size}"
}
module_enablement_overrides = {
"eks-arcgis" = true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ include "root" {
expose = true
}

locals {
# Skip this module if disabled
skip = !lookup(include.root.locals.is_module_enabled, basename(get_terragrunt_dir()), true)
}

exclude {
if = local.skip
actions = ["all_except_output"]
exclude_dependencies = false
}

terraform {
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-ersi-arcgis.git?ref=${include.root.inputs.release_version}"
extra_arguments "retry_lock" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ include "root" {
expose = true
}

locals {
# Skip this module if disabled
skip = !lookup(include.root.locals.is_module_enabled, basename(get_terragrunt_dir()), true)
}

exclude {
if = local.skip
actions = ["all_except_output"]
exclude_dependencies = false
}

terraform {
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-cert-mgr.git?ref=${include.root.inputs.release_version}"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ include "root" {
expose = true
}

dependencies {
paths = [
"../eks",
"../eks-karpenter",
"../eks-metrics-server",
]
locals {
# Skip this module if disabled
skip = !lookup(include.root.locals.is_module_enabled, basename(get_terragrunt_dir()), true)
}

exclude {
if = local.skip
actions = ["all_except_output"]
exclude_dependencies = false
}

terraform {
Expand Down Expand Up @@ -37,6 +40,14 @@ dependency "eks" {
}
}

dependencies {
paths = [
"../eks",
"../eks-karpenter",
"../eks-metrics-server",
]
}

inputs = {
# AWS Configuration
account_id = include.root.inputs.aws_account_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ include "root" {
expose = true
}

locals {
# Skip this module if disabled
skip = !lookup(include.root.locals.is_module_enabled, basename(get_terragrunt_dir()), true)
}

exclude {
if = local.skip
actions = ["all_except_output"]
exclude_dependencies = false
}

terraform {
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-eks-dns.git?ref=${include.root.inputs.release_version}"
extra_arguments "retry_lock" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ include "root" {
expose = true
}

locals {
# Skip this module if disabled
skip = !lookup(include.root.locals.is_module_enabled, basename(get_terragrunt_dir()), true)
}

exclude {
if = local.skip
actions = ["all_except_output"]
exclude_dependencies = false
}

terraform {
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-gogatekeeper.git?ref=${include.root.inputs.release_version}"
extra_arguments "retry_lock" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ include "root" {
expose = true
}

locals {
# Skip this module if disabled
skip = !lookup(include.root.locals.is_module_enabled, basename(get_terragrunt_dir()), true)
}

exclude {
if = local.skip
actions = ["all_except_output"]
exclude_dependencies = false
}

terraform {
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-grafana.git?ref=${include.root.inputs.release_version}"
extra_arguments "retry_lock" {
Expand Down Expand Up @@ -44,9 +55,10 @@ dependency "eks_prometheus" {
config_path = "../eks-prometheus"
mock_outputs_allowed_terraform_commands = ["init", "plan", "validate", "destroy"]
mock_outputs = {
rwo_storage_class = "gp3-mocked"
gateway_internal_endpoint = {
url = "mock.loki.enpoint.example.com"
prometheus_server_internal_endpoint = {
hostname = "prometheus.mock.svc.cluster.local"
port_number = "80"
url = "https://prometheus.mock.svc.cluster.local:80/"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ include "root" {
expose = true
}

locals {
# Skip this module if disabled
skip = !lookup(include.root.locals.is_module_enabled, basename(get_terragrunt_dir()), true)
}

exclude {
if = local.skip
actions = ["all_except_output"]
exclude_dependencies = false
}

terraform {
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-istio.git?ref=${include.root.inputs.release_version}"
extra_arguments "retry_lock" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ include "root" {
expose = true
}

locals {
# Skip this module if disabled
skip = !lookup(include.root.locals.is_module_enabled, basename(get_terragrunt_dir()), true)
}

exclude {
if = local.skip
actions = ["all_except_output"]
exclude_dependencies = false
}

terraform {
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-k8s-dashboard.git?ref=${include.root.inputs.release_version}"
extra_arguments "retry_lock" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ include "root" {
expose = true
}

locals {
# Skip this module if disabled
skip = !lookup(include.root.locals.is_module_enabled, basename(get_terragrunt_dir()), true)
}

exclude {
if = local.skip
actions = ["all_except_output"]
exclude_dependencies = false
}

terraform {
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-karpenter.git?ref=${include.root.inputs.release_version}"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ include "root" {
expose = true
}

locals {
# Skip this module if disabled
skip = !lookup(include.root.locals.is_module_enabled, basename(get_terragrunt_dir()), true)
}

exclude {
if = local.skip
actions = ["all_except_output"]
exclude_dependencies = false
}

terraform {
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-keycloak.git?ref=${include.root.inputs.release_version}"
extra_arguments "retry_lock" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ include "root" {
expose = true
}

locals {
# Skip this module if disabled
skip = !lookup(include.root.locals.is_module_enabled, basename(get_terragrunt_dir()), true)
}

exclude {
if = local.skip
actions = ["all_except_output"]
exclude_dependencies = false
}

terraform {
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-kiali.git?ref=${include.root.inputs.release_version}"
extra_arguments "retry_lock" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,23 @@ include "root" {
expose = true
}

dependencies {
paths = [
"../eks",
"../eks-config",
"../eks-metrics-server",
]
locals {
# Skip this module if disabled
skip = !lookup(include.root.locals.is_module_enabled, basename(get_terragrunt_dir()), true)
}

exclude {
if = local.skip
actions = ["all_except_output"]
exclude_dependencies = false
}

terraform {
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-loki.git?ref=${include.root.inputs.release_version}"
extra_arguments "retry_lock" {
commands = get_terraform_commands_that_need_locking()
arguments = ["-lock-timeout=20s"]
}
}

dependency "eks" {
Expand All @@ -29,12 +40,12 @@ dependency "eks_config" {
}
}

terraform {
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-loki.git?ref=${include.root.inputs.release_version}"
extra_arguments "retry_lock" {
commands = get_terraform_commands_that_need_locking()
arguments = ["-lock-timeout=20s"]
}
dependencies {
paths = [
"../eks",
"../eks-config",
"../eks-metrics-server",
]
}

inputs = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@ include "root" {
expose = true
}

dependencies {
paths = [
"../eks",
]
locals {
# Skip this module if disabled
skip = !lookup(include.root.locals.is_module_enabled, basename(get_terragrunt_dir()), true)
}

dependency "eks" {
config_path = "../eks"
mock_outputs_allowed_terraform_commands = ["init", "plan", "validate", "destroy"]
mock_outputs = {
cluster_name = "mock-cluster"
}
exclude {
if = local.skip
actions = ["all_except_output"]
exclude_dependencies = false
}

terraform {
Expand All @@ -26,6 +23,20 @@ terraform {
}
}

dependency "eks" {
config_path = "../eks"
mock_outputs_allowed_terraform_commands = ["init", "plan", "validate", "destroy"]
mock_outputs = {
cluster_name = "mock-cluster"
}
}

dependencies {
paths = [
"../eks",
]
}

inputs = {
# AWS Configuration
account_id = include.root.inputs.aws_account_id
Expand Down
Loading

0 comments on commit a604bba

Please sign in to comment.