esp.terraform.tfe_ssh_key_info (0.1.0) — module

List SSH keys in the organization

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

Lists SSH keys in the organization.

SSH keys can be used in two places, i.e. they can be assigned to VCS provider integrations,

they can be assigned to workspaces and used when Terraform needs to clone modules from a Git server.

The list provide metadata about SSH keys. The actual private key text is write-only, and Terraform Cloud never provides it to users.

Details on an SSH key can be retrieved either by its ID or by its name.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Retrieve details on all SSH keys in the organization
  esp.terraform.tfe_ssh_key_info:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo
    ssh_key:
      - '*'
    validate_certs: no
  register: _result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Retrieve details on the given SSH keys (supplied by names or IDs), in the organization
  esp.terraform.tfe_ssh_key_info:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo
    ssh_key:
      - my-ssh-key
      - sshkey-1nXFmNCq38FDyUqo
    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

retries:
    default: 3
    description:
    - Number of retries to call Terraform API URL before failure.
    type: int

ssh_key:
    default:
    - '*'
    description:
    - List of SSH keys to retrieve details for.
    - This can be '*' which means all SSH keys.
    - One may refer to an SSH key either by its ID or its assigned name.
    required: false
    type: list

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 teams.
      elements: dict
      returned: success
      sample:
      - attributes:
          name: my-ssh-key
        id: sshkey-1nXFmNCq38FDyUqo
        links:
          self: /api/v2/ssh-keys/sshkey-1nXFmNCq38FDyUqo
        type: ssh-keys
      type: list
  description: Details on teams.
  returned: success
  type: dict