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

b5d15b4 · May 24, 2024

History

History
89 lines (68 loc) · 2.65 KB

metadata.md

File metadata and controls

89 lines (68 loc) · 2.65 KB
page_title subcategory description
coder_metadata Resource - terraform-provider-coder
Use this resource to attach metadata to a resource. They will be displayed in the Coder dashboard.

coder_metadata (Resource)

Use this resource to attach metadata to a resource. They will be displayed in the Coder dashboard.

Example Usage

data "coder_workspace" "me" {
}

resource "kubernetes_pod" "dev" {
  count = data.coder_workspace.me.start_count
  metadata {
    name      = "k8s_example"
    namespace = "example"
  }
  spec {
    # Draw the rest of the pod!
  }
}

resource "tls_private_key" "example_key_pair" {
  algorithm   = "ECDSA"
  ecdsa_curve = "P256"
}

resource "coder_metadata" "pod_info" {
  count       = data.coder_workspace.me.start_count
  resource_id = kubernetes_pod.dev[0].id
  # (Enterprise-only) this resource consumes 200 quota units
  daily_cost = 200
  item {
    key   = "description"
    value = "This description will show up in the Coder dashboard."
  }
  item {
    key   = "pod_uid"
    value = kubernetes_pod.dev[0].uid
  }
  item {
    key   = "public_key"
    value = tls_private_key.example_key_pair.public_key_openssh
    # The value of this item will be hidden from view by default
    sensitive = true
  }
}

Schema

Required

  • resource_id (String) The "id" property of another resource that metadata should be attached to.

Optional

  • daily_cost (Number) (Enterprise) The cost of this resource every 24 hours. Use the smallest denomination of your preferred currency. For example, if you work in USD, use cents.
  • hide (Boolean) Hide the resource from the UI.
  • icon (String) A URL to an icon that will display in the dashboard. View built-in icons here: https://github.com/coder/coder/tree/main/site/static/icon. Use a built-in icon with data.coder_workspace.me.access_url + "/icon/<path>".
  • item (Block List) Each "item" block defines a single metadata item consisting of a key/value pair. (see below for nested schema)

Read-Only

  • id (String) The ID of this resource.

Nested Schema for item

Required:

  • key (String) The key of this metadata item.

Optional:

  • sensitive (Boolean) Set to "true" to for items such as API keys whose values should be hidden from view by default. Note that this does not prevent metadata from being retrieved using the API, so it is not suitable for secrets that should not be exposed to workspace users.
  • value (String) The value of this metadata item.

Read-Only:

  • is_null (Boolean)