-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into matifali/migration-guide
- Loading branch information
Showing
45 changed files
with
667 additions
and
837 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,46 @@ | ||
data "coder_workspace" "dev" { | ||
provider "coder" {} | ||
|
||
provider "docker" {} | ||
|
||
data "coder_workspace" "me" {} | ||
|
||
data "coder_workspace_owner" "me" {} | ||
|
||
resource "coder_agent" "dev" { | ||
arch = "amd64" | ||
os = "linux" | ||
dir = "/workspace" | ||
} | ||
|
||
resource "kubernetes_pod" "dev" { | ||
count = data.coder_workspace.dev.transition == "start" ? 1 : 0 | ||
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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.