Ansible Default Object Access Control (#3200) (#164)

* example

* module

* Update products/storage/examples/ansible/default_object_acl.yaml

Co-Authored-By: Chris Hawk <41700375+SirGitsalot@users.noreply.github.com>

Co-authored-by: Chris Hawk <41700375+SirGitsalot@users.noreply.github.com>
Signed-off-by: Modular Magician <magic-modules@google.com>

Co-authored-by: Chris Hawk <41700375+SirGitsalot@users.noreply.github.com>
This commit is contained in:
The Magician 2020-03-03 12:47:31 -08:00 committed by GitHub
commit d1e68460a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 519 additions and 0 deletions

View file

@ -0,0 +1,2 @@
cloud/gcp
unsupported

View file

@ -0,0 +1,2 @@
---
resource_name: "{{ resource_prefix }}"

View file

@ -0,0 +1,99 @@
---
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file at
# https://www.github.com/GoogleCloudPlatform/magic-modules
#
# ----------------------------------------------------------------------------
# Pre-test setup
- name: create a bucket
google.cloud.gcp_storage_bucket:
name: "{{ resource_name }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: bucket
- name: delete a default object acl
google.cloud.gcp_storage_default_object_acl:
bucket: "{{ bucket }}"
entity: OWNER:user-alexstephen@google.com
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a default object acl
google.cloud.gcp_storage_default_object_acl:
bucket: "{{ bucket }}"
entity: OWNER:user-alexstephen@google.com
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
that:
- result.changed == true
# ----------------------------------------------------------------------------
- name: create a default object acl that already exists
google.cloud.gcp_storage_default_object_acl:
bucket: "{{ bucket }}"
entity: OWNER:user-alexstephen@google.com
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
that:
- result.changed == false
#----------------------------------------------------------
- name: delete a default object acl
google.cloud.gcp_storage_default_object_acl:
bucket: "{{ bucket }}"
entity: OWNER:user-alexstephen@google.com
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
that:
- result.changed == true
# ----------------------------------------------------------------------------
- name: delete a default object acl that does not exist
google.cloud.gcp_storage_default_object_acl:
bucket: "{{ bucket }}"
entity: OWNER:user-alexstephen@google.com
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
that:
- result.changed == false
#---------------------------------------------------------
# Post-test teardown
# If errors happen, don't crash the playbook!
- name: delete a bucket
google.cloud.gcp_storage_bucket:
name: "{{ resource_name }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: bucket
ignore_errors: true

View file

@ -0,0 +1,2 @@
---
- include_tasks: autogen.yml