community.aws.ec2_transit_gateway_vpc_attachment (5.1.0) — module

Create and delete AWS Transit Gateway VPC attachments

| "added in version" 4.0.0 of community.aws"

Authors: Mark Chappell (@tremble)

Install collection

Install with ansible-galaxy collection install community.aws:==5.1.0


Add to requirements.yml

  collections:
    - name: community.aws
      version: 5.1.0

Description

Creates, Deletes and Updates AWS Transit Gateway VPC Attachments.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Create a Transit Gateway attachment
- community.aws.ec2_transit_gateway_vpc_attachment:
    state: present
    transit_gateway: 'tgw-123456789abcdef01'
    name: AnsibleTest-1
    subnets:
    - subnet-00000000000000000
    - subnet-11111111111111111
    - subnet-22222222222222222
    ipv6_support: True
    purge_subnets: True
    dns_support: True
    appliance_mode_support: True
    tags:
      TestTag: changed data in Test Tag
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Set sub options on a Transit Gateway attachment
- community.aws.ec2_transit_gateway_vpc_attachment:
    state: present
    id: 'tgw-attach-0c0c5fd0b0f01d1c9'
    name: AnsibleTest-1
    ipv6_support: True
    purge_subnets: False
    dns_support: False
    appliance_mode_support: True
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Delete the transit gateway
- community.aws.ec2_transit_gateway_vpc_attachment:
    state: absent
    id: 'tgw-attach-0c0c5fd0b0f01d1c9'

Inputs

    
id:
    aliases:
    - attachment_id
    description:
    - The ID of the Transit Gateway Attachment.
    - When I(id) is not set, a search using I(transit_gateway) and I(name) will be performed.  If
      multiple results are returned, the module will fail.
    - At least one of I(name), I(transit_gateway) and I(id) must be provided.
    required: false
    type: str

name:
    description:
    - The C(Name) tag of the Transit Gateway attachment.
    - Providing both I(id) and I(name) will set the C(Name) tag on an existing attachment
      the matching I(id).
    - Setting the C(Name) tag in I(tags) will also result in the C(Name) tag being updated.
    - At least one of I(name), I(transit_gateway) and I(id) must be provided.
    required: false
    type: str

tags:
    aliases:
    - resource_tags
    description:
    - A dictionary representing the tags to be applied to the resource.
    - If the I(tags) parameter is not set then tags will not be modified.
    required: false
    type: dict

wait:
    default: true
    description:
    - Whether to wait for the Transit Gateway attachment to reach the C(Available) or
      C(Deleted) state before the module returns.
    required: false
    type: bool

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Create or remove the Transit Gateway attachment.
    required: false
    type: str

region:
    aliases:
    - aws_region
    - ec2_region
    description:
    - The AWS region to use.
    - For global services such as IAM, Route53 and CloudFront, I(region) is ignored.
    - The C(AWS_REGION) or C(EC2_REGION) environment variables may also be used.
    - See the Amazon AWS documentation for more information U(http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region).
    - The C(ec2_region) alias has been deprecated and will be removed in a release after
      2024-12-01
    - Support for the C(EC2_REGION) environment variable has been deprecated and will
      be removed in a release after 2024-12-01.
    type: str

profile:
    aliases:
    - aws_profile
    description:
    - A named AWS profile to use for authentication.
    - See the AWS documentation for more information about named profiles U(https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html).
    - The C(AWS_PROFILE) environment variable may also be used.
    - The I(profile) option is mutually exclusive with the I(aws_access_key), I(aws_secret_key)
      and I(security_token) options.
    type: str

subnets:
    description:
    - The ID of the subnets in which to create the transit gateway VPC attachment.
    - Required when creating a new attachment.
    elements: str
    required: false
    type: list

