esp.terraform.tfe_user_token (0.1.0) — module

Manage VCS tokens

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

Updates or removes a VCS tokens.

The OAuth Token object represents a VCS configuration which includes the OAuth connection and the associated OAuth token.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a User Token
  esp.terraform.tfe_user_token:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    attributes:
      description: API
    state: present
    validate_certs: no
  register: _result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Display the token
  debug:
    msg: "{{ _result.json.data.attributes.token }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Destroy a User Token
  esp.terraform.tfe_user_token:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    user_token: at-QmATJea6aWj1xR2t
    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 user 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

attributes:
    description:
    - Definition of the attributes for user token.
    - Required when C(state=present).
    suboptions:
      description:
        description:
        - The description for the User Token
        required: false
        type: str
    type: dict

user_token:
    description:
    - User token ID to remove.
    - Required when C(state=absent).
    required: false
    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 user token.
      returned: success
      sample:
        attributes:
          created-at: '2021-04-26T07:53:37.328000+00:00'
          description: API
          last-used-at: null
          token: bayN9KGosVRBlw.atlasv1.rVh8hWQ7kiiFNP6FVeAhWocHVKQhPiUcsQ7yDLYMuYijUPIjxGmybbYCnUX88oguXYA
        id: at-mvnJnf6cpbcjRbvd
        relationships:
          created-by:
            data:
              id: user-K1LWGyjmnDL59y4H
              type: users
        type: authentication-tokens
      type: dict
  description: Details on user token.
  returned: success
  type: dict