Skip to content

Commit

Permalink
module_providers
Browse files Browse the repository at this point in the history
  • Loading branch information
morga471 committed Jul 27, 2024
1 parent 0974ad2 commit 02c6c34
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@ include "root" {
path = find_in_parent_folders()
}

locals {
providers = ["kubernetes", "helm"]
}

terraform {
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-cert-mgr.git"
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-cert-mgr.git?ref=mcmCluster"
extra_arguments "retry_lock" {
commands = get_terraform_commands_that_need_locking()
arguments = ["-lock-timeout=20m"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ include "root" {

locals {
tag_costallocation = "census:csvd:platformbaseline"
providers = ["kubernetes", "helm"]
}

terraform {
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-cloudwatch.git"
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-cloudwatch.git?ref=mcmCluster"
extra_arguments "retry_lock" {
commands = get_terraform_commands_that_need_locking()
arguments = ["-lock-timeout=20m"]
Expand Down
7 changes: 5 additions & 2 deletions lab/us-gov-east-1/vpc/_mcmCluster/eks-config/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ include "root" {

locals {
tag_costallocation = "census:csvd:platformbaseline"
providers = ["kubernetes", "helm"]
}

terraform {
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-eks-configuration.git?ref=karpenter"
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-eks-configuration.git?ref=mcmCluster"
extra_arguments "retry_lock" {
commands = get_terraform_commands_that_need_locking()
arguments = ["-lock-timeout=20m"]
Expand All @@ -19,6 +18,10 @@ dependency "eks" {
config_path = "../eks"
}

dependency "eks-karpenter" {
config_path = "../eks-karpenter"
}

inputs = {
profile = dependency.eks.inputs.profile
vpc_id = dependency.eks.outputs.vpc_id
Expand Down
6 changes: 1 addition & 5 deletions lab/us-gov-east-1/vpc/_mcmCluster/eks-grafana/terragrunt.hcl
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
locals {
providers = ["kubernetes", "helm"]
}

terraform {
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-grafana.git"
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-grafana.git?ref=mcmCluster"
extra_arguments "retry_lock" {
commands = get_terraform_commands_that_need_locking()
arguments = ["-lock-timeout=20m"]
Expand Down
7 changes: 1 addition & 6 deletions lab/us-gov-east-1/vpc/_mcmCluster/eks-istio/terragrunt.hcl
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
include "root" {
path = find_in_parent_folders()
expose = true
}

locals {
providers = ["kubernetes", "helm"]
}

terraform {
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-istio.git?ref=1.0.4"
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-istio.git?ref=mcmCluster"
extra_arguments "retry_lock" {
commands = get_terraform_commands_that_need_locking()
arguments = ["-lock-timeout=20m"]
Expand Down
13 changes: 7 additions & 6 deletions lab/us-gov-east-1/vpc/_mcmCluster/eks-karpenter/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ include "root" {

locals {
tag_costallocation = "census:csvd:platformbaseline"
providers = ["kubernetes", "helm"]
}

terraform {
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-karpenter.git"
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-karpenter.git?ref=mcmCluster"
extra_arguments "retry_lock" {
commands = get_terraform_commands_that_need_locking()
arguments = ["-lock-timeout=20m"]
Expand All @@ -18,10 +17,12 @@ terraform {
dependency "eks" {
config_path = "../eks"
}
dependency "eks-config" {
config_path = "../eks-config"
}

inputs = {

profile = dependency.eks.inputs.profile
cluster_endpoint = dependency.eks.outputs.cluster_endpoint
cluster_name = dependency.eks.inputs.cluster_name
karpenter_node_group_name = dependency.eks.outputs.node_group_name
oidc_provider_arn = dependency.eks.outputs.oidc_provider_arn
region = dependency.eks.inputs.region
}
3 changes: 1 addition & 2 deletions lab/us-gov-east-1/vpc/_mcmCluster/eks-kiali/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ include "root" {

locals {
tag_costallocation = "census:csvd:platformbaseline"
providers = ["kubernetes", "helm"]
}

terraform {
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-kiali.git"
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-kiali.git?ref=mcmCluster"
extra_arguments "retry_lock" {
commands = get_terraform_commands_that_need_locking()
arguments = ["-lock-timeout=20m"]
Expand Down
11 changes: 2 additions & 9 deletions lab/us-gov-east-1/vpc/_mcmCluster/eks-loki/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@ include "root" {
path = find_in_parent_folders()
}

locals {
providers = ["kubernetes", "helm"]
}

terraform {
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-loki.git"
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-loki.git?ref=mcmCluster"
extra_arguments "retry_lock" {
commands = get_terraform_commands_that_need_locking()
arguments = ["-lock-timeout=20m"]
Expand All @@ -18,10 +14,7 @@ dependency "eks" {
config_path = "../eks"
}
dependency "eks-config" {
config_path = "../eks-config"
}
dependency "eks-istio" {
config_path = "../eks-istio"
config_path = "../eks-config"
}

inputs = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ include "root" {

locals {
tag_costallocation = "census:csvd:platformbaseline"
providers = ["kubernetes", "helm"]
}

terraform {
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-metrics-server.git"
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-metrics-server.git?ref=mcmCluster"
extra_arguments "retry_lock" {
commands = get_terraform_commands_that_need_locking()
arguments = ["-lock-timeout=20m"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@ include "root" {
path = find_in_parent_folders()
}

locals {
providers = ["kubernetes", "helm"]
}

terraform {
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-prometheus.git"
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-prometheus.git?ref=mcmCluster"
extra_arguments "retry_lock" {
commands = get_terraform_commands_that_need_locking()
arguments = ["-lock-timeout=20m"]
Expand Down
3 changes: 1 addition & 2 deletions lab/us-gov-east-1/vpc/_mcmCluster/eks-tempo/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ include "root" {

locals {
tag_costallocation = "census:csvd:platformbaseline"
providers = ["kubernetes", "helm"]
}

terraform {
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-tempo.git"
source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-tempo.git?ref=mcmCluster"
extra_arguments "retry_lock" {
commands = get_terraform_commands_that_need_locking()
arguments = ["-lock-timeout=20m"]
Expand Down
1 change: 0 additions & 1 deletion lab/us-gov-east-1/vpc/_mcmCluster/eks/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ locals {
profile = "224384469011-lab-dev-gov"
region = local.region_vars.locals.aws_region
cluster_mailing_list = "matthew.c.morgan@census.gov"
providers = ["kubernetes", "helm"]

# Tags applied to AWS objects created
tags = {
Expand Down
9 changes: 5 additions & 4 deletions lab/us-gov-east-1/vpc/_mcmCluster/terragrunt.hcl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
locals {
# Automatically load _envcommon, cross account and environment common variables
# common_vars = read_terragrunt_config("${dirname(find_in_parent_folders())}/_envcommon/common-variables.hcl", "skip-account-if-does-not-exist")
# common_vars = read_terragrunt_config(find_in_parent_folders("common_vars.hcl"))
// "${get_tfvars_dir()}/${find_in_parent_folders("account.tfvars", "skip-account-if-does-not-exist")}",

# Automatically load account-level variables (NOTE: In our environment account = environment so there is not separate environment layer)
Expand All @@ -23,7 +23,7 @@ locals {
project_number = "fs0000000078"
project_role = "csvd_platformbaseline_mcm"
region = local.region_vars.locals.aws_region
providers = []
_module_providers = []
}

generate "provider" {
Expand Down Expand Up @@ -54,7 +54,7 @@ provider "aws" {
allowed_account_ids = ["${local.account_id}"]
}
%{if contains(local.providers, "kubernetes") || contains(local.providers, "helm")}
%{if contains(local._module_providers, "kubernetes") || contains(local._module_providers, "helm")}
data "aws_eks_cluster" "cluster" {
name = "${local.config.cluster_name}"
}
Expand All @@ -67,7 +67,7 @@ provider "kubernetes" {
token = data.aws_eks_cluster_auth.cluster.token
}
%{endif}
%{if contains(local.providers, "helm")}
%{if contains(local._module_providers, "helm")}
provider "helm" {
kubernetes {
host = data.aws_eks_cluster.cluster.endpoint
Expand Down Expand Up @@ -96,5 +96,6 @@ remote_state {

inputs = merge(
local.account_vars.locals,
# local.common_vars.locals,
local.region_vars.locals,
)

0 comments on commit 02c6c34

Please sign in to comment.