feat: add coder_parameter_order to all data.coder_parameter fields (#223)

This commit is contained in:
Michael Brewer
2024-04-15 10:31:21 -07:00
committed by GitHub
parent c4df384f4b
commit a8c659ad6f
14 changed files with 133 additions and 0 deletions

View File

@@ -27,4 +27,14 @@ describe("dotfiles", async () => {
});
expect(state.outputs.dotfiles_uri.value).toBe(default_dotfiles_uri);
});
it("set custom order for coder_parameter", async () => {
const order = 99;
const state = await runTerraformApply(import.meta.dir, {
agent_id: "foo",
coder_parameter_order: order.toString(),
});
expect(state.resources).toHaveLength(2);
expect(state.resources[0].instances[0].attributes.order).toBe(order);
});
});

View File

@@ -20,10 +20,17 @@ variable "default_dotfiles_uri" {
default = ""
}
variable "coder_parameter_order" {
type = number
description = "The order determines the position of a template parameter in the UI/CLI presentation. The lowest order is shown first and parameters with equal order are sorted by name (ascending order)."
default = null
}
data "coder_parameter" "dotfiles_uri" {
type = "string"
name = "dotfiles_uri"
display_name = "Dotfiles URL (optional)"
order = var.coder_parameter_order
default = var.default_dotfiles_uri
description = "Enter a URL for a [dotfiles repository](https://dotfiles.github.io) to personalize your workspace"
mutable = true