esp.terraform.tfe_organization_membership (0.1.0) — module

Manage Organization membership

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

Manages Organization membership, adds users to organizations and removes users from organizations.

Users are added to organizations by inviting them to join. Once accepted, they become members of the organization. The Organization Membership resource represents this membership.

All users must be added to at least one team.

You can invite users who already have an account, as well as new users.

If the user has an existing account with the same email address used to invite them, they can reuse the same login.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Invite a user to an Organization
  esp.terraform.tfe_organization_membership:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo    
    user: jsmith@example.com
    teams:
      - owners 
    state: present
    validate_certs: no
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Invite a user to an Organization
  esp.terraform.tfe_organization_membership:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo    
    user: jsmith@example.com
    teams:
      - team-VQ1FncissQs9Bom8
      - developers
    state: present
    validate_certs: no
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove user from Organization, refer to the user by user email
  esp.terraform.tfe_organization_membership:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo     
    user: jsmith@example.com    
    state: absent
    validate_certs: no
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove user from Organization, refer to the user by user ID
  esp.terraform.tfe_organization_membership:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo     
    user: user-K1LWGyjmnDL59y4H    
    state: absent
    validate_certs: no
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove user from Organization, refer to the user by user login
  esp.terraform.tfe_organization_membership:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo     
    user: john_smith    
    state: absent
    validate_certs: no
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove user from Organization, refer to the user by organization membership_id
  esp.terraform.tfe_organization_membership:
    url: 'https://terraform.example.com'
    token: '{{ token }}'
    organization: foo     
    user: ou-SKVvnWhoTxWrofkE   
    state: absent
    validate_certs: no    

Inputs

    
url:
    description:
    - Terraform Enterprise URL.
    required: false
    type: str

user:
    description:
    - The user to be invited or deleted.
    - If C(state=present) you must refer to the user by user email.
    - If C(state=absent) you may refer to the user either by user login, ID, email or
      existing organization membership_id as well.
    required: true
    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 user should be a member of the organization or not.
    required: true
    type: str

teams:
    description:
    - List of teams the invited user will be a member of.
    - All users must be added to at least one team.
    - You may refer to the team either by team name or its ID.
    - Required when C(state=present).
    required: false
    type: list

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

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 organization membership.
      returned: success
      sample:
        attributes:
          created-at: '2021-04-25T19:17:31.368000+00:00'
          email: jsmith@example.com
          status: invited
        id: ou-hPb9GEGDdpVKM8Z5
        relationships:
          organization:
            data:
              id: foo
              type: organizations
          teams:
            data:
            - id: team-VQ1FncissQs9Bom8
              type: teams
          user:
            data:
              id: user-ctVahEhZNb22D5Se
              type: users
        type: organization-memberships
      type: dict
  description: Details on organization membership.
  returned: success
  type: dict
state:
  description: Organization membership state
  returned: always
  sample: present
  type: str