Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/memes/terraform-google-region-detail

Terraform module to provide information about a set of Google Compute regions.
https://github.com/memes/terraform-google-region-detail

Last synced: 7 days ago
JSON representation

Terraform module to provide information about a set of Google Compute regions.

Awesome Lists containing this project

README

        

# Google Compute Engine region details module

![GitHub release](https://img.shields.io/github/v/release/memes/terraform-google-region-detail?sort=semver)
![Maintenance](https://img.shields.io/maintenance/yes/2024)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)

This Terraform module takes a list of Google Compute Engine region names, and
returns a map with each region name as a key to an object:

* a consistent 6 character abbreviation for the region of the format `xx-yyN`
* a display name that should match the value given in the [docs](https://cloud.google.com/compute/docs/regions-zones#available)
* an estimated latitude and longitude
* a list of IPv4 and IPv6 CIDRs associated with the region

No validation is performed to ensure a name represents an active or available Compute
Engine region; in the event the name is not recognized, the display name will be
`Unknown region`, the ipv4 and ipv6 CIDR lists will be empty, and the latitude
and longitude fields will match those of the US Geological Survey marker in Kansas
that represents the [historical center of the contiguous United States].

> NOTE: If you think this is in error for a given region, please open an issue
to get the region added.

## Examples

### `us-west` and `us-central1`

```hcl
module "regions" {
source = "memes/region-detail/google"
version = "1.1.5"
regions = ["us-west1", "us-central1"]
}
```

Output:

```hcl
results = {
"us-central1" = {
"abbreviation" = "us-ce1"
"display_name" = "Council Bluffs, Iowa"
"latitude" = 41.237085
"longitude" = -96.868656
"ipv4" = [ list of IPv4 addresses ]
"ipv6" = [ list of IPv6 addresses ]
}
"us-west1" = {
"abbreviation" = "us-we1"
"display_name" = "The Dalles, Oregon"
"latitude" = 45.609235
"longitude" = -121.205447
"ipv4" = [ list of IPv4 addresses ]
"ipv6" = [ list of IPv6 addresses ]
}
}
```

### Unknown region: `foo-bar1`

```hcl
module "regions" {
source = "memes/multi-region-private-network/google//modules/regions"
version = "1.1.5"
regions = ["foo-bar1"]
}
```

Output:

```hcl
results = {
"foo-bar1" = {
"abbreviation" = "fo-ba1"
"display_name" = "Unknown region"
"latitude" = 39.82835
"longitude" = -98.5816737
"ipv4" = []
"ipv6" = []
}
}
```

## Requirements

| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.2 |
| [http](#requirement\_http) | >= 3.2 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [http_http.cloud_json](https://registry.terraform.io/providers/hashicorp/http/latest/docs/data-sources/http) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [regions](#input\_regions) | A list of Google Compute region names for which to return details. The module
does not validate that any region name is valid, just that it matches a pattern
expected of Google Compute region names. | `list(string)` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| [results](#output\_results) | For each supplied region, return an abbreviation for the name in the form
`xx-yyN`, a display name that matches the value listed in Google's documentation,
and a reasonable latitude and longitude for the region. In the event of a
region being unknown to the module, the returned latitude and longitude will
be for the historical geographic center of the contiguous 48 United States. |

[historical center of the contiguous United States]: https://www.google.com/maps/place/The+Geographic+Center+of+the+United+States/@39.8283459,-98.5816684,17z