Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: allow for different docker socket path in docker-based templates (#15035) #15049

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

Merged
merged 1 commit into from
Oct 12, 2024
Merged
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
12 changes: 11 additions & 1 deletion examples/templates/devcontainer-docker/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,19 @@ terraform {
}
}

variable "docker_socket" {
default = ""
description = "(Optional) Docker socket URI"
type = string
}

provider "coder" {}
provider "docker" {}
provider "docker" {
# Defaulting to null if the variable is an empty string lets us have an optional variable without having to set our own default
host = var.docker_socket != "" ? var.docker_socket : null
}
provider "envbuilder" {}

data "coder_provisioner" "me" {}
data "coder_workspace" "me" {}
data "coder_workspace_owner" "me" {}
Expand Down
11 changes: 8 additions & 3 deletions examples/templates/docker/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,19 @@ locals {
username = data.coder_workspace_owner.me.name
}

data "coder_provisioner" "me" {
variable "docker_socket" {
default = ""
description = "(Optional) Docker socket URI"
type = string
}

provider "docker" {
# Defaulting to null if the variable is an empty string lets us have an optional variable without having to set our own default
host = var.docker_socket != "" ? var.docker_socket : null
}

data "coder_workspace" "me" {
}
data "coder_provisioner" "me" {}
data "coder_workspace" "me" {}
data "coder_workspace_owner" "me" {}

resource "coder_agent" "main" {
Expand Down
Loading