Skip to content

Commit

Permalink
add empty
Browse files Browse the repository at this point in the history
  • Loading branch information
morga471 committed Feb 12, 2025
1 parent 9013e98 commit 85096fc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
11 changes: 11 additions & 0 deletions lab/_envcommon/empty-provider.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
generate "kube_provider" {
path = "kubernetes-provider.tf"
if_exists = "overwrite_terragrunt"
contents = ""
}

generate "helm_provider" {
path = "helm-provider.tf"
if_exists = "overwrite_terragrunt"
contents = ""
}
19 changes: 13 additions & 6 deletions lab/root.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,22 @@ locals {
state_table_name = local.common_vars.locals.state_table_name
terraform = local.cluster_vars.locals.terraform
terragrunt = local.cluster_vars.locals.terragrunt
module_name = basename(get_original_terragrunt_dir())

# Check if current module is the EKS module
module_name = basename(get_original_terragrunt_dir())
is_eks_module = local.module_name == "eks"

# Load provider configurations if not in EKS module
kube_provider = local.is_eks_module ? {} : read_terragrunt_config("${get_repo_root()}/lab/_envcommon/kube-provider.hcl")
helm_provider = local.is_eks_module ? {} : read_terragrunt_config("${get_repo_root()}/lab/_envcommon/helm-provider.hcl")

kube_provider = read_terragrunt_config(
local.is_eks_module ?
"${get_repo_root()}/lab/_envcommon/empty-provider.hcl" :
"${get_repo_root()}/lab/_envcommon/kube-provider.hcl"
)
helm_provider = read_terragrunt_config(
local.is_eks_module ?
"${get_repo_root()}/lab/_envcommon/empty-provider.hcl" :
"${get_repo_root()}/lab/_envcommon/helm-provider.hcl"
)
}

# Configure Terragrunt to automatically store tfstate files in an S3 bucket
Expand Down Expand Up @@ -108,13 +115,13 @@ EOF
generate "kube_provider" {
path = local.kube_provider.generate.kube_provider.path
if_exists = local.kube_provider.generate.kube_provider.if_exists
contents = local.is_eks_module ? "" : local.kube_provider.generate.kube_provider.contents
contents = local.kube_provider.generate.kube_provider.contents
}

generate "helm_provider" {
path = local.helm_provider.generate.helm_provider.path
if_exists = local.helm_provider.generate.helm_provider.if_exists
contents = local.is_eks_module ? "" : local.helm_provider.generate.helm_provider.contents
contents = local.helm_provider.generate.helm_provider.contents
}

# ---------------------------------------------------------------------------------------------------------------------
Expand Down

0 comments on commit 85096fc

Please sign in to comment.