steampunk.aws.s3_bucket (0.9.0) — module

Manage S3 bucket

Authors: Manca Bizjak (@mancabizjak), Aljaz Kosir (@aljazkosir), Saso Stanovnik (@sstanovnik), Miha Dolinar (@mdolinar), Tadej Borovsak (@tadeboro)

preview | supported by XLAB Steampunk

Install collection

Install with ansible-galaxy collection install steampunk.aws:==0.9.0


Add to requirements.yml

  collections:
    - name: steampunk.aws
      version: 0.9.0

Description

Creation and deletion of an AWS S3 bucket.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create an S3 bucket
  s3_bucket:
    state: present
    name: xbucket-2020-02-11-1581427332
    public_access: true

Inputs

    
auth:
    description:
    - Parameters for authenticating with the AWS service. Each of them may be defined
      via environment variables.
    suboptions:
      access_key:
        description:
        - The AWS access key ID. If not set, the value of the AWS_ACCESS_KEY environment
          variable will be checked.
        - Mutually exclusive with I(profile).
        required: false
        type: str
      profile:
        description:
        - The name of the AWS profile configured with C(aws configure).
        - Can be used instead of explicitly specifying your access credentials and region.
        - Use C(default) to use the default profile.
        - Mutually exclusive with I(access_key) and I(secret_key).
        required: false
        type: str
      region:
        description:
        - The name of the AWS region.
        - If not set, the value of the AWS_REGION environment variable will be checked.
        - If you set a I(profile) that specifies a default region, that region is used
          and you can omit this parameter. Use this parameter to override the profile's
          default region.
        type: str
      secret_key:
        description:
        - The AWS secret access key. If not set, the value of the AWS_SECRET_KEY environment
          variable will be checked.
        - Mutually exclusive with I(profile).
        required: false
        type: str
      url:
        description:
        - The URL to the AWS service related to the resource. By default, this is automatically
          determined through the region parameter.
        - If not set explicitly, the value of the AWS_<SERVICE>_URL environment variable
          will be used.
        - The services currently supported are EC2 and S3.
        required: false
        type: str
    type: dict

name:
    description:
    - Name of S3 bucket. Not every string is an acceptable bucket name.
    - The name must be unique across all existing bucket names in Amazon S3.
    - For naming restrictions see U(https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html)
    required: true
    type: str

tags:
    description:
    - Metadata for the AWS resource as key/value pairs.
    - Keys and values are case-sensitive.
    type: dict

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Target state of the Bucket.
    - If absent, it will delete bucket even if it is not empty.
    type: str

clear_tags:
    default: false
    description:
    - Whether to clear any existing tags on the resource that are not explicitly stated
      in I(tags).
    - By default, existing tags are kept on the resource.
    - When this parameter is set to C(true), any pre-existing tags on the resource are
      removed.
    type: bool

versioning:
    choices:
    - enabled
    - suspended
    default: suspended
    description:
    - Enables you to keep multiple versions of an object in the same bucket.
    type: str

public_access:
    default: false
    description:
    - Ensure that public access to your S3 buckets and objects is blocked.
    type: bool

access_logging:
    default: false
    description:
    - Access logging provides records for the requests that are made to a bucket.
    type: bool

Outputs

object:
  contains:
    access_logging:
      description: If records for the requests are enabled.
      returned: always
      sample: false
      type: bool
    name:
      description: Name of S3 bucket.
      returned: always
      sample: steamybucket
      type: str
    public_access:
      description: If public access to your S3 buckets and objects is blocked.
      returned: always
      sample: false
      type: bool
    tags:
      description: Tags associated with the S3 Bucket.
      returned: always
      sample:
        Name: my-s3-bucket
      type: dict
    versioning:
      description: If there are multiple versions of an object in the same bucket.
      returned: always
      sample: false
      type: bool
  description:
  - An object representing an S3 Bucket.
  returned: success
  type: complex