-
Notifications
You must be signed in to change notification settings - Fork 342
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
135 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
minor_changes: | ||
- s3_bucket - The option to create a bucket with object lock enabled (https://github.com/ansible-collections/amazon.aws/pull/1372). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 118 additions & 0 deletions
118
tests/integration/targets/s3_bucket/roles/s3_bucket/tasks/object_lock.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
--- | ||
- module_defaults: | ||
group/aws: | ||
aws_access_key: "{{ aws_access_key }}" | ||
aws_secret_key: "{{ aws_secret_key }}" | ||
security_token: "{{ security_token | default(omit) }}" | ||
region: "{{ aws_region }}" | ||
block: | ||
- set_fact: | ||
local_bucket_name: "{{ bucket_name | hash('md5')}}-object_lock" | ||
|
||
# ============================================================ | ||
|
||
- name: 'Create a simple bucket' | ||
s3_bucket: | ||
name: '{{ local_bucket_name }}' | ||
state: present | ||
register: output | ||
|
||
- assert: | ||
that: | ||
- output.changed | ||
- not output.object_lock_enabled | ||
|
||
- name: Delete test s3 bucket | ||
s3_bucket: | ||
name: '{{ local_bucket_name }}' | ||
state: absent | ||
register: output | ||
|
||
- assert: | ||
that: | ||
- output.changed | ||
|
||
# ============================================================ | ||
|
||
- name: 'Create a bucket with object lock enabled' | ||
s3_bucket: | ||
name: '{{ local_bucket_name }}' | ||
state: present | ||
object_lock_enabled: true | ||
register: output | ||
|
||
- assert: | ||
that: | ||
- output.changed | ||
- output.object_lock_enabled | ||
|
||
- name: Delete test s3 bucket | ||
s3_bucket: | ||
name: '{{ local_bucket_name }}' | ||
state: absent | ||
register: output | ||
|
||
- assert: | ||
that: | ||
- output.changed | ||
|
||
# ============================================================ | ||
|
||
# - name: 'Re-enable AES256 encryption (idempotency)' | ||
# s3_bucket: | ||
# name: '{{ local_bucket_name }}' | ||
# state: present | ||
# encryption: 'AES256' | ||
# register: output | ||
|
||
# - assert: | ||
# that: | ||
# - not output.changed | ||
# - output.encryption | ||
# - output.encryption.SSEAlgorithm == 'AES256' | ||
|
||
# ============================================================ | ||
|
||
# - name: Disable encryption from bucket | ||
# s3_bucket: | ||
# name: '{{ local_bucket_name }}' | ||
# state: present | ||
# encryption: "none" | ||
# register: output | ||
|
||
# - assert: | ||
# that: | ||
# - output.changed | ||
# - not output.encryption | ||
|
||
# - name: Disable encryption from bucket | ||
# s3_bucket: | ||
# name: '{{ local_bucket_name }}' | ||
# state: present | ||
# encryption: "none" | ||
# register: output | ||
|
||
# - assert: | ||
# that: | ||
# - output is not changed | ||
# - not output.encryption | ||
|
||
# ============================================================ | ||
|
||
- name: Delete test s3 bucket | ||
s3_bucket: | ||
name: '{{ local_bucket_name }}' | ||
state: absent | ||
register: output | ||
|
||
- assert: | ||
that: | ||
- output.changed | ||
|
||
# ============================================================ | ||
always: | ||
- name: Ensure all buckets are deleted | ||
s3_bucket: | ||
name: '{{ local_bucket_name }}' | ||
state: absent | ||
ignore_errors: yes |