tfe_workspace

Provides a workspace resource.

Example Usage

Basic usage:

resource "tfe_organization" "test-organization" {
  name  = "my-org-name"
  email = "admin@company.com"
}

resource "tfe_workspace" "test" {
  name         = "my-workspace-name"
  organization = tfe_organization.test-organization.name
  tag_names    = ["test", "app"]
}

Usage with vcs_repo:

resource "tfe_organization" "test-organization" {
  name  = "my-org-name"
  email = "admin@company.com"
}

resource "tfe_oauth_client" "test" {
  organization     = tfe_organization.test-organization
  api_url          = "https://api.github.com"
  http_url         = "https://github.com"
  oauth_token      = "oauth_token_id"
  service_provider = "github"
}

resource "tfe_workspace" "parent" {
  name                 = "parent-ws"
  organization         = tfe_organization.test-organization
  queue_all_runs       = false
  vcs_repo {
    branch             = "main"
    identifier         = "my-org-name/vcs-repository"
    oauth_token_id     = tfe_oauth_client.test.oauth_token_id
  }
}

Argument Reference

The following arguments are supported:

The vcs_repo block supports:

Attributes Reference

In addition to all arguments above, the following attributes are exported:

Import

Workspaces can be imported; use <WORKSPACE ID> or <ORGANIZATION NAME>/<WORKSPACE NAME> as the import ID. For example:

terraform import tfe_workspace.test ws-CH5in3chf8RJjrVd
terraform import tfe_workspace.test my-org-name/my-wkspace-name