esp.terraform.tfe_state_version_info (0.1.0) — module

List State Versions for a Workspace

| "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 State Versions for a Workspace.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: List all State Versions for a Workspace
  esp.terraform.tfe_state_version_info:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo
    workspace: bar
    state_version:
      - '*'
    validate_certs: no
  register: _result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Fetch the Current State Version for a Workspace, include outputs
  esp.terraform.tfe_state_version_info:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo
    workspace: bar
    state_version:
      - current-state-version
    include:
      - outputs
    validate_certs: no
  register: _result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: List State Versions for a Workspace (state versions supplied by IDs), include outputs
  esp.terraform.tfe_state_version_info:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo
    workspace: ws-bLt17oSNcaiGtAuM
    state_version:
      - sv-4mXRs55FUQVWV4eG
      - sv-rGAoW3w4zYhQxWtW
    include:
      - outputs      
    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 only C(outputs) as of now.
    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:
    description:
    - The Workspace name or ID to list State Versions for.
    required: true
    type: str

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

state_version:
    default:
    - '*'
    description:
    - List of State Versions to retrieve details for (supplied by state version IDs).
    - This can be '*' which means all State Versions.
    - C(current-state-version) means fetch the Current State Version for the Workspace.
    required: false
    type: list

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 state versions.
      elements: dict
      returned: success
      sample:
      - attributes:
          created-at: '2021-04-19T11:49:36.271000+00:00'
          hosted-state-download-url: https://terraform.example.com/_archivist/v1/object/dm...
          modules:
            root.ec2:
              aws-instance: 1
          providers:
            provider[\registry.terraform.io/hashicorp/aws\]:
              aws-instance: 1
          resources:
          - count: 1
            module: root.ec2
            name: this
            provider: provider[\registry.terraform.io/hashicorp/aws\]
            type: aws_instance
          serial: 0
          size: 1563
          state-version: 4
          terraform-version: 0.13.6
          vcs-commit-sha: e136364b2c11678e18cbc57e3ab11d3e832a6afa
          vcs-commit-url: https://bitbucket.example.com/projects/BAZ/repos/qux/commits/e136364b2c11678e18cbc57e3ab11d3e832a6afa
        id: sv-RiiBKNQXSvG83YWB
        links:
          self: /api/v2/state-versions/sv-RiiBKNQXSvG83YWB
        relationships:
          created-by:
            data:
              id: user-xNvjG1FhNtYb3RfA
              type: users
            links:
              related: /api/v2/runs/sv-RiiBKNQXSvG83YWB/created-by
          outputs:
            data:
            - id: wsout-yYP8gVfCFhBKoK7m
              type: state-version-outputs
            - id: wsout-Ve2aH5dZBCknfFjU
              type: state-version-outputs
          run:
            data:
              id: run-H5LEQGwanGc4YQJN
              type: runs
        type: state-versions
      type: list
  description: Details on state versions.
  returned: success
  type: dict