- Notifications
You must be signed in to change notification settings - Fork22
docs: add missing code examples#249
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
9 commits Select commitHold shift + click to select a range
b4ff7ce
coder_env code example
stirby821bfec
added coder_script example
stirbydb3bfe0
updated coder_script description to note parallelism
stirbya6be242
short coder_external_auth example
stirby031b5d0
added external auth link, make gen
stirbya3befe9
fixed icon link for coder_parameter
stirby4901de5
coder_provisioner example
stirbybc12d48
fixed inline links for provisioner
stirby4de7aeb
added coder_workspace_owner examples
stirbyFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
18 changes: 16 additions & 2 deletionsdocs/data-sources/external_auth.md
This file contains hidden or 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
2 changes: 1 addition & 1 deletiondocs/data-sources/parameter.md
This file contains hidden or 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
24 changes: 22 additions & 2 deletionsdocs/data-sources/provisioner.md
This file contains hidden or 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
31 changes: 31 additions & 0 deletionsdocs/data-sources/workspace_owner.md
This file contains hidden or 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
24 changes: 23 additions & 1 deletiondocs/resources/env.md
This file contains hidden or 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
59 changes: 57 additions & 2 deletionsdocs/resources/script.md
This file contains hidden or 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
11 changes: 11 additions & 0 deletionsexamples/data-sources/coder_external_auth/data-source.tf
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
provider "coder" {} | ||
data "coder_external_auth" "github" { | ||
id = "github" | ||
} | ||
data "coder_external_auth" "azure-identity" { | ||
id = "azure-identiy" | ||
optional = true | ||
} |
17 changes: 17 additions & 0 deletionsexamples/data-sources/coder_provisioner/data-source.tf
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
provider "coder" {} | ||
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 | ||
} | ||
} |
28 changes: 28 additions & 0 deletionsexamples/data-sources/coder_workspace_owner/data-source.tf
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
provider "coder" {} | ||
data "coder_workspace" "me" {} | ||
data "coder_workspace_owner" "me" {} | ||
resource "coder_agent" "dev" { | ||
arch = "amd64" | ||
os = "linux" | ||
dir = local.repo_dir | ||
env = { | ||
OIDC_TOKEN : data.coder_workspace_owner.me.oidc_access_token, | ||
} | ||
} | ||
# Add git credentials from coder_workspace_owner | ||
resource "coder_env" "git_author_name" { | ||
agent_id = coder_agent.agent_id | ||
name = "GIT_AUTHOR_NAME" | ||
value = coalesce(data.coder_workspace_owner.me.full_name, data.coder_workspace_owner.me.name) | ||
} | ||
resource "coder_env" "git_author_email" { | ||
agent_id = var.agent_id | ||
name = "GIT_AUTHOR_EMAIL" | ||
value = data.coder_workspace_owner.me.email | ||
count = data.coder_workspace_owner.me.email != "" ? 1 : 0 | ||
} |
19 changes: 19 additions & 0 deletionsexamples/resources/coder_env/resource.tf
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
data "coder_workspace" "me" {} | ||
resource "coder_agent" "dev" { | ||
os = "linux" | ||
arch = "amd64" | ||
dir = "/workspace" | ||
} | ||
resource "coder_env" "welcome_message" { | ||
agent_id = coder_agent.dev.id | ||
name = "WELCOME_MESSAGE" | ||
value = "Welcome to your Coder workspace!" | ||
} | ||
resource "coder_env" "internal_api_url" { | ||
agent_id = coder_agent.dev.id | ||
name = "INTERNAL_API_URL" | ||
value = "https://api.internal.company.com/v1" | ||
} |
52 changes: 52 additions & 0 deletionsexamples/resources/coder_script/resource.tf
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
data "coder_workspace" "me" {} | ||
resource "coder_agent" "dev" { | ||
os = "linux" | ||
arch = "amd64" | ||
dir = "/workspace" | ||
} | ||
resource "coder_script" "dotfiles" { | ||
agent_id = coder_agent.dev.agent_id | ||
display_name = "Dotfiles" | ||
icon = "/icon/dotfiles.svg" | ||
run_on_start = true | ||
script = templatefile("~/get_dotfiles.sh", { | ||
DOTFILES_URI : var.dotfiles_uri, | ||
DOTFILES_USER : var.dotfiles_user | ||
}) | ||
} | ||
resource "coder_script" "code-server" { | ||
agent_id = coder_agent.dev.agent_id | ||
display_name = "code-server" | ||
icon = "/icon/code.svg" | ||
run_on_start = true | ||
start_blocks_login = true | ||
script = templatefile("./install-code-server.sh", { | ||
LOG_PATH : "/tmp/code-server.log" | ||
}) | ||
} | ||
resource "coder_script" "nightly_sleep_reminder" { | ||
agent_id = coder_agent.dev.agent_id | ||
display_name = "Nightly update" | ||
icon = "/icon/database.svg" | ||
cron = "0 22 * * *" | ||
script = <<EOF | ||
#!/bin/sh | ||
echo "Running nightly update" | ||
sudo apt-get install | ||
EOF | ||
} | ||
resource "coder_script" "shutdown" { | ||
agent_id = coder_agent.dev.id | ||
display_name = "Stop daemon server" | ||
run_on_stop = true | ||
icon = "/icons/memory.svg" | ||
script = <<EOF | ||
#!/bin/sh | ||
kill $(lsof -i :3002 -t) >/tmp/pid.log 2>&1 & | ||
EOF | ||
} |
2 changes: 1 addition & 1 deletionprovider/externalauth.go
This file contains hidden or 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
2 changes: 1 addition & 1 deletionprovider/parameter.go
This file contains hidden or 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
4 changes: 2 additions & 2 deletionsprovider/provisioner.go
This file contains hidden or 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
2 changes: 1 addition & 1 deletionprovider/script.go
This file contains hidden or 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.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.