amazon.cloud.cloudtrail_trail (0.4.0) — module

Creates and manages a trail that specifies the settings for delivery of log data to an Amazon S3 bucket.

| "added in version" 0.2.0 of amazon.cloud"

Authors: Ansible Cloud Team (@ansible-collections)

Install collection

Install with ansible-galaxy collection install amazon.cloud:==0.4.0


Add to requirements.yml

  collections:
    - name: amazon.cloud
      version: 0.4.0

Description

Creates and manages a trail that specifies the settings for delivery of log data to an Amazon S3 bucket.


Requirements

Inputs

    
tags:
    aliases:
    - resource_tags
    description:
    - A dict of tags to apply to the resource.
    - To remove all tags set I(tags={}) and I(purge_tags=true).
    type: dict

wait:
    default: false
    description:
    - Wait for operation to complete before returning.
    type: bool

force:
    default: false
    description:
    - Cancel IN_PROGRESS and PENDING resource requestes.
    - Because you can only perform a single operation on a given resource at a time, there
      might be cases where you need to cancel the current resource operation to make the
      resource available so that another operation may be performed on it.
    type: bool

state:
    choices:
    - present
    - absent
    - list
    - describe
    - get
    default: present
    description:
    - Goal state for resource.
    - I(state=present) creates the resource if it doesn't exist, or updates to the provided
      state if the resource already exists.
    - I(state=absent) ensures an existing instance is deleted.
    - I(state=list) get all the existing resources.
    - I(state=describe) or I(state=get) retrieves information on an existing resource.
    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

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

is_logging:
    description:
    - Whether the CloudTrail is currently logging AWS API calls.
    type: bool

kms_key_id:
    description:
    - Specifies the KMS key ID to use to encrypt the logs delivered by CloudTrail.
    - The value can be an alias name prefixed by alias/, a fully specified ARN to an alias,
      a fully specified ARN to a key, or a globally unique identifier.
    type: str

purge_tags:
    default: true
    description:
    - Remove tags not listed in I(tags).
    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

trail_name:
    description:
    - Not Provived.
    type: str

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

wait_timeout:
    default: 320
    description:
    - How many seconds to wait for an operation to complete before timing out.
    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

s3_key_prefix:
    description:
    - Specifies the Amazon S3 key prefix that comes after the name of the bucket you have
      designated for log file delivery.
    - For more information, see Finding Your CloudTrail Log Files.
    - The maximum length is 200 characters.
    type: str

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

s3_bucket_name:
    description:
    - Specifies the name of the Amazon S3 bucket designated for publishing log files.
    - See Amazon S3 Bucket Naming Requirements.
    type: str

sns_topic_name:
    description:
    - Specifies the name of the Amazon SNS topic defined for notification of log file
      delivery.
    - The maximum length is 256 characters.
    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

event_selectors:
    description:
    - The type of email sending events to publish to the event destination.
    elements: dict
    suboptions:
      data_resources:
        description:
        - CloudTrail supports data event logging for Amazon S3 objects and AWS Lambda
          functions.
        - You can specify up to 250 resources for an individual event selector, but the
          total number of data resources cannot exceed 250 across all event selectors
          in a trail.
        - This limit does not apply if you configure resource logging for all data events.
        elements: dict
        suboptions:
          type:
            description:
            - The resource type in which you want to log data events.
            - You can specify AWS::S3::Object or AWS::Lambda::Function resources.
            type: str
          values:
            description:
            - An array of Amazon Resource Name (ARN) strings or partial ARN strings for
              the specified objects.
            elements: str
            type: list
        type: list
      exclude_management_event_sources:
        description:
        - An optional list of service event sources from which you do not want management
          events to be logged on your trail.
        - In this release, the list can be empty (disables the filter), or it can filter
          out AWS Key Management Service events by containing kms.amazonaws.com.
        - By default, I(exclude_management_event_sources) is empty, and AWS KMS events
          are included in events that are logged to your trail.
        elements: str
        type: list
      include_management_events:
        description:
        - Specify if you want your event selector to include management events for your
          trail.
        type: bool
      read_write_type:
        choices:
        - All
        - ReadOnly
        - WriteOnly
        description:
        - Specify if you want your trail to log read-only events, write-only events, or
          all.
        - For example, the EC2 GetConsoleOutput is a read-only API operation and RunInstances
          is a write-only API operation.
        type: str
    type: list

insight_selectors:
    description:
    - A string that contains insight types that are logged on a trail.
    elements: dict
    suboptions:
      insight_type:
        description:
        - The type of insight to log on a trail.
        type: str
    type: list

is_multi_region_trail:
    description:
    - Specifies whether the trail applies only to the current region or to all regions.
    - The default is false.
    - If the trail exists only in the current region and this value is set to true, shadow
      trails (replications of the trail) will be created in the other regions.
    - If the trail exists in all regions and this value is set to false, the trail will
      remain in the region where it was created, and its shadow trails in other regions
      will be deleted.
    - As a best practice, consider using trails that log events in all regions.
    type: bool

is_organization_trail:
    description:
    - Specifies whether the trail is created for all accounts in an organization in AWS
      Organizations, or only for the current AWS account.
    - The default is false, and cannot be true unless the call is made on behalf of an
      AWS account that is the master account for an organization in AWS Organizations.
    type: bool

cloud_watch_logs_role_arn:
    description:
    - Specifies the role for the CloudWatch Logs endpoint to assume to write to a users
      log group.
    type: str

enable_log_file_validation:
    description:
    - Specifies whether log file validation is enabled.
    - The default is 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

include_global_service_events:
    description:
    - Specifies whether the trail is publishing events from global services such as IAM
      to the log files.
    type: bool

cloud_watch_logs_log_group_arn:
    description:
    - Specifies a log group name using an Amazon Resource Name (ARN), a unique identifier
      that represents the log group to which CloudTrail logs will be delivered.
    - Not required unless you specify CloudWatchLogsRoleArn.
    type: str

Outputs

result:
  contains:
    identifier:
      description: The unique identifier of the resource.
      type: str
    properties:
      description: The resource properties.
      type: dict
  description:
  - When I(state=list), it is a list containing dictionaries of resource information.
  - Otherwise, it is a dictionary of resource information.
  - When I(state=absent), it is an empty dictionary.
  returned: always
  type: complex