Workspaces

class terrasnek.workspaces.TFCWorkspaces(instance_url, org_name, headers, well_known_paths, verify, log_level)

Workspaces API Docs

add_remote_state_consumers(workspace_id, payload)

POST /workspaces/:workspace_id/relationships/remote-state-consumers

Add Remote State Consumers API Doc Reference

Add Remote State Consumers Sample Payload

add_tags(workspace_id, payload)

POST /workspaces/:workspace_id/relationships/tags

Add Tags to a Workspace API Doc Reference

Add Tags to a Workspace API Doc Sample Payload

assign_ssh_key(workspace_id, payload)

PATCH /workspaces/:workspace_id/relationships/ssh-key

Workspaces Assign SSH Key API Doc Reference

Assign Sample Payload

create(payload)

POST /organizations/:organization_name/workspaces

Workspaces Create API Doc Reference

Create Sample Payload

delete_remote_state_consumers(workspace_id, payload)

DELETE /workspaces/:workspace_id/relationships/remote-state-consumers

Delete Remote State Consumers API Doc Reference

Delete Remote State Consumers Sample Payload

destroy(workspace_id=None, workspace_name=None)

DELETE /organizations/:organization_name/workspaces/:name DELETE /workspaces/:workspace_id

Workspaces Destroy API Doc Reference

force_unlock(workspace_id)

POST /workspaces/:workspace_id/actions/force-unlock

Workspaces Force Unlock API Doc Reference

get_remote_state_consumers(workspace_id, page=None, page_size=None)

GET /workspaces/:workspace_id/relationships/remote-state-consumers

Get Remote State Consumers API Doc Reference

Query Parameter(s) Details

list(page=None, page_size=None, include=None, search=None, filters=None)

GET /organizations/:organization_name/workspaces

Workspaces List API Doc Reference

Query Parameter(s) Details

list_all(search=None, include=None, filters=None)

This function does not correlate to an endpoint in the TFC API Docs specifically, but rather is a helper function to wrap the list endpoint, which enumerates out every page so users do not have to implement the paging logic every time they just want to list every workspace in an organization.

Returns an object with two arrays of objects.

list_all_resources(workspace_id)

This function does not correlate to an endpoint in the TFC API Docs specifically, but rather is a helper function to wrap the list endpoint, which enumerates out every page so users do not have to implement the paging logic every time they just want to list every workspace in an organization.

Returns an object with two arrays of objects.

list_all_tags(workspace_id)

This function does not correlate to an endpoint in the TFC API Docs specifically, but rather is a helper function to wrap the list endpoint, which enumerates out every page so users do not have to implement the paging logic every time they just want to list every workspace in an organization.

Returns an object with two arrays of objects.

list_resources(workspace_id, page=None, page_size=None)

GET /workspaces/:workspace_id/resources

Get Workspace Resources API Doc Reference

Query Parameter(s) Details

list_tags(workspace_id, page=None, page_size=None)

GET /workspaces/:workspace_id/relationships/tags

Get Tags API Doc Reference

Query Parameter(s) Details

lock(workspace_id, payload)

POST /workspaces/:workspace_id/actions/lock

Workspaces Lock API Doc Reference

Lock Sample Payload

remove_tags(workspace_id, payload)

DELETE /workspaces/:workspace_id/relationships/tags

Remove Tags from a Workspace API Doc Reference

Remove Tags from a Workspace API Doc Sample Payload

replace_remote_state_consumers(workspace_id, payload)

PATCH /workspaces/:workspace_id/relationships/remote-state-consumers

Replace Remote State Consumers API Doc Reference

Replace Remote State Consumers Sample Payload

required_entitlements()

Terraform Cloud Entitlements required for endpoint to work.

safe_destroy(workspace_id=None, workspace_name=None)

POST /workspaces/:workspace_id/actions/safe-delete DELETE /organizations/:organization_name/workspaces/:name/actions/safe-delete

TODO / NOTE: the above DELETE should really be a POST, the docs don’t match reality, so need to leave it as DELETE for now since our API comparison script relies on those strings.

Workspaces Safe Destroy API Doc Reference

show(workspace_name=None, workspace_id=None, include=None)

GET /organizations/:organization_name/workspaces/:name GET /workspaces/:workspace_id

Workspaces Show API Doc Reference

terraform_cloud_only()

Return True if this endpoint is only for Terraform Cloud, else False.

terraform_enterprise_only()

Return True if this endpoint is only for Terraform Enterprise, else False.

unassign_ssh_key(workspace_id, payload)

PATCH /workspaces/:workspace_id/relationships/ssh-key

Workspaces Unassign SSH Key API Doc Reference

Unassign Sample Payload

unlock(workspace_id)

POST /workspaces/:workspace_id/actions/unlock

Workspaces Unlock API Doc Reference

update(payload, workspace_name=None, workspace_id=None)

PATCH /organizations/:organization_name/workspaces/:name PATCH /workspaces/:workspace_id

Workspaces Update API Doc Reference

Update Sample Payload