-
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
95 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
81 changes: 81 additions & 0 deletions
81
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,81 @@ | ||
--- | ||
- 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 | ||
- output.object_lock_enabled == False | ||
|
||
# - 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 encryption 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 |