esp.terraform.tfe_workspace_info (0.1.0) — module

List workspaces in the organization

| "added in version" 0.1.0 of esp.terraform"

Authors: Krzysztof Lewandowski (@klewan)

Install collection

Install with ansible-galaxy collection install esp.terraform:==0.1.0


Add to requirements.yml

  collections:
    - name: esp.terraform
      version: 0.1.0

Description

Lists workspaces in the organization.

Workspaces represent running infrastructure managed by Terraform.

Details on a workspace can be retrieved either by its ID or by its name.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Retrieve details on all workspaces in the organization, include additional information about current run and outputs
  esp.terraform.tfe_workspace_info:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo
    workspace:
      - '*'
    include:
      - current_run
      - outputs
    validate_certs: no
  register: _result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Retrieve details on given workspaces (supplied by names or IDs), do not include any additional information
  esp.terraform.tfe_workspace_info:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo
    workspace:
      - ws-bLt17oSNcaiGtAuM
      - my_test_workspace
    validate_certs: no
  register: _result

Inputs

    
url:
    description:
    - Terraform Enterprise URL.
    required: false
    type: str

sleep:
    default: 5
    description:
    - Number of seconds to sleep between API retries.
    type: int

token:
    description:
    - All requests to Terraform Enterprise must be authenticated with a bearer token.
    - There are three kinds of token available, i.e. user tokens, team tokens and organization
      tokens.
    - See L(Authentication,https://www.terraform.io/docs/cloud/api/index.html#authentication).
    required: true
    type: str

include:
    description:
    - Return additional information about nested resources.
    - This can be any of organization, current_run, current_run.plan, current_run.configuration_version,
      current_run.configuration_version.ingress_attributes, readme, outputs.
    elements: str
    required: false
    type: list

retries:
    default: 3
    description:
    - Number of retries to call Terraform API URL before failure.
    type: int

use_proxy:
    default: true
    description:
    - If C(no), it will not use a proxy, even if one is defined in an environment variable
      on the target hosts.
    type: bool

workspace:
    default:
    - '*'
    description:
    - List of workspaces to retrieve details for.
    - This can be '*' which means all workspaces.
    - One may refer to a workspace either by its ID or its name.
    required: false
    type: list

organization:
    description:
    - Organization name.
    required: true
    type: str

validate_certs:
    default: true
    description:
    - If C(no), SSL certificates will not be validated.
    - This should only set to C(no) used on personally controlled sites using self-signed
      certificates.
    type: bool

Outputs

json:
  contains:
    data:
      description: Details on workspaces.
      elements: dict
      returned: success
      sample:
      - attributes:
          execution-mode: remote
          locked: false
          name: my_test_workspace
        id: ws-c4QU38B37cuh873N
        type: workspaces
      type: list
    included:
      description: Additional information about nested resources.
      elements: dict
      returned: success
      type: list
  description: Details on workspaces.
  returned: success
  type: dict
organization:
  description: Organization name or external-id.
  returned: always
  sample: foo
  type: str
workspace:
  description: List of workspaces to retrieve details for.
  elements: dict
  returned: always
  sample:
  - ws-bLt17oSNcaiGtAuM
  - my_test_workspace
  type: list