diff --git a/examples/templates/bare/README.md b/examples/templates/bare/README.md new file mode 100644 index 0000000000000..fff556b7e0a2e --- /dev/null +++ b/examples/templates/bare/README.md @@ -0,0 +1,7 @@ +--- +name: Bare (custom template) +description: Use this template as a starting point for writing custom templates with Terraform +tags: [bare] +--- + +See diff --git a/examples/templates/bare/main.tf b/examples/templates/bare/main.tf new file mode 100644 index 0000000000000..98619f38ee293 --- /dev/null +++ b/examples/templates/bare/main.tf @@ -0,0 +1,50 @@ +terraform { + required_providers { + coder = { + source = "coder/coder" + } + } +} + +# This example does not provision any resources. Use this +# template as a starting point for writing custom templates +# using any Terraform resource/provider. +# +# See: https://coder.com/docs/coder-oss/latest/templates + +data "coder_workspace" "me" { +} + +resource "coder_agent" "dev1" { + os = "linux" + arch = "amd64" + auth = "token" +} + +resource "null_resource" "fake-compute" { + # When a workspace is stopped, this resource is destroyed. + count = data.coder_workspace.me.transition == "start" ? 1 : 0 + + provisioner "local-exec" { + command = "echo 🔊 ${data.coder_workspace.me.owner} has started a workspace named ${data.coder_workspace.me.name}" + } + + # Run the Coder agent init script on resources + # to access web apps and SSH: + # + # export CODER_AGENT_TOKEN=${coder_agent.dev1.token} + # ${coder_agent.dev1.init_script} +} + +resource "null_resource" "fake-disk" { + # This resource will remain even when workspaces are restarted. + count = 1 +} + +resource "coder_app" "fake-app" { + # Access :8080 in the workspace from the Coder dashboard. + name = "VS Code" + icon = "/icon/code.svg" + agent_id = "fake-compute" + url = "http://localhost:8080" +} pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy