chore: allowed empty default for modules (#72)
From #66, also added testing for `jetbrains-gateway`. ## Regions Azure and AWS were simple, but there is no error message when no region is selected: https://github.com/coder/modules/assets/58410745/9a9e317b-7764-427f-b298-86313de5fb33 Open to feedback on this. ## Jetbrains Gateway The Jetbrains gateway default IDE satisfies a ton of logic in the template, so allowing `null` would lead to a lot of patchwork `try` statements. Now it's implemented to use the first IDE in the `jetbrains_ides` as the coder_parameter default for cleanliness. Let me know your thoughts.
This commit is contained in:
@@ -13,7 +13,7 @@ describe("aws-region", async () => {
|
||||
|
||||
it("default output", async () => {
|
||||
const state = await runTerraformApply(import.meta.dir, {});
|
||||
expect(state.outputs.value.value).toBe("us-east-1");
|
||||
expect(state.outputs.value.value).toBe("");
|
||||
});
|
||||
|
||||
it("customized default", async () => {
|
||||
|
||||
@@ -22,7 +22,7 @@ variable "description" {
|
||||
}
|
||||
|
||||
variable "default" {
|
||||
default = "us-east-1"
|
||||
default = ""
|
||||
description = "The default region to use if no region is specified."
|
||||
type = string
|
||||
}
|
||||
@@ -131,7 +131,7 @@ data "coder_parameter" "region" {
|
||||
name = "aws_region"
|
||||
display_name = var.display_name
|
||||
description = var.description
|
||||
default = var.default
|
||||
default = var.default == "" ? null : var.default
|
||||
mutable = var.mutable
|
||||
dynamic "option" {
|
||||
for_each = { for k, v in local.regions : k => v if !(contains(var.exclude, k)) }
|
||||
|
||||
Reference in New Issue
Block a user