esp.terraform.tfe_vcs_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: Update a VCS token, add or replace ssh private key
  esp.terraform.tfe_vcs_token:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo
    oauth_token: ot-DxHXyuZUBxZN9g9G
    attributes:
      "ssh-key": "{{ lookup('file', '~/ssh/private.key') }}"
    state: present
    validate_certs: no
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove a VCS token
  esp.terraform.tfe_vcs_token:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo    
    oauth_token: ot-DxHXyuZUBxZN9g9G
    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 OAuth client (VCS connection) 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 VCS token.
    - Required when C(state=present).
    suboptions:
      ssh-key:
        description:
        - Private SSH key to associate with VCS token.
        required: false
        type: str
    type: dict

oauth_token:
    description:
    - OAuth token (VCS token) ID to update or remove.
    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 OAuth Clients.
      returned: success
      sample:
        attributes:
          created-at: '2021-04-22T19:51:24.395Z'
          has-ssh-key: true
          service-provider-user: null
        id: ot-DxHXyuZUBxZN9g9G
        relationships:
          oauth-client:
            data:
              id: oc-dQnkeDhvm9ytHxwM
              type: oauth-clients
            links:
              related: /api/v2/oauth-clients/oc-dQnkeDhvm9ytHxwM
        type: oauth-tokens
      type: dict
  description: Details on OAuth Token.
  returned: success
  type: dict
organization:
  description: Organization name or external-id.
  returned: always
  sample: foo
  type: str
state:
  description: OAuth Token state
  returned: always
  sample: present
  type: str