Skip to content

Commit 34bb9d2

Browse files
committed
Merge branch 'hotfix/aws-s3-acl-and-ownership' into devel
Signed-off-by: Webster Mudge <[email protected]>
2 parents 22c2686 + 7624043 commit 34bb9d2

File tree

4 files changed

+23
-14
lines changed

4 files changed

+23
-14
lines changed

docs/configuration.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,8 @@ infra:
374374
tags:
375375
storage:
376376
tags:
377+
bucket_object_ownership:
378+
bucket_acl_permissions:
377379
private_endpoints:
378380
azure:
379381
metagroup:

roles/infrastructure/defaults/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ infra__aws_nat_gateway_suffix: "{{ infra.aws.vpc.nat_gateway.suffix | defau
126126
infra__aws_role_tags: "{{ infra.aws.role.tags | default({}) }}"
127127
infra__aws_policy_tags: "{{ infra.aws.policy.tags | default({}) }}"
128128
infra__aws_storage_tags: "{{ infra.aws.storage.tags | default({}) }}"
129+
infra__aws_bucket_object_ownership: "{{ infra.aws.storage.bucket_object_ownership | default('BucketOwnerPreferred')}}"
130+
infra__aws_bucket_acl_permissions: "{{ infra.aws.storage.bucket_acl_permissions | default(['bucket-owner-full-control']) }}"
129131
infra__aws_private_endpoints: "{{ infra.aws.vpc.private_endpoints | default(common__tunnel) }}"
130132

131133
# GCP

roles/infrastructure/tasks/setup_aws_storage.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@
3131
loop_var: __storage_tag
3232

3333
- name: Create AWS Buckets
34-
amazon.aws.aws_s3:
34+
amazon.aws.s3_bucket:
3535
region: "{{ infra__region }}"
36-
bucket: "{{ __aws_storage_location_item.bucket }}"
37-
mode: create
38-
permission: private
36+
name: "{{ __aws_storage_location_item.bucket }}"
37+
state: present
38+
object_ownership: "{{ infra__aws_bucket_object_ownership }}"
3939
loop_control:
4040
loop_var: __aws_storage_location_item
41+
label: "{{ __aws_storage_location_item.bucket }}"
4142
loop: "{{ infra__aws_storage_locations }}"
4243
register: __infra_aws_storage_locations_info
4344

@@ -47,8 +48,10 @@
4748
bucket: "{{ __aws_storage_object_item.bucket }}"
4849
object: "{{ __aws_storage_object_item.path }}"
4950
mode: create # Put will not work here due to the way the s3 module is written
51+
permission: "{{ infra__aws_bucket_acl_permissions }}"
5052
loop_control:
5153
loop_var: __aws_storage_object_item
54+
label: "{{ __aws_storage_object_item.bucket }}/{{ __aws_storage_object_item.path }}"
5255
loop: "{{ infra__aws_storage_locations }}"
5356

5457
- name: Update AWS Buckets tags (overwrite)
@@ -65,11 +68,11 @@
6568

6669
- name: Ensure Download Mirror Bucket exists in target region
6770
when: infra__create_utility_service
68-
amazon.aws.aws_s3:
71+
amazon.aws.s3_bucket:
6972
region: "{{ infra__region }}"
70-
bucket: "{{ infra__utlity_bucket_name }}"
71-
mode: create
72-
permission: private
73+
name: "{{ infra__utlity_bucket_name }}"
74+
state: present
75+
object_ownership: "{{ infra__aws_bucket_object_ownership }}"
7376

7477
- name: Update Download Mirror Buckets tags (overwrite)
7578
when: infra__create_utility_service and __infra_aws_storage_tags_list is defined

roles/infrastructure/tasks/teardown_aws_storage.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,22 @@
1616

1717
- name: Remove AWS Buckets
1818
when: infra__teardown_deletes_data
19-
amazon.aws.aws_s3:
19+
amazon.aws.s3_bucket:
2020
region: "{{ infra__region }}"
21-
bucket: "{{ __aws_storage_location_item.bucket }}"
22-
mode: delete
21+
name: "{{ __aws_storage_location_item.bucket }}"
22+
state: absent
23+
force: yes
2324
loop_control:
2425
loop_var: __aws_storage_location_item
2526
loop: "{{ infra__aws_storage_locations }}"
2627

2728
- name: Remove AWS Storage Utility Bucket
2829
when: infra__teardown_auto_repo_mirror | bool
29-
amazon.aws.aws_s3:
30+
amazon.aws.s3_bucket:
3031
region: "{{ infra__region }}"
31-
bucket: "{{ infra__utlity_bucket_name }}"
32-
mode: delete
32+
name: "{{ infra__utlity_bucket_name }}"
33+
state: absent
34+
force: yes
3335

3436
- name: Remove AWS EFS File Systems, if Discovered during Purge
3537
when:

0 commit comments

Comments
 (0)