access_key:
    aliases:
    - aws_access_key_id
    - aws_access_key
    - ec2_access_key
    description:
    - AWS access key ID.
    - See the AWS documentation for more information about access tokens U(https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys).
    - The C(AWS_ACCESS_KEY_ID), C(AWS_ACCESS_KEY) or C(EC2_ACCESS_KEY) environment variables
      may also be used in decreasing order of preference.
    - The I(aws_access_key) and I(profile) options are mutually exclusive.
    - The I(aws_access_key_id) alias was added in release 5.1.0 for consistency with the
      AWS botocore SDK.
    - The I(ec2_access_key) alias has been deprecated and will be removed in a release
      after 2024-12-01.
    - Support for the C(EC2_ACCESS_KEY) environment variable has been deprecated and will
      be removed in a release after 2024-12-01.
    type: str

aws_config:
    description:
    - A dictionary to modify the botocore configuration.
    - Parameters can be found in the AWS documentation U(https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config).
    type: dict

purge_tags:
    default: true
    description:
    - If I(purge_tags=true) and I(tags) is set, existing tags will be purged from the
      resource to match exactly what is defined by I(tags) parameter.
    - If the I(tags) parameter is not set then tags will not be modified, even if I(purge_tags=True).
    - Tag keys beginning with C(aws:) are reserved by Amazon and can not be modified.  As
      such they will be ignored for the purposes of the I(purge_tags) parameter.  See
      the Amazon documentation for more information U(https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html#tag-conventions).
    required: false
    type: bool

secret_key:
    aliases:
    - aws_secret_access_key
    - aws_secret_key
    - ec2_secret_key
    description:
    - AWS secret access key.
    - See the AWS documentation for more information about access tokens U(https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys).
    - The C(AWS_SECRET_ACCESS_KEY), C(AWS_SECRET_KEY), or C(EC2_SECRET_KEY) environment
      variables may also be used in decreasing order of preference.
    - The I(secret_key) and I(profile) options are mutually exclusive.
    - The I(aws_secret_access_key) alias was added in release 5.1.0 for consistency with
      the AWS botocore SDK.
    - The I(ec2_secret_key) alias has been deprecated and will be removed in a release
      after 2024-12-01.
    - Support for the C(EC2_SECRET_KEY) environment variable has been deprecated and will
      be removed in a release after 2024-12-01.
    type: str

dns_support:
    description:
    - Whether DNS support is enabled.
    required: false
    type: bool

endpoint_url:
    aliases:
    - ec2_url
    - aws_endpoint_url
    - s3_url
    description:
    - URL to connect to instead of the default AWS endpoints.  While this can be used
      to connection to other AWS-compatible services the amazon.aws and community.aws
      collections are only tested against AWS.
    - The  C(AWS_URL) or C(EC2_URL) environment variables may also be used, in decreasing
      order of preference.
    - The I(ec2_url) and I(s3_url) aliases have been deprecated and will be removed in
      a release after 2024-12-01.
    - Support for the C(EC2_URL) environment variable has been deprecated and will be
      removed in a release after 2024-12-01.
    type: str

ipv6_support:
    description:
    - Whether IPv6 support is enabled.
    required: false
    type: bool

wait_timeout:
    description:
    - Maximum time, in seconds, to wait for the Transit Gateway attachment to reach the
      expected state.
    - Defaults to 600 seconds.
    required: false
    type: int

aws_ca_bundle:
    description:
    - The location of a CA Bundle to use when validating SSL certificates.
    - The C(AWS_CA_BUNDLE) environment variable may also be used.
    type: path

purge_subnets:
    default: true
    description:
    - If I(purge_subnets=true), existing subnets will be removed from the attachment as
      necessary to match exactly what is defined by I(subnets).
    required: false
    type: bool

session_token:
    aliases:
    - aws_session_token
    - security_token
    - aws_security_token
    - access_token
    description:
    - AWS STS session token for use with temporary credentials.
    - See the AWS documentation for more information about access tokens U(https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys).
    - The C(AWS_SESSION_TOKEN), C(AWS_SECURITY_TOKEN) or C(EC2_SECURITY_TOKEN) environment
      variables may also be used in decreasing order of preference.
    - The I(security_token) and I(profile) options are mutually exclusive.
    - Aliases I(aws_session_token) and I(session_token) were added in release 3.2.0, with
      the parameter being renamed from I(security_token) to I(session_token) in release
      6.0.0.
    - The I(security_token), I(aws_security_token), and I(access_token) aliases have been
      deprecated and will be removed in a release after 2024-12-01.
    - Support for the C(EC2_SECRET_KEY) and C(AWS_SECURITY_TOKEN) environment variables
      has been deprecated and will be removed in a release after 2024-12-01.
    type: str

validate_certs:
    default: true
    description:
    - When set to C(false), SSL certificates will not be validated for communication with
      the AWS APIs.
    - Setting I(validate_certs=false) is strongly discouraged, as an alternative, consider
      setting I(aws_ca_bundle) instead.
    type: bool

transit_gateway:
    aliases:
    - transit_gateway_id
    description:
    - The ID of the Transit Gateway that the attachment belongs to.
    - When creating a new attachment, I(transit_gateway) must be provided.
    - At least one of I(name), I(transit_gateway) and I(id) must be provided.
    - I(transit_gateway) is an immutable setting and can not be updated on an existing
      attachment.
    required: false
    type: str

appliance_mode_support:
    description:
    - Whether the attachment is configured for appliance mode.
    - When appliance mode is enabled, Transit Gateway, using 4-tuples of an IP packet,
      selects a single Transit Gateway ENI in the Appliance VPC for the life of a flow
      to send traffic to.
    required: false
    type: bool

debug_botocore_endpoint_logs:
    default: false
    description:
    - Use a C(botocore.endpoint) logger to parse the unique (rather than total) C("resource:action")
      API calls made during a task, outputing the set to the resource_actions key in the
      task results. Use the C(aws_resource_action) callback to output to total list made
      during a playbook.
    - The C(ANSIBLE_DEBUG_BOTOCORE_LOGS) environment variable may also be used.
    type: bool

Outputs

transit_gateway_attachments:
  contains:
    creation_time:
      description:
      - An ISO 8601 date time stamp of when the attachment was created.
      example: '2022-03-10T16:40:26+00:00'
      returned: success
      type: str
    options:
      contains:
        appliance_mode_support:
          description:
          - Indicates whether appliance mode support is enabled.
          example: enable
          returned: success
          type: str
        dns_support:
          description:
          - Indicates whether DNS support is enabled.
          example: disable
          returned: success
          type: str
        ipv6_support:
          description:
          - Indicates whether IPv6 support is disabled.
          example: disable
          returned: success
          type: str
      description:
      - Additional VPC attachment options.
      returned: success
      type: dict
    state:
      description:
      - The state of the attachment.
      example: deleting
      returned: success
      type: str
    subnet_ids:
      description:
      - The IDs of the subnets in use by the attachment.
      elements: str
      example:
      - subnet-0123456789abcdef0
      - subnet-11111111111111111
      returned: success
      type: list
    tags:
      description:
      - A dictionary representing the resource tags.
      returned: success
      type: dict
    transit_gateway_attachment_id:
      description:
      - The ID of the attachment.
      example: tgw-attach-0c0c5fd0b0f01d1c9
      returned: success
      type: str
    transit_gateway_id:
      description:
      - The ID of the transit gateway that the attachment is connected to.
      example: tgw-0123456789abcdef0
      returned: success
      type: str
    vpc_id:
      description:
      - The ID of the VPC that the attachment is connected to.
      example: vpc-0123456789abcdef0
      returned: success
      type: str
    vpc_owner_id:
      description:
      - The ID of the account that the VPC belongs to.
      example: '123456789012'
      returned: success
      type: str
  description: The attributes of the Transit Gateway attachments.
  elements: dict
  returned: success
  type: list