esp.terraform.tfe_organization_token (0.1.0) — module

Generate and delete the organization token

| "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

Generates a new organization token and deletes the existing token.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Generate a new organization token
  esp.terraform.tfe_organization_token:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo     
    state: present
    validate_certs: no
  register: _result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- debug:
    msg: "{{ _result.json.data.attributes.token }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete the organization token
  esp.terraform.tfe_organization_token:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo     
    state: absent
    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

state:
    choices:
    - absent
    - present
    default: present
    description:
    - Whether the organization token should exist or not.
    required: true
    type: str

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

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

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 organization token.
      returned: success
      sample:
        attributes:
          created-at: '2021-04-24T12:23:20.599000+00:00'
          description: null
          last-used-at: null
          token: JoeB4qz0...41xPxDaGE
        id: at-rattfRkKfzhGkaAe
        relationships:
          created-by:
            data:
              id: user-K1LWGyjmnDL59y4H
              type: users
        type: authentication-tokens
      type: dict
  description: Details on organization token.
  returned: success
  type: dict
state:
  description: Organization token state
  returned: always
  sample: present
  type: str