-
Notifications
You must be signed in to change notification settings - Fork 342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
amazon.aws.s3_bucket: Setting policy to None/null does not remove bucket policy #385
Comments
Files identified in the description:
If these files are inaccurate, please update the |
One addendum: I just realized that removing bucket policies works when setting the # Ensure no policy is attached to the bucket
- amazon.aws.s3_bucket:
name: mys3bucket
state: present
policy: 'null' |
Hi @2d6, Thank you for taking the time to report this. Would you like to submit a documentation fix? |
I just created a small PR to add this case to the documentation :) |
Validation rejects setting empty Validation rejects setting empty Playbook does nothing when the Playbook does nothing when the The user is forced to either manually delete the policy and then remove the Ansible policy field; Or else delete the S3 bucket and start from scratch. |
s3_bucket - improve documentation of policy parameter SUMMARY This pull requests improves the documentation of the policy parameter in the s3_bucket module. It documents how to ensure the absence of a policy. Fixes #385 ISSUE TYPE Docs Pull Request COMPONENT NAME s3_bucket Reviewed-by: Jill R <None> Reviewed-by: Moritz Wagner <None> Reviewed-by: None <None> Reviewed-by: Mark Chappell <None>
* rds_instance: Add purge_security_groups feature for vpc_security_groups_ids. * Fixes: ansible-collections#385 This commit was initially merged in https://github.com/ansible-collections/community.aws See: ansible-collections/community.aws@cd32e65
* rds_instance: Add purge_security_groups feature for vpc_security_groups_ids. * Fixes: ansible-collections#385 This commit was initially merged in https://github.com/ansible-collections/community.aws See: ansible-collections/community.aws@cd32e65
* rds_instance: Add purge_security_groups feature for vpc_security_groups_ids. * Fixes: ansible-collections#385 This commit was initially merged in https://github.com/ansible-collections/community.aws See: ansible-collections/community.aws@cd32e65
* rds_instance: Add purge_security_groups feature for vpc_security_groups_ids. * Fixes: ansible-collections#385 This commit was initially merged in https://github.com/ansible-collections/community.aws See: ansible-collections/community.aws@cd32e65
* rds_instance: Add purge_security_groups feature for vpc_security_groups_ids. * Fixes: ansible-collections#385 This commit was initially merged in https://github.com/ansible-collections/community.aws See: ansible-collections/community.aws@cd32e65
* rds_instance: Add purge_security_groups feature for vpc_security_groups_ids. * Fixes: ansible-collections#385 This commit was initially merged in https://github.com/ansible-collections/community.aws See: ansible-collections/community.aws@cd32e65
* rds_instance: Add purge_security_groups feature for vpc_security_groups_ids. * Fixes: ansible-collections#385 This commit was initially merged in https://github.com/ansible-collections/community.aws See: ansible-collections/community.aws@cd32e65
* rds_instance: Add purge_security_groups feature for vpc_security_groups_ids. * Fixes: ansible-collections#385 This commit was initially merged in https://github.com/ansible-collections/community.aws See: ansible-collections/community.aws@cd32e65
* rds_instance: Add purge_security_groups feature for vpc_security_groups_ids. * Fixes: ansible-collections#385 This commit was initially merged in https://github.com/ansible-collections/community.aws See: ansible-collections/community.aws@cd32e65
* rds_instance: Add purge_security_groups feature for vpc_security_groups_ids. * Fixes: ansible-collections#385 This commit was initially merged in https://github.com/ansible-collections/community.aws See: ansible-collections/community.aws@cd32e65
* rds_instance: Add purge_security_groups feature for vpc_security_groups_ids. * Fixes: ansible-collections#385 This commit was initially merged in https://github.com/ansible-collections/community.aws See: ansible-collections/community.aws@cd32e65
* rds_instance: Add purge_security_groups feature for vpc_security_groups_ids. * Fixes: ansible-collections#385
* rds_instance: Add purge_security_groups feature for vpc_security_groups_ids. * Fixes: ansible-collections#385
* rds_instance: Add purge_security_groups feature for vpc_security_groups_ids. * Fixes: ansible-collections#385
SUMMARY
When removing the
policy
attribute from ans3_bucket
task, the module does not seem to remove the policy and reports no changes.ISSUE TYPE
COMPONENT NAME
s3_bucket
ANSIBLE VERSION
CONFIGURATION
(
ansible-config dump --only-changed
reported no changes)Note that I used an S3-compatible third-party provider for running the module. I am aware that this might not be supported. However, I think that the issue also affects AWS, as the cause seems lie within the module itself (see below).
OS / ENVIRONMENT
Manjaro 21.0.6
STEPS TO REPRODUCE
The file
bucket-policy-public-access.json.j2
containedEXPECTED RESULTS
I expected the first task to create a bucket with an attached policy. I then expected either of the second and third tasks to remove said policy
ACTUAL RESULTS
The first task created the bucket with attached policy, as expected. Neither of the second and third tasks removed the policy from the bucket. I attached a sanitized output below.
From looking at the module code, I think there might be a bug here:
amazon.aws/plugins/modules/s3_bucket.py
Lines 360 to 366 in 0cdc47b
main
as of submitting this issue). Line 360 ensures that only non-None
values ofpolicy
will enter line 364.As far as I can tell, the predicate on line 364 always evaluates to(EDIT: this is not true. SettingFalse
under this condition. Hence, Line 366 will never be reached, which means that bucket policies may not be deleted.policy
to the string value'null'
will lead to policy deletion. See my other comment below. Maybe this is simply an issue of documentation?)The text was updated successfully, but these errors were encountered: