Skip to content

Commit

Permalink
externalize project suffixes
Browse files Browse the repository at this point in the history
  • Loading branch information
caetano-colin committed May 15, 2024
1 parent a15a1c8 commit a963b03
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
5 changes: 2 additions & 3 deletions 4-projects/modules/ml_infra_projects/artifacts_project.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/

locals {
artifacts_project_suffix = "artifacts"
artifact_tf_sa_roles = [
"roles/artifactregistry.admin",
"roles/cloudbuild.builds.editor",
Expand Down Expand Up @@ -49,14 +48,14 @@ module "app_infra_artifacts_project" {
"sourcerepo.googleapis.com",
]
# Metadata
project_suffix = local.artifacts_project_suffix
project_suffix = var.artifacts_project_suffix
application_name = "app-infra-artifacts"
billing_code = var.billing_code
primary_contact = var.primary_contact
secondary_contact = var.secondary_contact
business_code = var.business_code
environment_kms_project_id = var.environment_kms_project_id
project_name = "${var.project_prefix}-${local.env_code}-${var.business_code}${local.artifacts_project_suffix}"
project_name = "${var.project_prefix}-${local.env_code}-${var.business_code}${var.artifacts_project_suffix}"
prevent_destroy = var.prevent_destroy
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/

locals {
service_catalog_project_suffix = "service-catalog"
service_catalog_tf_sa_roles = [
"roles/cloudbuild.builds.editor",
"roles/iam.serviceAccountAdmin",
Expand Down Expand Up @@ -47,14 +46,14 @@ module "app_service_catalog_project" {
"sourcerepo.googleapis.com",
]
# Metadata
project_suffix = local.service_catalog_project_suffix
project_suffix = var.service_catalog_project_suffix
application_name = "app-infra-ml"
billing_code = var.billing_code
primary_contact = var.primary_contact
secondary_contact = var.secondary_contact
business_code = var.business_code
environment_kms_project_id = var.environment_kms_project_id
project_name = "${var.project_prefix}-${local.env_code}-${var.business_code}${local.service_catalog_project_suffix}"
project_name = "${var.project_prefix}-${local.env_code}-${var.business_code}${var.service_catalog_project_suffix}"
prevent_destroy = var.prevent_destroy
}

Expand Down
12 changes: 12 additions & 0 deletions 4-projects/modules/ml_infra_projects/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,15 @@ variable "prevent_destroy" {
description = "Prevent Project Key destruction."
type = bool
}

variable "artifacts_project_suffix" {
description = "Artifacts Project Suffix."
type = string
default = "artifacts"
}

variable "service_catalog_project_suffix" {
description = "Service Catalog Project Suffix."
type = string
default = "service-catalog"
}

0 comments on commit a963b03

Please sign in to comment.