updated README
This commit is contained in:
@@ -13,4 +13,36 @@ A parameter with all Azure regions. This allows developers to select the region
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
TODO
|
### Default region
|
||||||
|
|
||||||
|
```hcl
|
||||||
|
module "azure_region" {
|
||||||
|
source = "https://registry.coder.com/modules/azure-region"
|
||||||
|
default = "eastus"
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "azure" {
|
||||||
|
region = module.azure_region.value
|
||||||
|
...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Customize existing regions
|
||||||
|
|
||||||
|
Change the display name for a region:
|
||||||
|
|
||||||
|
```hcl
|
||||||
|
module "azure-region" {
|
||||||
|
source = "https://registry.coder.com/modules/azure-region"
|
||||||
|
custom_names = {
|
||||||
|
"eastus": "Eastern United States!"
|
||||||
|
}
|
||||||
|
custom_icons = {
|
||||||
|
"eastus": "/icons/smiley.svg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "aws" {
|
||||||
|
region = module.aws_region.value
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ variable "exclude" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
locals {
|
locals {
|
||||||
regions = {
|
all_regions = {
|
||||||
"eastus" = {
|
"eastus" = {
|
||||||
name = "US (Virginia)"
|
name = "US (Virginia)"
|
||||||
icon = "/emojis/1f1fa-1f1f8.png"
|
icon = "/emojis/1f1fa-1f1f8.png"
|
||||||
@@ -166,7 +166,7 @@ data "coder_parameter" "region" {
|
|||||||
default = var.default
|
default = var.default
|
||||||
mutable = var.mutable
|
mutable = var.mutable
|
||||||
dynamic "option" {
|
dynamic "option" {
|
||||||
for_each = { for k, v in local.regions : k => v if !(contains(var.exclude, k)) }
|
for_each = { for k, v in local.all_regions : k => v if !(contains(var.exclude, k)) }
|
||||||
content {
|
content {
|
||||||
name = try(var.custom_names[option.key], option.value.name)
|
name = try(var.custom_names[option.key], option.value.name)
|
||||||
icon = try(var.custom_icons[option.key], option.value.icon)
|
icon = try(var.custom_icons[option.key], option.value.icon)
|
||||||
|
|||||||
Reference in New Issue
Block a user