esp.terraform.tfe_vcs_token_info (0.1.0) — module

List VCS tokens for a given VCS connection

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

List the OAuth Tokens (VCS tokens) for a given OAuth Client (VCS connection).

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: Retrieve details on all VCS tokens in the organization
  esp.terraform.tfe_vcs_token_info:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo
    oauth_token:
      - '*'
    validate_certs: no
  register: _result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Retrieve details on all VCS tokens for a given VCS connection (supplied by name)
  esp.terraform.tfe_vcs_token_info:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo
    client: My Bitbucket
    oauth_token:
      - '*'
    validate_certs: no
  register: _result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Retrieve details on the given VCS tokens for a given VCS connection (supplied by ID)
  esp.terraform.tfe_vcs_token_info:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo
    client: oc-dQnkeDhvm9ytHxwM
    oauth_token:
      - ot-DxHXyuZUBxZN9g9G
    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

client:
    description:
    - OAuth client (VCS connection) to retrieve tokens for.
    - One may refer to an OAuth client (VCS connection) either by its ID or its name.
    - If not specified, all OAuth Tokens (VCS tokens) in the organization will be searched
      for.
    required: false
    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

oauth_token:
    default:
    - '*'
    description:
    - List of OAuth Tokens (VCS tokens) to retrieve details for.
    - This can be '*' which means all OAuth Tokens (VCS tokens).
    required: false
    type: list

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 Tokens.
      elements: dict
      returned: success
      sample:
      - attributes:
          created-at: '2021-04-22T19:51:24.395Z'
          has-ssh-key: false
          service-provider-user: null
        id: ot-DxHXyuZUBxZN9g9G
        links:
          self: /api/v2/oauth-tokens/ot-DxHXyuZUBxZN9g9G
        relationships:
          oauth-client:
            data:
            - id: oc-dQnkeDhvm9ytHxwM
              type: oauth-clients
            links:
              related: /api/v2/oauth-clients/oc-dQnkeDhvm9ytHxwM
        type: oauth-tokens
      type: list
  description: Details on OAuth Tokens.
  returned: success
  type: dict
oauth_client:
  description: OAuth Client (VCS connections).
  returned: always
  sample: My Bitbucket
  type: str
oauth_tokens:
  description: List of OAuth Tokens (VCS tokens) to retrieve details for.
  elements: str
  returned: always
  sample:
  - ot-DxHXyuZUBxZN9g9G
  type: list
organization:
  description: Organization name or external-id.
  returned: always
  sample: foo
  type: str