https://github.com/terraform-google-modules/terraform-google-utils
Gets the short names for a given Google Cloud region
https://github.com/terraform-google-modules/terraform-google-utils
cft-terraform operations
Last synced: 4 months ago
JSON representation
Gets the short names for a given Google Cloud region
- Host: GitHub
- URL: https://github.com/terraform-google-modules/terraform-google-utils
- Owner: terraform-google-modules
- License: apache-2.0
- Created: 2019-10-31T19:15:48.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-12-06T00:48:22.000Z (6 months ago)
- Last Synced: 2024-12-28T07:18:12.308Z (5 months ago)
- Topics: cft-terraform, operations
- Language: HCL
- Homepage: https://registry.terraform.io/modules/terraform-google-modules/utils/google
- Size: 96.7 KB
- Stars: 14
- Watchers: 16
- Forks: 19
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# terraform-google-utils
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.
## Usage
Basic usage of this module is as follows:
```hcl
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](./examples/) directory.## Inputs
| 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 |## Outputs
| 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. |## Requirements
These sections describe requirements for using this module.
### Software
The following dependencies must be available:
- [Terraform][terraform] >= v0.12, < v0.14
### Service Account
A service account is not needed for to use this module.
### APIs
Projects/APIs are not required to use this module.
## Contributing
Refer to the [contribution guidelines](./CONTRIBUTING.md) for
information on contributing to this module.[iam-module]: https://registry.terraform.io/modules/terraform-google-modules/iam/google
[project-factory-module]: https://registry.terraform.io/modules/terraform-google-modules/project-factory/google
[terraform-provider-gcp]: https://www.terraform.io/docs/providers/google/index.html
[terraform]: https://www.terraform.io/downloads.html