Skip to content

Commit

Permalink
pass ecr_info
Browse files Browse the repository at this point in the history
  • Loading branch information
morga471 committed Apr 19, 2025
1 parent cd4d2fc commit 943c453
Show file tree
Hide file tree
Showing 18 changed files with 31 additions and 48 deletions.
4 changes: 2 additions & 2 deletions .github/platform-tg-infra.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"path": "../../tfmod-eks-dns"
},
{
"name": "tfmod-ersi-arcgis",
"path": "../../tfmod-ersi-arcgis"
"name": "tfmod-esri-arcgis",
"path": "../../tfmod-esri-arcgis"
},
{
"name": "tfmod-grafana",
Expand Down
11 changes: 8 additions & 3 deletions lab/_envcommon/common-variables.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,24 @@ locals {
"us-gov-west-1" = "vpc-08b7b4db6a5ddf9c1"
}
}
eecr_account_id = local.enterprise_ecr_account.lab["account_id"]
eecr_alias = local.enterprise_ecr_account.lab["alias"]
eecr_profile = format("%v-%v", local.eecr_account_id, local.eecr_alias)
enterprise_ecr_account = {
lab = {
"account_id" = "269222635945"
"alias" = "lab-gov-shared-nonprod"
"profile" = "269222635945-lab-gov-shared-nonprod"
"region" = "us-gov-east-1"
}
prod = {
"account_id" = "067074201825"
"alias" = "ent-gov-shared-prod"
"profile" = "067074201825-ent-gov-shared-prod"
"region" = "us-gov-east-1"
}
}
eecr_info = {
account_id = local.enterprise_ecr_account.lab["account_id"]
alias = local.enterprise_ecr_account.lab["alias"]
profile = local.enterprise_ecr_account.lab["profile"]
region = local.enterprise_ecr_account.lab["region"]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ inputs = {
account_id = include.root.inputs.aws_account_id
profile = include.root.inputs.aws_profile
region = include.root.inputs.aws_region
eecr_info = include.root.inputs.eecr_info

# Cluster Configuration
cluster_domain = dependency.eks_dns.outputs.cluster_domain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ inputs = {
account_id = include.root.inputs.aws_account_id
profile = include.root.inputs.aws_profile
region = include.root.inputs.aws_region
eecr_account_id = include.root.inputs.eecr_account_id
eecr_info = include.root.inputs.eecr_info

# Cluster Configuration
cluster_name = dependency.eks.outputs.cluster_name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ inputs = {
account_id = include.root.inputs.aws_account_id
profile = include.root.inputs.aws_profile
region = include.root.inputs.aws_region
eecr_account_id = include.root.inputs.eecr_account_id

# Core Cluster Configuration
cluster_name = dependency.eks.outputs.cluster_name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ inputs = {
account_id = include.root.inputs.aws_account_id
profile = include.root.inputs.aws_profile
region = include.root.inputs.aws_region
eecr_account_id = include.root.inputs.enterprise_ecr_account

# Cluster Configuration
cluster_name = include.root.inputs.cluster_name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ dependencies {
inputs = {
# AWS Configuration
account_id = include.root.inputs.aws_account_id
eecr_account_id = include.root.inputs.eecr_account_id
eecr_info = include.root.inputs.eecr_info
profile = include.root.inputs.aws_profile
region = include.root.inputs.aws_region

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dependency "eks" {
inputs = {
# AWS Configuration
account_id = include.root.inputs.aws_account_id
eecr_account_id = include.root.inputs.eecr_account_id
eecr_info = include.root.inputs.eecr_info
profile = include.root.inputs.aws_profile
region = include.root.inputs.aws_region

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ inputs = {
account_id = include.root.inputs.aws_account_id
profile = include.root.inputs.aws_profile
region = include.root.inputs.aws_region
eecr_info = include.root.inputs.eecr_info

# Cluster Configuration
cluster_domain = dependency.eks_dns.outputs.cluster_domain
cluster_name = dependency.eks.outputs.cluster_name
eecr_account_id = include.root.inputs.eecr_account_id

# Dashboard Configuration
service_name = include.root.inputs.dashboard_hostname
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ inputs = {
account_id = include.root.inputs.aws_account_id
profile = include.root.inputs.aws_profile
region = include.root.inputs.aws_region
eecr_account_id = include.root.inputs.eecr_account_id
eecr_info = include.root.inputs.eecr_info

# Cluster Configuration
cluster_endpoint = dependency.eks.outputs.cluster_endpoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ dependencies {
inputs = {
cluster_domain = dependency.eks_dns.outputs.cluster_domain
cluster_name = dependency.eks.outputs.cluster_name
eecr_account_id = include.root.inputs.eecr_account_id
eecr_info = include.root.inputs.eecr_info
namespace = include.root.inputs.namespaces["keycloak"]
profile = include.root.inputs.aws_profile
region = include.root.inputs.aws_region
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ dependency "eks_grafana" {
url = "https://grafana.mock.svc.cluster.local:80/"
}
namespace = "grafana"
public_endpoint = {
hostname = "grafana.mock.lab.csp2.census.gov"
port_number = "80"
url = "https://grafana.mock.lab.csp2.census.gov:80/"
}
secret_name = "grafana"
tempo_datasource_id = "mock-tempo-datasource-id"
}
Expand Down Expand Up @@ -107,7 +102,7 @@ dependencies {
inputs = {
# AWS Configuration
account_id = include.root.inputs.aws_account_id
eecr_account_id = include.root.inputs.eecr_account_id
eecr_info = include.root.inputs.eecr_info
profile = include.root.inputs.aws_profile
region = include.root.inputs.aws_region

Expand All @@ -123,7 +118,6 @@ inputs = {
grafana_internal_url = dependency.eks_grafana.outputs.internal_endpoint.url
grafana_namespace = dependency.eks_grafana.outputs.namespace
grafana_secret_name = dependency.eks_grafana.outputs.secret_name
grafana_public_url = dependency.eks_grafana.outputs.public_endpoint

kiali_application_version = include.root.inputs.kiali_application_version
kiali_operator_version = include.root.inputs.kiali_operator_version
Expand All @@ -132,7 +126,6 @@ inputs = {
grafana_namespace = dependency.eks_grafana.outputs.namespace
grafana_secret_name = dependency.eks_grafana.outputs.secret_name
grafana_internal_url = dependency.eks_grafana.outputs.internal_endpoint.url
grafana_public_url = dependency.eks_grafana.outputs.public_endpoint
tempo_datasource_id = dependency.eks_grafana.outputs.tempo_datasource_id
tempo_internal_url = dependency.eks_tempo.outputs.tempo_internal_endpoint.url
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ dependencies {
inputs = {
# AWS Configuration
account_id = include.root.inputs.aws_account_id
eecr_account_id = include.root.inputs.eecr_account_id
eecr_info = include.root.inputs.eecr_info
profile = include.root.inputs.aws_profile
region = include.root.inputs.aws_region

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ dependencies {
inputs = {
# AWS Configuration
account_id = include.root.inputs.aws_account_id
eecr_account_id = include.root.inputs.eecr_account_id
eecr_info = include.root.inputs.eecr_info
profile = include.root.inputs.aws_profile
region = include.root.inputs.aws_region

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ dependencies {
inputs = {
# AWS Configuration
account_id = include.root.inputs.aws_account_id
eecr_account_id = include.root.inputs.eecr_account_id
eecr_info = include.root.inputs.eecr_info
profile = include.root.inputs.aws_profile
region = include.root.inputs.aws_region

# Clouster Config
cluster_name = dependency.eks.outputs.cluster_name

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ dependency "eks_config" {
inputs = {
# AWS Configuration
account_id = include.root.inputs.aws_account_id
eecr_account_id = include.root.inputs.eecr_account_id
eecr_info = include.root.inputs.eecr_info
profile = include.root.inputs.aws_profile
region = include.root.inputs.aws_region

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ dependencies {
inputs = {
# AWS Configuration
account_id = include.root.inputs.aws_account_id
eecr_account_id = include.root.inputs.eecr_account_id
eecr_info = include.root.inputs.eecr_info
profile = include.root.inputs.aws_profile
region = include.root.inputs.aws_region

Expand Down
29 changes: 7 additions & 22 deletions lab/root.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ locals {
# Automatically load vpc-level variables
vpc_vars = read_terragrunt_config(find_in_parent_folders("vpc.hcl"))

# Check if copy_images.tf exists in the module directory
has_copy_images = fileexists("${get_original_terragrunt_dir()}/copy_images.tf")

# Add any other locals you want to expose
# only expose things not already included via local.xxx_vars.locals.*
root_locals_for_inputs = {
is_module_enabled = local.is_module_enabled
module_name = local.module_name
eecr_profile = local.eecr_profile
# Add any other locals you want to expose
# only expose things not already included via local.xxx_vars.locals.*
has_copy_images = local.has_copy_images
}

# Extract the variables we need for easy access
Expand All @@ -38,8 +41,7 @@ locals {
aws_profile = local.account_vars.locals.aws_profile
aws_region = local.region_vars.locals.aws_region
cluster_name = local.cluster_vars.locals.cluster_name
eecr_account_id = local.common_vars.locals.eecr_account_id
eecr_profile = local.common_vars.locals.eecr_profile
eecr_info = local.common_vars.locals.eecr_info
environment_abbr = local.account_vars.locals.environment_abbr
finops_project_name = local.cluster_vars.locals.finops_project_name
finops_project_number = local.cluster_vars.locals.finops_project_number
Expand Down Expand Up @@ -156,23 +158,6 @@ generate "aws-provider" {
EOF
}

generate "eecr-provider" {
path = "eecr-provider.tf"
if_exists = "overwrite"
contents = <<-EOF
provider "aws" {
alias = "eecr"
profile = "${local.eecr_profile}"
region = "${local.aws_region}"
}
data "aws_ecr_authorization_token" "ecr_token" {
provider = aws.eecr
registry_id = var.eecr_account_id
}
EOF
}

# ---------------------------------------------------------------------------------------------------------------------
# GLOBAL PARAMETERS
# These variables apply to all configurations in this subfolder. These are automatically merged into the child
Expand Down

0 comments on commit 943c453

Please sign in to comment.