From 56261101c31d6e92700cfabce521a5a6f061dc00 Mon Sep 17 00:00:00 2001 From: Dazbo Date: Wed, 12 Apr 2023 00:36:37 +0100 Subject: [PATCH] Allow longer org pfx plus tenant pfx (#1318) Thanks!!! --- fast/stages-multitenant/0-bootstrap-tenant/README.md | 4 +++- fast/stages-multitenant/1-resman-tenant/variables.tf | 4 ++-- fast/stages/0-bootstrap/README.md | 9 +++++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/fast/stages-multitenant/0-bootstrap-tenant/README.md b/fast/stages-multitenant/0-bootstrap-tenant/README.md index 9cecf5f8..76e36795 100644 --- a/fast/stages-multitenant/0-bootstrap-tenant/README.md +++ b/fast/stages-multitenant/0-bootstrap-tenant/README.md @@ -52,7 +52,9 @@ As most of the features of this stage follow the same design and configurations ## Naming -This stage sets the prefix used to name tenant resources, and passes it downstream to the other tenant stages together with the other globals needed by the tenant. The default is to append the tenant short name (a 3 or 4 letter acronym or abbreviation) to the organization-level prefix, if that is not desired this can be changed by editing local definitions in the `main.tf` file. Just be aware that some resources have name length constraints. +This stage sets the prefix used to name tenant resources, and passes it downstream to the other tenant stages together with the other globals needed by the tenant. The default is to append the tenant short name (an acronym or abbreviation with a minimum of 2 and a maximum of 4 characters) to the organization-level prefix. If that is not desired this can be changed by editing local definitions in the `main.tf` file. Just be aware that some resources have name length constraints. + +Note that if the organization-level prefix contains 9 characters then the tenant-level prefix will be limited to 2 characters. Use a shorter organization-level prefix if you want to use a longer tenant-level prefix. ## How to run this stage diff --git a/fast/stages-multitenant/1-resman-tenant/variables.tf b/fast/stages-multitenant/1-resman-tenant/variables.tf index 1698b7e1..1c399be2 100644 --- a/fast/stages-multitenant/1-resman-tenant/variables.tf +++ b/fast/stages-multitenant/1-resman-tenant/variables.tf @@ -229,8 +229,8 @@ variable "prefix" { type = string validation { - condition = try(length(var.prefix), 0) < 10 - error_message = "Use a maximum of 9 characters for prefix." + condition = try(length(var.prefix), 0) < 13 + error_message = "Use a maximum of 12 characters for prefix (which is a combination of org prefix and tenant short name)." } } diff --git a/fast/stages/0-bootstrap/README.md b/fast/stages/0-bootstrap/README.md index af02d1b9..96038bdc 100644 --- a/fast/stages/0-bootstrap/README.md +++ b/fast/stages/0-bootstrap/README.md @@ -90,7 +90,8 @@ We are intentionally not supporting random prefix/suffixes for names, as that is What is implemented here is a fairly common convention, composed of tokens ordered by relative importance: -- a static prefix less or equal to 9 characters (e.g. `myco` or `myco-gcp`) +- an organization-level static prefix less or equal to 9 characters (e.g. `myco` or `myco-gcp`) +- an optional tenant-level prefix, if using multitenant stages - an environment identifier (e.g. `prod`) - a team/owner identifier (e.g. `sec` for Security) - a context identifier (e.g. `core` or `kms`) @@ -208,7 +209,11 @@ Then make sure you have configured the correct values for the following variable - `organization.id`, `organization.domain`, `organization.customer_id` the id, domain and customer id of your organization, derived from the Cloud Console UI or by running `gcloud organizations list` - `prefix` - the fixed prefix used in your naming, maximum 9 characters long + the fixed org-level prefix used in your naming, maximum 9 characters long. Note that if you are using multitenant stages, then you will later need to configure a `tenant prefix`. + This `tenant prefix` can have a maximum length of 2 characters, + plus any unused characters from the from the `prefix`. + For example, if you specify a `prefix` that is 7 characters long, + then your `tenant prefix` can have a maximum of 4 characters. You can also adapt the example that follows to your needs: