This module provides a way to get the shortnames for a given GCP region. For example, "us-central1" becomes "usc1". This module also always outputs a map for every region, which allows you to do multiple at once.
This module does not communicate with GCP in any way.
Basic usage of this module is as follows:
module "utils" {
source = "terraform-google-modules/utils/google"
version = "~> 0.7"
region = "us-central1"
}
locals {
"us-central1" = module.utils.region_short_name
"asia-east1" = module.utils.region_short_name_map["asia-east1"]
}
The above results in locals with computed values of:
locals {
"us-central1" = "usc1"
"asia-east1" = "aze1"
}
Functional examples are included in the examples directory.
Name | Description | Type | Default | Required |
---|---|---|---|---|
additional_regions | A user-supplied list of regions to extend the lookup map. | list(string) |
[] |
no |
region | The GCP region to retrieve a short name for (ex. us-central1). |
string |
null |
no |
Name | Description |
---|---|
region_short_name | The 4 or 5 character shortname of the region specified in var.region. |
region_short_name_map | The 4 or 5 character shortname of any given region. |
These sections describe requirements for using this module.
The following dependencies must be available:
- Terraform >= v0.12, < v0.14
A service account is not needed for to use this module.
Projects/APIs are not required to use this module.
Refer to the contribution guidelines for information on contributing to this module.