Terraform · Capability

HCP Terraform API — Workspaces

HCP Terraform API — Workspaces. 7 operations. Lead operation: List Workspaces. Self-contained Naftiko capability covering one Terraform business surface.

Run with Naftiko TerraformWorkspaces

What You Can Do

GET
Listworkspaces — List Workspaces
/v1/organizations/{organization-name}/workspaces
POST
Createworkspace — Create a Workspace
/v1/organizations/{organization-name}/workspaces
GET
Getworkspace — Get a Workspace
/v1/workspaces/{workspace-id}
PATCH
Updateworkspace — Update a Workspace
/v1/workspaces/{workspace-id}
DELETE
Deleteworkspace — Delete a Workspace
/v1/workspaces/{workspace-id}
POST
Lockworkspace — Lock a Workspace
/v1/workspaces/{workspace-id}/actions/lock
POST
Unlockworkspace — Unlock a Workspace
/v1/workspaces/{workspace-id}/actions/unlock

MCP Tools

list-workspaces

List Workspaces

read-only idempotent
create-workspace

Create a Workspace

get-workspace

Get a Workspace

read-only idempotent
update-workspace

Update a Workspace

idempotent
delete-workspace

Delete a Workspace

idempotent
lock-workspace

Lock a Workspace

unlock-workspace

Unlock a Workspace

Capability Spec

hcp-terraform-workspaces.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: HCP Terraform API — Workspaces
  description: 'HCP Terraform API — Workspaces. 7 operations. Lead operation: List Workspaces. Self-contained Naftiko capability
    covering one Terraform business surface.'
  tags:
  - Terraform
  - Workspaces
  created: '2026-05-19'
  modified: '2026-05-19'
binds:
- namespace: env
  keys:
    TERRAFORM_API_KEY: TERRAFORM_API_KEY
