Skip to content

Commit

Permalink
Add namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
GergelyKalmar committed Oct 17, 2024
1 parent d73b970 commit ea773bd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gcp/project/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ data "google_billing_account" "this" {
}

locals {
project_id = lower(replace(var.name, "/[ .]/", "-"))
name_id = lower(replace(var.name, "/[ .]/", "-"))
organization_id = replace(var.organization, ".", "-")
}

resource "google_project" "this" {
name = var.name
project_id = "${local.project_id}-${local.organization_id}"
project_id = join("-", compact([local.name_id, var.namespace, local.organization_id]))
folder_id = var.folder_id
billing_account = data.google_billing_account.this.id
}
6 changes: 6 additions & 0 deletions gcp/project/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ variable "name" {
type = string
}

variable "namespace" {
description = "The namespace of the project"
type = string
default = null
}

variable "folder_id" {
description = "The ID of the folder where the project is located"
type = string
Expand Down

0 comments on commit ea773bd

Please sign in to comment.