refactor(infra): deprecate namespace in favor of instance-name#173
refactor(infra): deprecate namespace in favor of instance-name#173dwnoble wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request replaces the namespace variable with instance_name across the Terraform configurations, CLI, tests, and documentation to improve resource naming clarity, while maintaining backward compatibility. The review feedback recommends adding a validation block to the new instance_name variable to enforce GCP naming conventions and prevent deployment failures, as well as cleaning up several extra consecutive blank lines introduced in the Terraform files.
| variable "instance_name" { | ||
| description = "A unique identifier used as a prefix for resource naming. This prevents naming conflicts when deploying multiple isolated environments (like dev, staging, or feature branches) within the same GCP project." | ||
| type = string | ||
| default = "" | ||
| } |
There was a problem hiding this comment.
To prevent deployment failures due to invalid resource names (e.g., containing underscores or exceeding length limits), it is highly recommended to add a validation block to var.instance_name. This ensures that any user-provided value conforms to GCP naming conventions (lowercase alphanumeric characters and dashes, up to 16 characters) when defined directly in terraform.tfvars.
variable "instance_name" {
description = "A unique identifier used as a prefix for resource naming. This prevents naming conflicts when deploying multiple isolated environments (like dev, staging, or feature branches) within the same GCP project."
type = string
default = ""
validation {
condition = var.instance_name == "" || (length(var.instance_name) <= 16 && can(regex("^[a-z]([-a-z0-9]*[a-z0-9])?$", var.instance_name)))
error_message = "The instance_name must be 16 characters or less, start with a lowercase letter, end with a lowercase letter or number, and contain only lowercase alphanumeric characters and dashes."
}
}
| clean_namespace_prefix = local.clean_namespace_prefix | ||
|
|
||
|
|
||
| enable_redis_cache_clearing = var.enable_redis_cache_clearing |
| } | ||
|
|
||
|
|
||
|
|
||
| variable "ingestion_helper_service_name" { |
| } | ||
|
|
||
|
|
||
| module "redis" { |
5491f9a to
17f0207
Compare
Deprecates the use of the word 'namespace' for prefixing resource names in Terraform configurations and scaffolding, replacing it with the clearer term 'instance_name'. Main changes include variables, default values, validations, and documentation updates while preserving backward compatibility.