diff --git a/modules/project/README.md b/modules/project/README.md
index 697f9d25..03ec1ef9 100644
--- a/modules/project/README.md
+++ b/modules/project/README.md
@@ -183,6 +183,7 @@ module "project" {
| *billing_account* | Billing account id. | string
| | null
|
| *contacts* | List of essential contacts for this resource. Must be in the form EMAIL -> [NOTIFICATION_TYPES]. Valid notification types are ALL, SUSPENSION, SECURITY, TECHNICAL, BILLING, LEGAL, PRODUCT_UPDATES | map(list(string))
| | {}
|
| *custom_roles* | Map of role name => list of permissions to create in this project. | map(list(string))
| | {}
|
+| *descriptive_name* | Name of the project name. Used for project name instead of `name` variable | string
| | null
|
| *group_iam* | Authoritative IAM binding for organization groups, in {GROUP_EMAIL => [ROLES]} format. Group emails need to be static. Can be used in combination with the `iam` variable. | map(list(string))
| | {}
|
| *iam* | IAM bindings in {ROLE => [MEMBERS]} format. | map(list(string))
| | {}
|
| *iam_additive* | IAM additive bindings in {ROLE => [MEMBERS]} format. | map(list(string))
| | {}
|
diff --git a/modules/project/main.tf b/modules/project/main.tf
index e17f6f0a..dbc0de9f 100644
--- a/modules/project/main.tf
+++ b/modules/project/main.tf
@@ -15,6 +15,7 @@
*/
locals {
+ descriptive_name = var.descriptive_name != null ? var.descriptive_name : "${local.prefix}${var.name}"
group_iam_roles = distinct(flatten(values(var.group_iam)))
group_iam = {
for r in local.group_iam_roles : r => [
@@ -75,6 +76,7 @@ locals {
])
}
+
data "google_project" "project" {
count = var.project_create ? 0 : 1
project_id = "${local.prefix}${var.name}"
@@ -85,7 +87,7 @@ resource "google_project" "project" {
org_id = local.parent_type == "organizations" ? local.parent_id : null
folder_id = local.parent_type == "folders" ? local.parent_id : null
project_id = "${local.prefix}${var.name}"
- name = "${local.prefix}${var.name}"
+ name = "${local.descriptive_name}"
billing_account = var.billing_account
auto_create_network = var.auto_create_network
labels = var.labels
diff --git a/modules/project/variables.tf b/modules/project/variables.tf
index d4f917b3..a72e4d10 100644
--- a/modules/project/variables.tf
+++ b/modules/project/variables.tf
@@ -215,3 +215,9 @@ variable "service_perimeter_bridges" {
type = list(string)
default = null
}
+
+variable "descriptive_name" {
+ description = "Name of the project name. Used for project name instead of `name` variable"
+ type = string
+ default = null
+}