esp.terraform.tfe_remote_state_consumers (0.1.0) — module

Add, delete, or replace one or more remote state consumers from 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

Adds, deletes, or replaces one or more remote state consumers from a workspace.

A workspace may be referred either by its id or its name.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add remote state consumers to a workspace
  esp.terraform.tfe_remote_state_consumers:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo
    workspace: my-workspace
    remote_state_consumer:
      - '*'   
    action: add
    validate_certs: no
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Update the workspace's remote state consumers to be exactly the list of remote_state_consumer specified
  esp.terraform.tfe_remote_state_consumers:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo
    workspace: my-workspace
    remote_state_consumer:
      - ws-bLt17oSNcaiGtAuM
      - my-workspace-2    
    action: replace
    validate_certs: no
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove remote state consumers from a workspace
  esp.terraform.tfe_remote_state_consumers:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo
    workspace: my-workspace
    remote_state_consumer:
      - my-workspace-2  
    action: delete
    validate_certs: no

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

action:
    choices:
    - add
    - delete
    - replace
    default: add
    description:
    - When C(add), it adds one or more remote state consumers to the workspace, according
      to the contents of C(remote_state_consumers) parameter.
    - You can safely add a consumer workspace that is already present; it will be ignored,
      and the rest of the consumers in the request will be processed normally.
    - When C(delete), it removes one or more remote state consumers from a workspace,
      according to the contents of C(remote_state_consumers) parameter.
    - When C(replace), it updates the workspace's remote state consumers to be exactly
      the list of workspaces specified in C(remote_state_consumers).
    required: true
    type: str

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:
    - A Workspace to add/delete/replace remote state consumers to.
    - One may refer to a workspace either by its ID or its name.
    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

remote_state_consumer:
    default:
    - '*'
    description:
    - List of workspaces to add/delete/replace as Remote State Consumers to C(workspace).
    - This can be '*' which means all workspaces in the organization.
    - One may refer to a workspace either by its ID or its name.
    required: false
    type: list

Outputs

organization:
  description: Organization name or external-id.
  returned: always
  sample: foo
  type: str
remote_state_consumers:
  description: List of workspaces to add/delete/replace as Remote State Consumer
  elements: dict
  returned: always
  sample:
  - ws-bLt17oSNcaiGtAuM
  - my-workspace-2
  type: list
workspace:
  description: A Workspace to add/delete/replace remote state consumers to.
  returned: always
  sample: my-workspace
  type: str