Skip to content

Files

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Latest commit

99410c6 · Nov 28, 2024

History

History
71 lines (57 loc) · 2.06 KB

index.md

File metadata and controls

71 lines (57 loc) · 2.06 KB
page_title subcategory description
Coder Provider
Infrastructure
Terraform provider for managing Coder templates, which are the underlying infrastructure for Coder workspaces.

Coder Provider

Terraform provider for managing Coder templates, which are the underlying infrastructure for Coder workspaces.

-> Requires Coder v2.18.0 or later.

!> coder_git_auth and owner related fields of coder_workspace data source have been removed. Follow the Version 2 Upgrade Guide to update your code.

Example

terraform {
  required_providers {
    coder = {
      source = "coder/coder"
    }
  }
}

provider "google" {
  region = "us-central1"
}

data "coder_workspace" "me" {}

resource "coder_agent" "dev" {
  arch = "amd64"
  os   = "linux"
  auth = "google-instance-identity"
}

data "google_compute_default_service_account" "default" {}

resource "google_compute_instance" "dev" {
  zone         = "us-central1-a"
  count        = data.coder_workspace.me.start_count
  name         = "coder-${data.coder_workspace.me.owner}-${data.coder_workspace.me.name}"
  machine_type = "e2-medium"
  network_interface {
    network = "default"
    access_config {
      // Ephemeral public IP
    }
  }
  boot_disk {
    initialize_params {
      image = "debian-cloud/debian-9"
    }
  }
  service_account {
    email  = data.google_compute_default_service_account.default.email
    scopes = ["cloud-platform"]
  }
  metadata_startup_script = coder_agent.dev.init_script
}

Schema

Optional

  • url (String) The URL to access Coder.