esp.terraform.tfe_vcs_connection (0.1.0) — module

Manage VCS connections 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

Creates or removes a VCS connection between an organization and a VCS provider.

An OAuth Client represents the connection between an organization and a VCS provider.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a VCS connection between an organization and a VCS provider
  esp.terraform.tfe_vcs_connection:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo
    attributes:
      "service-provider": bitbucket_server
      "http-url": https://bitbucket.example.com
      "api-url": https://bitbucket.example.com
      "name": My test VCS
    state: present
    validate_certs: no
  register: _result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Update a VCS connection
  esp.terraform.tfe_vcs_connection:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo
    client: My test VCS
    attributes:
      "name": My new VCS name
    state: present
    validate_certs: no
  register: _result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove a VCS connection between an organization and a VCS provider, refer by its name
  esp.terraform.tfe_vcs_connection:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo
    client: My test VCS
    state: absent
    validate_certs: no
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove a VCS connection between an organization and a VCS provider, refer by its ID
  esp.terraform.tfe_vcs_connection:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo    
    client: oc-tVGQD7Wk2ujR9Gvu
    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

client:
    description:
    - OAuth client (VCS connections) ID or name to remove.
    - Required when C(state=absent).
    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

attributes:
    description:
    - Definition of the attributes for the VCS connection.
    - Required when C(state=present).
    suboptions:
      api-url:
        description:
        - The base URL of your VCS provider's API.
        required: false
        type: str
      http-url:
        description:
        - The homepage of your VCS provider.
        required: false
        type: str
      name:
        description:
        - An optional display name for the OAuth Client.
        - If left null, the UI will default to the display name of the VCS provider.
        required: false
        type: str
      oauth-token-string:
        description:
        - The token string you were given by your VCS provider.
        required: false
        type: str
      private-key:
        description:
        - The text of the SSH private key associated with your Azure DevOps Server account.
        required: false
        type: str
      service-provider:
        choices:
        - bitbucket_server
        - github
        - github_enterprise
        - gitlab_hosted
        - gitlab_community_edition
        - gitlab_enterprise_edition
        - ado_server
        description:
        - The VCS provider being connected with.
        required: true
        type: str
    type: dict

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:
          api-url: https://bitbucket.example.com
          callback-url: https://terraform.example.com/auth/2b81cf18-0e5a-48dc-95aa-cee4a15472b8/callback
          connect-path: /auth/2b81cf18-0e5a-48dc-95aa-cee4a15472b8?organization_id=1
          http-url: https://bitbucket.example.com
          key: 8eebbb1bf0a0f3a3e679fd0fb31b2647
          name: My test VCS
          rsa-public-key: '-----BEGIN PUBLIC KEY- .... '
          service-provider: bitbucket_server
          service-provider-display-name: Bitbucket Server
          tfvcs: false
        id: oc-4BWCffCgwSGYCrkW
        relationships:
          oauth-tokens:
            data: []
            links:
              related: /api/v2/oauth-clients/oc-4BWCffCgwSGYCrkW/oauth-tokens
          organization:
            data:
              id: foo
              type: organizations
            links:
              related: /api/v2/organizations/foo
        type: oauth-clients
      type: dict
  description: Details on OAuth Clients.
  returned: success
  type: dict
organization:
  description: Organization name or external-id.
  returned: always
  sample: foo
  type: str
state:
  description: OAuth Client state
  returned: always
  sample: present
  type: str