capability:
  consumes:
  - type: http
    namespace: hcp-terraform-workspaces
    baseUri: https://app.terraform.io/api/v2
    description: HCP Terraform API — Workspaces business capability. Self-contained, no shared references.
    resources:
    - name: organizations-organization_name-workspaces
      path: /organizations/{organization_name}/workspaces
      operations:
      - name: listworkspaces
        method: GET
        description: List Workspaces
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: organization_name
          in: path
          type: string
          required: true
        - name: page[number]
          in: query
          type: integer
        - name: page[size]
          in: query
          type: integer
        - name: search[name]
          in: query
          type: string
          description: Filter workspaces by name
        - name: search[tags]
          in: query
          type: string
          description: Filter workspaces by tags
        - name: filter[project][id]
          in: query
          type: string
          description: Filter workspaces by project ID
      - name: createworkspace
        method: POST
        description: Create a Workspace
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: organization_name
          in: path
          type: string
          required: true
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
    - name: workspaces-workspace_id
      path: /workspaces/{workspace_id}
      operations:
      - name: getworkspace
        method: GET
        description: Get a Workspace
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: workspace_id
          in: path
          type: string
          required: true
      - name: updateworkspace
        method: PATCH
        description: Update a Workspace
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: workspace_id
          in: path
          type: string
          required: true
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
      - name: deleteworkspace
        method: DELETE
        description: Delete a Workspace
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: workspace_id
          in: path
          type: string
          required: true
    - name: workspaces-workspace_id-actions-lock
      path: /workspaces/{workspace_id}/actions/lock
      operations:
      - name: lockworkspace
        method: POST
        description: Lock a Workspace
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: workspace_id
          in: path
          type: string
          required: true
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
    - name: workspaces-workspace_id-actions-unlock
      path: /workspaces/{workspace_id}/actions/unlock
      operations:
      - name: unlockworkspace
        method: POST
        description: Unlock a Workspace
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: workspace_id
          in: path
          type: string
          required: true
    authentication:
      type: bearer
      token: '{{env.TERRAFORM_API_KEY}}'
  exposes:
  - type: rest
    namespace: hcp-terraform-workspaces-rest
    port: 8080
    description: REST adapter for HCP Terraform API — Workspaces. One Spectral-compliant resource per consumed operation,
      prefixed with /v1.
    resources:
    - path: /v1/organizations/{organization-name}/workspaces
      name: organizations-organization-name-workspaces
      description: REST surface for organizations-organization_name-workspaces.
      operations:
      - method: GET
        name: listworkspaces
        description: List Workspaces
        call: hcp-terraform-workspaces.listworkspaces
        with:
          organization_name: rest.organization_name
          page[number]: rest.page[number]
          page[size]: rest.page[size]
          search[name]: rest.search[name]
          search[tags]: rest.search[tags]
          filter[project][id]: rest.filter[project][id]
        outputParameters:
        - type: object
          mapping: $.
      - method: POST
        name: createworkspace
        description: Create a Workspace
        call: hcp-terraform-workspaces.createworkspace
        with:
          organization_name: rest.organization_name
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/workspaces/{workspace-id}
      name: workspaces-workspace-id
      description: REST surface for workspaces-workspace_id.
      operations:
      - method: GET
        name: getworkspace
        description: Get a Workspace
        call: hcp-terraform-workspaces.getworkspace
        with:
          workspace_id: rest.workspace_id
        outputParameters:
        - type: object
          mapping: $.
      - method: PATCH
        name: updateworkspace
        description: Update a Workspace
        call: hcp-terraform-workspaces.updateworkspace
        with:
          workspace_id: rest.workspace_id
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
      - method: DELETE
        name: deleteworkspace
        description: Delete a Workspace
        call: hcp-terraform-workspaces.deleteworkspace
        with:
          workspace_id: rest.workspace_id
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/workspaces/{workspace-id}/actions/lock
      name: workspaces-workspace-id-actions-lock
      description: REST surface for workspaces-workspace_id-actions-lock.
      operations:
      - method: POST
        name: lockworkspace
        description: Lock a Workspace
        call: hcp-terraform-workspaces.lockworkspace
        with:
          workspace_id: rest.workspace_id
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/workspaces/{workspace-id}/actions/unlock
      name: workspaces-workspace-id-actions-unlock
      description: REST surface for workspaces-workspace_id-actions-unlock.
      operations:
      - method: POST
        name: unlockworkspace
        description: Unlock a Workspace
        call: hcp-terraform-workspaces.unlockworkspace
        with:
          workspace_id: rest.workspace_id
        outputParameters:
        - type: object
          mapping: $.
  - type: mcp
    namespace: hcp-terraform-workspaces-mcp
    port: 9090
    transport: http
    description: MCP adapter for HCP Terraform API — Workspaces. One tool per consumed operation, routed inline through this
      capability's consumes block.
    tools:
    - name: list-workspaces
      description: List Workspaces
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: hcp-terraform-workspaces.listworkspaces
      with:
        organization_name: tools.organization_name
        page[number]: tools.page[number]
        page[size]: tools.page[size]
        search[name]: tools.search[name]
        search[tags]: tools.search[tags]
        filter[project][id]: tools.filter[project][id]
      outputParameters:
      - type: object
        mapping: $.
    - name: create-workspace
      description: Create a Workspace
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: hcp-terraform-workspaces.createworkspace
      with:
        organization_name: tools.organization_name
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: get-workspace
      description: Get a Workspace
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: hcp-terraform-workspaces.getworkspace
      with:
        workspace_id: tools.workspace_id
      outputParameters:
      - type: object
        mapping: $.
    - name: update-workspace
      description: Update a Workspace
      hints:
        readOnly: false
        destructive: false
        idempotent: true
      call: hcp-terraform-workspaces.updateworkspace
      with:
        workspace_id: tools.workspace_id
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: delete-workspace
      description: Delete a Workspace
      hints:
        readOnly: false
        destructive: true
        idempotent: true
      call: hcp-terraform-workspaces.deleteworkspace
      with:
        workspace_id: tools.workspace_id
      outputParameters:
      - type: object
        mapping: $.
    - name: lock-workspace
      description: Lock a Workspace
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: hcp-terraform-workspaces.lockworkspace
      with:
        workspace_id: tools.workspace_id
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: unlock-workspace
      description: Unlock a Workspace
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: hcp-terraform-workspaces.unlockworkspace
      with:
        workspace_id: tools.workspace_id
      outputParameters:
      - type: object
        mapping: $.