You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When deploying 1-org
Error: error: bucket name validation failed bkt-cai-monitoring-5003-sources-699933893618-northamerica-northeast2
with module.cai_monitoring.module.cloudfunction_source_bucket.google_storage_bucket.bucket,
on ../../../terraform-google-modules/cloud-storage/google/modules/simple_bucket/main.tf line 17, in resource "google_storage_bucket" "bucket":
17: resource "google_storage_bucket" "bucket" {
Expected behavior
Limit name to max 63 characters regardless of how long the region name is
Observed behavior
No response
Terraform Configuration
in 0-bootstrap terraform.tfvarsorg_id="9468...etc..."# format "000000000000"billing_account="01A591-... etc..."# format "000000-000000-000000"group_org_admins="gcp-org-admins@gcp...etc....ca"group_billing_admins="gcp-billing-admins@gcp...etc...ca"group_billing_data_users="gcp-billing-data-users@gcp...etc...ca"group_audit_data_users="gcp-audit-data-users@gcp...etc...ca"group_monitoring_workspace_users="gcp-monitoring-workspace-users@gcp...etc...ca"default_region="northamerica-northeast2"
Terraform Version
[myself@linuxbox 0-bootstrap]# terraform version
Terraform v1.6.0
on linux_amd64
+ provider registry.terraform.io/hashicorp/google v5.20.0
+ provider registry.terraform.io/hashicorp/google-beta v5.20.0
+ provider registry.terraform.io/hashicorp/null v3.2.2
+ provider registry.terraform.io/hashicorp/random v3.6.0
+ provider registry.terraform.io/hashicorp/time v0.11.1
Your version of Terraform is out of date! The latest version
is 1.7.5. You can update by downloading from https://www.terraform.io/downloads.html
[myself@linuxbox 0-bootstrap]#
Additional information
Very easy (and tested) fix also guaranteeing uniqueness
in 1-org/modules/cai-monitoring/main.tf
locals {
project_service_apis = [
... etc ...
]
cai_source_name = var.random_suffix ? "CAI Monitoring - ${random_id.suffix.hex}" : "CAI Monitoring"
mromascanu123
changed the title
Bucket neme length exceeds 63 characters with non-US region deployment
Bucket name length exceeds 63 characters with non-US region deployment
Mar 18, 2024
ACK that some regions with long names tend to exceed the character limit for resource names (this problem can happen in many places, not just the bucket in this issue).
For the v5 changes, we'll evaluate if there's a better way to address this consistently, such as logic to truncate excessively long resource names, or a convention to abbreviate region names to a consistent length instead of writing out the full name.
TL;DR
When deploying 1-org
Error: error: bucket name validation failed bkt-cai-monitoring-5003-sources-699933893618-northamerica-northeast2
with module.cai_monitoring.module.cloudfunction_source_bucket.google_storage_bucket.bucket,
on ../../../terraform-google-modules/cloud-storage/google/modules/simple_bucket/main.tf line 17, in resource "google_storage_bucket" "bucket":
17: resource "google_storage_bucket" "bucket" {
Expected behavior
Limit name to max 63 characters regardless of how long the region name is
Observed behavior
No response
Terraform Configuration
Terraform Version
Additional information
Very easy (and tested) fix also guaranteeing uniqueness
in 1-org/modules/cai-monitoring/main.tf
locals {
project_service_apis = [
... etc ...
]
cai_source_name = var.random_suffix ? "CAI Monitoring - ${random_id.suffix.hex}" : "CAI Monitoring"
add this:
cai_monitoring_bucket_suffix = "${random_id.suffix.hex}-sources-${data.google_project.project.number}-${var.location}"
...
module "cloudfunction_source_bucket" {
...
// deterministic name length < 63 chars
// name = "bkt-cai-monitoring-${random_id.suffix.hex}-sources-${data.google_project.project.number}-${var.location}"
name = "bkt-cai-monitoring-${md5(local.cai_monitoring_bucket_suffix)}"
The text was updated successfully, but these errors were encountered: