Skip to content

feat: implement inline version metadata system for new resources #417

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/data-sources/external_auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
page_title: "coder_external_auth Data Source - terraform-provider-coder"
subcategory: ""
description: |-
Use this data source to require users to authenticate with an external service prior to workspace creation. This can be used to pre-authenticate external services https://coder.com/docs/admin/external-auth in a workspace. (e.g. Google Cloud, Github, Docker, etc.)
Use this data source to require users to authenticate with an external service prior to workspace creation. This can be used to pre-authenticate external services https://coder.com/docs/admin/external-auth in a workspace. (e.g. Google Cloud, Github, Docker, etc.)
---

# coder_external_auth (Data Source)
Expand All @@ -17,12 +17,12 @@ provider "coder" {}


data "coder_external_auth" "github" {
id = "github"
id = "github"
}

data "coder_external_auth" "azure-identity" {
id = "azure-identiy"
optional = true
id = "azure-identiy"
optional = true
}
```

Expand Down
180 changes: 90 additions & 90 deletions docs/data-sources/parameter.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
page_title: "coder_parameter Data Source - terraform-provider-coder"
subcategory: ""
description: |-
Use this data source to configure editable options for workspaces.
Use this data source to configure editable options for workspaces.
---

# coder_parameter (Data Source)
Expand All @@ -16,119 +16,119 @@ Use this data source to configure editable options for workspaces.
provider "coder" {}

data "coder_parameter" "example" {
name = "Region"
description = "Specify a region to place your workspace."
mutable = false
type = "string"
default = "us-central1-a"
option {
value = "us-central1-a"
name = "US Central"
icon = "/icons/1f1fa-1f1f8.png"
}
option {
value = "asia-southeast1-a"
name = "Singapore"
icon = "/icons/1f1f8-1f1ec.png"
}
name = "Region"
description = "Specify a region to place your workspace."
mutable = false
type = "string"
default = "us-central1-a"
option {
value = "us-central1-a"
name = "US Central"
icon = "/icons/1f1fa-1f1f8.png"
}
option {
value = "asia-southeast1-a"
name = "Singapore"
icon = "/icons/1f1f8-1f1ec.png"
}
}

data "coder_parameter" "ami" {
name = "Machine Image"
description = <<-EOT
# Provide the machine image
See the [registry](https://container.registry.blah/namespace) for options.
EOT
option {
value = "ami-xxxxxxxx"
name = "Ubuntu"
icon = "/icon/ubuntu.svg"
}
name = "Machine Image"
description = <<-EOT
# Provide the machine image
See the [registry](https://container.registry.blah/namespace) for options.
EOT
option {
value = "ami-xxxxxxxx"
name = "Ubuntu"
icon = "/icon/ubuntu.svg"
}
}

data "coder_parameter" "is_public_instance" {
name = "Is public instance?"
type = "bool"
icon = "/icon/docker.svg"
default = false
name = "Is public instance?"
type = "bool"
icon = "/icon/docker.svg"
default = false
}

data "coder_parameter" "cores" {
name = "CPU Cores"
type = "number"
icon = "/icon/cpu.svg"
default = 3
order = 10
name = "CPU Cores"
type = "number"
icon = "/icon/cpu.svg"
default = 3
order = 10
}

data "coder_parameter" "disk_size" {
name = "Disk Size"
type = "number"
default = "5"
order = 8
validation {
# This can apply to number.
min = 0
max = 10
monotonic = "increasing"
}
name = "Disk Size"
type = "number"
default = "5"
order = 8
validation {
# This can apply to number.
min = 0
max = 10
monotonic = "increasing"
}
}

data "coder_parameter" "cat_lives" {
name = "Cat Lives"
type = "number"
default = "9"
validation {
# This can apply to number.
min = 0
max = 10
monotonic = "decreasing"
}
name = "Cat Lives"
type = "number"
default = "9"
validation {
# This can apply to number.
min = 0
max = 10
monotonic = "decreasing"
}
}

data "coder_parameter" "fairy_tale" {
name = "Fairy Tale"
type = "string"
mutable = true
default = "Hansel and Gretel"
ephemeral = true
name = "Fairy Tale"
type = "string"
mutable = true
default = "Hansel and Gretel"
ephemeral = true
}

data "coder_parameter" "users" {
name = "system_users"
display_name = "System users"
type = "list(string)"
default = jsonencode(["root", "user1", "user2"])
name = "system_users"
display_name = "System users"
type = "list(string)"
default = jsonencode(["root", "user1", "user2"])
}

data "coder_parameter" "home_volume_size" {
name = "Home Volume Size"
description = <<-EOF
How large should your home volume be?
EOF
type = "number"
default = 30
mutable = true
order = 3

option {
name = "30GB"
value = 30
}

option {
name = "60GB"
value = 60
}

option {
name = "100GB"
value = 100
}

validation {
monotonic = "increasing"
}
name = "Home Volume Size"
description = <<-EOF
How large should your home volume be?
EOF
type = "number"
default = 30
mutable = true
order = 3

option {
name = "30GB"
value = 30
}

option {
name = "60GB"
value = 60
}

option {
name = "100GB"
value = 100
}

validation {
monotonic = "increasing"
}
}
```

