esp.terraform.tfe_workspace_var_info (0.1.0) — module

List workspace variables

| "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 workspace variables.

Details on a variable can be retrieved either by its ID or by its name (key).

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Retrieve details on all variables for the supplied workspace
  esp.terraform.tfe_workspace_var_info:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo
    workspace: bar
    variable:
      - '*'
    validate_certs: no
  register: _result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: List workspace variables (supplied by names/keys and IDs)
  esp.terraform.tfe_workspace_var_info:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo
    workspace: ws-bLt17oSNcaiGtAuM
    variable:
      - var-sCmHmHGSTYCp38sY
      - AWS_SECRET_ACCESS_KEY
    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

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

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

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:
    description:
    - The Workspace name or ID to list variables for.
    required: true
    type: str

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 variables.
      elements: dict
      returned: success
      sample:
      - attributes:
          category: env
          created-at: '2021-04-19T11:39:47.136000+00:00'
          description: null
          hcl: false
          key: AWS_SECRET_ACCESS_KEY
          sensitive: true
          value: null
        id: var-SUaLuzd4azmLbB53
        links:
          self: /api/v2/workspaces/ws-bLt17oSNcaiGtAuM/vars/var-SUaLuzd4azmLbB53
        relationships:
          configurable:
            data:
              id: ws-bLt17oSNcaiGtAuM
              type: workspaces
            links:
              related: /api/v2/organizations/foo/workspaces/bar
        type: vars
      type: list
  description: Details on variables.
  returned: success
  type: dict