NEW: aws-region-short module
This commit is contained in:
parent
914c6661fe
commit
d359982fb5
13
modules/util/aws-region-short/README.md
Normal file
13
modules/util/aws-region-short/README.md
Normal file
@ -0,0 +1,13 @@
|
||||
# aws-region-short module
|
||||
Module which returns a map of aws regions and their short code.
|
||||
|
||||
## Example root module
|
||||
```terraform
|
||||
module region-short {
|
||||
source = "git::https://xpk.headdesk.me/git/xpk/terraform.aws-baseline-infra//modules/util/aws-region-short"
|
||||
}
|
||||
|
||||
output region-short-code {
|
||||
value = lookup(module.region-short.region-map, var.aws-region)
|
||||
}
|
||||
```
|
7
modules/util/aws-region-short/examples/main.tf
Normal file
7
modules/util/aws-region-short/examples/main.tf
Normal file
@ -0,0 +1,7 @@
|
||||
module region-short {
|
||||
source = "git::https://xpk.headdesk.me/git/xpk/terraform.aws-baseline-infra//modules/util/aws-region-short"
|
||||
}
|
||||
|
||||
output region-short-code {
|
||||
value = lookup(module.region-short.region-map, "ap-northeast-2")
|
||||
}
|
25
modules/util/aws-region-short/main.tf
Normal file
25
modules/util/aws-region-short/main.tf
Normal file
@ -0,0 +1,25 @@
|
||||
output "region-map" {
|
||||
value = local.region-map
|
||||
}
|
||||
|
||||
locals {
|
||||
region-map = {
|
||||
ap-northeast-1 = "apne1"
|
||||
ap-northeast-2 = "apne2"
|
||||
ap-northeast-3 = "apne3"
|
||||
ap-south-1 = "aps1"
|
||||
ap-southeast-1 = "apse1"
|
||||
ap-southeast-2 = "apse2"
|
||||
ca-central-1 = "cac1"
|
||||
eu-central-1 = "euc1"
|
||||
eu-north-1 = "eun1"
|
||||
eu-west-1 = "euw1"
|
||||
eu-west-2 = "euw2"
|
||||
eu-west-3 = "euw3"
|
||||
sa-east-1 = "sae1"
|
||||
us-east-1 = "use1"
|
||||
us-east-2 = "use2"
|
||||
us-west-1 = "usw1"
|
||||
us-west-2 = "usw2"
|
||||
}
|
||||
}
|
9
modules/util/aws-region-short/provider.tf
Normal file
9
modules/util/aws-region-short/provider.tf
Normal file
@ -0,0 +1,9 @@
|
||||
terraform {
|
||||
required_version = "~> 1.2.5"
|
||||
required_providers {
|
||||
aws = {
|
||||
source = "hashicorp/aws"
|
||||
version = "~> 3.75.2"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user