spotlight_workspace

The spotlight_workspace resource, and the workspace resource of the API: the top-level account, which has teams, members and their roles, the GitHub connection, secrets, runners and workspace tokens.

KindEndpointTerraformAddress
workspace/api/v1/resources/workspacesspotlight_workspace<slug>

See Resource API for the operations, headers and errors every kind shares.

Example

import {
  to = spotlight_workspace.acme
  id = "acme"
}

resource "spotlight_workspace" "acme" {
  name = "Acme"
  slug = "acme"

  outbound_hosts = ["api.example.com", "*.acme.io"]
}

Fields

FieldTypeDefaultDescription
namestringrequiredWhat the workspace is called. 1 to 100 characters.
slugstringrequiredThe workspace's address in URLs, as in /w/acme. Lowercase letters and digits, with single dashes between them, at most 48 characters, written exactly as it is kept. Immutable: an update that changes it is rejected; Terraform replaces the resource.
outboundHostsarray of strings[]The hosts that Spotlight may call for the workspace's configuration. Empty adds no limit to the deployment's list. See Outbound hosts. In Terraform, outbound_hosts.

Rules

OperationRule
createNeeds create-workspaces: any signed-in person, never a workspace token. The creator becomes the workspace's owner.
updateNeeds configure. Changes name and outboundHosts. An update that changes neither keeps the version.
deleteNeeds administer. Fails with 409 in-use while the workspace has any team, workspace token, OIDC trust, secret, runner pool, runner trust or workspace runners.
listEvery workspace the caller may read. A workspace token reads only its own.
importGET /api/v1/resources/workspaces/import?address=<slug>

An in-use error names what is left, as in Workspace acme is not empty. It still has: team core. A deleted workspace grants nothing to anyone. See Roles and permissions for who has each permission.

Outbound hosts

An entry is a host, such as api.example.com, or a pattern, such as *.example.com. A pattern allows each subdomain of the domain: *.example.com allows api.example.com, not example.com. An entry has no scheme, port or path. Spotlight keeps each entry once, in lowercase, without a dot at the end, and keeps and returns the entries sorted.

When the list is not empty, Spotlight calls for this workspace only the hosts that the list allows and the deployment allows. The calls it applies to, and how it combines with the deployment's list, are in Workspace lists. A change can take up to 30 seconds to apply to calls.

An entry that is not a host or a pattern is rejected with 422 invalid, with an error at outboundHosts[<index>]:

MessageCause
is empty. Write a host such as api.example.comThe entry is empty or only spaces.
permits every host. Leave the list empty to permit every public hostThe entry is *.
is not a pattern such as *.example.comThe entry starts with *., and the rest has a * or has no ., as in *.com.
is not a host such as api.example.com or a pattern such as *.example.comThe entry has a *, /, : or space.
has a character a host name cannot have. Write an internationalised host in its xn-- formThe entry has a character other than a letter a to z, a digit, ., -, _ or *.

A value that is not a list is rejected with an error at outboundHosts: lists the hosts the workspace may call, as in ["api.example.com", "*.example.com"].

In Terraform

  • spotlight_workspace cannot be created by Terraform. The create is forbidden with 403, and the provider says to import the workspace by its slug. Destroying it deletes the workspace, under the rules above.
  • The data source spotlight_workspace reads a workspace without managing it. See Provider.
  • The Terraform export writes outbound_hosts only when the list is not empty.

A workspace created in the web app

The web app's form requests a workspace name, a workspace URL (the slug) and a team name. It creates, in one step:

  • the workspace, with the person as its owner;
  • its first team, with the given name and a key made from it: lowercased, each run of other characters turned into one dash, cut to 64 characters, with no dash at either end;
  • the Delivery and Review lines on that team, as listed in Built-in lines;
  • a task titled Set up your team at Delivery's backlog, assigned to the owner.

A workspace created through the resource API has no team. See spotlight_team for teams.

On this page