esp.terraform.tfe_organization (0.1.0) — module

Create, update, and destroy organizations

| "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, updates or removes Terraform organizations.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create or update an Organization
  esp.terraform.tfe_organization:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    attributes:
      "name": foo
      "email": jsmith@example.com
      "session-timeout": 20160
      "session-remember": 20160
      "collaborator-auth-policy": password
      "cost-estimation-enabled": true
      #"owners-team-saml-role-id": owners
    state: present
    validate_certs: no
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Destroy an Organization
  esp.terraform.tfe_organization:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo    
    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 organization 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 organization properties.
    - Required when C(state=present).
    required: false
    suboptions:
      collaborator-auth-policy:
        description:
        - Authentication policy (password or two_factor_mandatory).
        required: false
        type: str
      cost-estimation-enabled:
        description:
        - Whether or not the cost estimation feature is enabled for all workspaces in
          the organization.
        required: false
        type: bool
      email:
        description:
        - Admin email address.
        required: true
        type: str
      name:
        description:
        - Name of the organization.
        required: true
        type: str
      owners-team-saml-role-id:
        description:
        - Optional. SAML only The name of the owners team.
        required: false
        type: str
      session-remember:
        description:
        - Session expiration (minutes).
        required: false
        type: int
      session-timeout:
        description:
        - Session timeout after inactivity (minutes).
        required: false
        type: int
    type: dict

organization:
    description:
    - Organization name to update or remove.
    - Required when C(state=absent).
    required: false
    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 organization.
      returned: success
      sample:
        attributes:
          collaborator-auth-policy: password
          cost-estimation-enabled: true
          created-at: '2021-04-23T20:55:40.419000+00:00'
          email: jsmith@example.com
          external-id: org-xvbiL33XypaReLcG
          fair-run-queuing-enabled: false
          name: foo
          owners-team-saml-role-id: null
          permissions:
            can-access-via-teams: true
            can-create-module: true
            can-create-team: true
            can-create-workspace: true
            can-destroy: true
            can-manage-sso: false
            can-manage-subscription: true
            can-manage-users: true
            can-start-trial: false
            can-traverse: true
            can-update: true
            can-update-agent-pools: false
            can-update-api-token: true
            can-update-oauth: true
            can-update-sentinel: true
            can-update-ssh-keys: true
          plan-expired: false
          plan-expires-at: null
          plan-is-enterprise: false
          plan-is-trial: false
          saml-enabled: true
          session-remember: 20160
          session-timeout: 20160
          two-factor-conformant: false
        id: foo
        links:
          self: /api/v2/organizations/foo
      type: dict
  description: Details on organization.
  returned: success
  type: dict
state:
  description: Organization state
  returned: always
  sample: present
  type: str