Expand Down
20 changes: 10 additions & 10 deletions docs/data-sources/provisioner.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
page_title: "coder_provisioner Data Source - terraform-provider-coder"
subcategory: ""
description: |-
Use this data source to get information about the Coder provisioner.
Use this data source to get information about the Coder provisioner.
---

# coder_provisioner (Data Source)
Expand All @@ -20,15 +20,15 @@ data "coder_provisioner" "dev" {}
data "coder_workspace" "dev" {}

resource "coder_agent" "main" {
arch = data.coder_provisioner.dev.arch
os = data.coder_provisioner.dev.os
dir = "/workspace"
display_apps {
vscode = true
vscode_insiders = false
web_terminal = true
ssh_helper = false
}
arch = data.coder_provisioner.dev.arch
os = data.coder_provisioner.dev.os
dir = "/workspace"
display_apps {
vscode = true
vscode_insiders = false
web_terminal = true
ssh_helper = false
}
}
```

Expand Down
68 changes: 34 additions & 34 deletions docs/data-sources/workspace.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
page_title: "coder_workspace Data Source - terraform-provider-coder"
subcategory: ""
description: |-
Use this data source to get information for the active workspace build.
Use this data source to get information for the active workspace build.
---

# coder_workspace (Data Source)
Expand All @@ -22,42 +22,42 @@ data "coder_workspace" "me" {}
data "coder_workspace_owner" "me" {}

resource "coder_agent" "dev" {
arch = "amd64"
os = "linux"
dir = "/workspace"
arch = "amd64"
os = "linux"
dir = "/workspace"
}

resource "docker_container" "workspace" {
count = data.coder_workspace.me.start_count
image = docker_image.main.name
# Uses lower() to avoid Docker restriction on container names.
name = "coder-${data.coder_workspace_owner.me.name}-${lower(data.coder_workspace.me.name)}"
# Hostname makes the shell more user friendly: coder@my-workspace:~$
hostname = data.coder_workspace.me.name
# Use the docker gateway if the access URL is 127.0.0.1
entrypoint = ["sh", "-c", replace(coder_agent.main.init_script, "/localhost|127\\.0\\.0\\.1/", "host.docker.internal")]
env = ["CODER_AGENT_TOKEN=${coder_agent.main.token}"]
host {
host = "host.docker.internal"
ip = "host-gateway"
}
# Add labels in Docker to keep track of orphan resources.
labels {
label = "coder.owner"
value = data.coder_workspace_owner.me.name
}
labels {
label = "coder.owner_id"
value = data.coder_workspace_owner.me.id
}
labels {
label = "coder.workspace_id"
value = data.coder_workspace.me.id
}
labels {
label = "coder.workspace_name"
value = data.coder_workspace.me.name
}
count = data.coder_workspace.me.start_count
image = docker_image.main.name
# Uses lower() to avoid Docker restriction on container names.
name = "coder-${data.coder_workspace_owner.me.name}-${lower(data.coder_workspace.me.name)}"
# Hostname makes the shell more user friendly: coder@my-workspace:~$
hostname = data.coder_workspace.me.name
# Use the docker gateway if the access URL is 127.0.0.1
entrypoint = ["sh", "-c", replace(coder_agent.main.init_script, "/localhost|127\\.0\\.0\\.1/", "host.docker.internal")]
env = ["CODER_AGENT_TOKEN=${coder_agent.main.token}"]
host {
host = "host.docker.internal"
ip = "host-gateway"
}
# Add labels in Docker to keep track of orphan resources.
labels {
label = "coder.owner"
value = data.coder_workspace_owner.me.name
}
labels {
label = "coder.owner_id"
value = data.coder_workspace_owner.me.id
}
labels {
label = "coder.workspace_id"
value = data.coder_workspace.me.id
}
labels {
label = "coder.workspace_name"
value = data.coder_workspace.me.name
}
}
```

Expand Down
Loading
Loading