README WIP
This commit is contained in:
@@ -9,8 +9,49 @@ tags: [helper, parameter, fly]
|
||||
|
||||
# Fly.io Region
|
||||
|
||||
A parameter with all fly.io regions. This allows developers to select the region closest to them.
|
||||
This module adds Fly.io regions to your Coder template. Regions can be whitelisted using the `regions` argument and given custom names and custom icons with their respective map arguments (`custom_names`, `custom_icons`).
|
||||
|
||||
## Examples
|
||||
|
||||
TODO
|
||||
### Using default settings
|
||||
|
||||
```hcl
|
||||
module "fly-region" {
|
||||
source = "https://registry.coder.com/modules/fly-region"
|
||||
}
|
||||
```
|
||||
|
||||
[]()
|
||||
|
||||
|
||||
### Using region whitelist
|
||||
|
||||
The regions argument can be used to display only the desired regions in the Coder parameter.
|
||||
|
||||
```hcl
|
||||
module "fly-region" {
|
||||
source = "https://registry.coder.com/modules/fly-region"
|
||||
default = "ams"
|
||||
regions = ["ams", "arn", "atl"]
|
||||
}
|
||||
```
|
||||
|
||||
TODO: Add screenshot filtered_flyio.png
|
||||
|
||||
|
||||
### Using custom icons and names
|
||||
|
||||
Set custom icons and names with their respective maps.
|
||||
|
||||
```hcl
|
||||
module "fly-region" {
|
||||
source = "https://registry.coder.com/modules/fly-region"
|
||||
default = "ams"
|
||||
custom_icons = {
|
||||
"ams" = "/emojis/1f90e.png"
|
||||
}
|
||||
custom_names = {
|
||||
"ams" = "We love the Netherlands!"
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -270,7 +270,7 @@ data "coder_parameter" "fly_region" {
|
||||
name = "flyio_region"
|
||||
display_name = var.display_name
|
||||
description = var.description
|
||||
default = var.default
|
||||
default = (var.default != null && var.default != "") && (contains(var.regions, var.default) || length(var.regions) == 0) ? var.default : null
|
||||
mutable = var.mutable
|
||||
dynamic "option" {
|
||||
for_each = { for k, v in local.regions : k => v if anytrue([for d in var.regions : k == d ]) || length(var.regions) == 0 }
|
||||
|
||||
Reference in New Issue
Block a user