Implement proper support for data access logs in resource manager modules (#1497)
* organization module * rename iam_bindings_authoritative to iam_policy, fix tests * add support for data access logs and iam policy to folder module * test inventories * add support for data access logs and iam policy to project module
This commit is contained in:
committed by
GitHub
parent
438a3134e2
commit
551dc581e8
27
tests/modules/folder/examples/iam-policy.yaml
Normal file
27
tests/modules/folder/examples/iam-policy.yaml
Normal file
@@ -0,0 +1,27 @@
|
||||
# Copyright 2022 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
values:
|
||||
module.folder.google_folder.folder[0]:
|
||||
display_name: my-folder
|
||||
parent: folders/657104291943
|
||||
timeouts: null
|
||||
module.folder.google_folder_iam_policy.authoritative[0]:
|
||||
policy_data: '{"auditConfigs":[{"auditLogConfigs":[{"exemptedMembers":["group:organization-admins@example.org"],"logType":"ADMIN_READ"}],"service":"allServices"},{"auditLogConfigs":[{"logType":"DATA_WRITE"},{"logType":"DATA_READ"}],"service":"storage.googleapis.com"}],"bindings":[{"members":["group:org-admins@example.com"],"role":"roles/owner"},{"members":["group:org-admins@example.com"],"role":"roles/resourcemanager.folderAdmin"},{"members":["group:org-admins@example.com"],"role":"roles/resourcemanager.organizationAdmin"},{"members":["group:org-admins@example.com"],"role":"roles/resourcemanager.projectCreator"}]}'
|
||||
|
||||
counts:
|
||||
google_folder: 1
|
||||
google_folder_iam_policy: 1
|
||||
modules: 1
|
||||
resources: 2
|
||||
38
tests/modules/folder/examples/logging-data-access.yaml
Normal file
38
tests/modules/folder/examples/logging-data-access.yaml
Normal file
@@ -0,0 +1,38 @@
|
||||
# Copyright 2022 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
values:
|
||||
module.folder.google_folder.folder[0]:
|
||||
display_name: my-folder
|
||||
parent: folders/657104291943
|
||||
timeouts: null
|
||||
module.folder.google_folder_iam_audit_config.default["allServices"]:
|
||||
audit_log_config:
|
||||
- exempted_members:
|
||||
- group:organization-admins@example.org
|
||||
log_type: ADMIN_READ
|
||||
service: allServices
|
||||
module.folder.google_folder_iam_audit_config.default["storage.googleapis.com"]:
|
||||
audit_log_config:
|
||||
- exempted_members: []
|
||||
log_type: DATA_READ
|
||||
- exempted_members: []
|
||||
log_type: DATA_WRITE
|
||||
service: storage.googleapis.com
|
||||
|
||||
counts:
|
||||
google_folder: 1
|
||||
google_folder_iam_audit_config: 2
|
||||
modules: 1
|
||||
resources: 3
|
||||
@@ -1,6 +0,0 @@
|
||||
iam_audit_config = {
|
||||
allServices = {
|
||||
DATA_READ = [],
|
||||
DATA_WRITE = ["user:me@example.org"]
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
# Copyright 2022 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
counts:
|
||||
google_organization_iam_audit_config: 1
|
||||
23
tests/modules/organization/examples/iam-policy.yaml
Normal file
23
tests/modules/organization/examples/iam-policy.yaml
Normal file
@@ -0,0 +1,23 @@
|
||||
# Copyright 2022 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
values:
|
||||
module.org.google_organization_iam_policy.authoritative[0]:
|
||||
org_id: '1122334455'
|
||||
policy_data: '{"auditConfigs":[{"auditLogConfigs":[{"exemptedMembers":["group:organization-admins@example.org"],"logType":"ADMIN_READ"}],"service":"allServices"},{"auditLogConfigs":[{"logType":"DATA_WRITE"},{"logType":"DATA_READ"}],"service":"storage.googleapis.com"}],"bindings":[{"members":["group:org-admins@example.com"],"role":"roles/owner"},{"members":["group:org-admins@example.com"],"role":"roles/resourcemanager.folderAdmin"},{"members":["group:org-admins@example.com"],"role":"roles/resourcemanager.organizationAdmin"},{"members":["group:org-admins@example.com"],"role":"roles/resourcemanager.projectCreator"}]}'
|
||||
|
||||
counts:
|
||||
google_organization_iam_policy: 1
|
||||
modules: 1
|
||||
resources: 1
|
||||
34
tests/modules/organization/examples/logging-data-access.yaml
Normal file
34
tests/modules/organization/examples/logging-data-access.yaml
Normal file
@@ -0,0 +1,34 @@
|
||||
# Copyright 2022 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
values:
|
||||
module.org.google_organization_iam_audit_config.default["allServices"]:
|
||||
audit_log_config:
|
||||
- exempted_members: ["group:organization-admins@example.org"]
|
||||
log_type: ADMIN_READ
|
||||
org_id: '1122334455'
|
||||
service: allServices
|
||||
module.org.google_organization_iam_audit_config.default["storage.googleapis.com"]:
|
||||
audit_log_config:
|
||||
- exempted_members: []
|
||||
log_type: DATA_READ
|
||||
- exempted_members: []
|
||||
log_type: DATA_WRITE
|
||||
org_id: '1122334455'
|
||||
service: storage.googleapis.com
|
||||
|
||||
counts:
|
||||
google_organization_iam_audit_config: 2
|
||||
modules: 1
|
||||
resources: 2
|
||||
@@ -54,9 +54,8 @@ def test_policy_implementation():
|
||||
'- parent = local.folder.name\n',
|
||||
'+ name = "${var.organization_id}/policies/${k}"\n',
|
||||
'+ parent = var.organization_id\n',
|
||||
'@@ -116,0 +117,10 @@\n',
|
||||
'@@ -116,0 +117,9 @@\n',
|
||||
'+ depends_on = [\n',
|
||||
'+ google_organization_iam_audit_config.config,\n',
|
||||
'+ google_organization_iam_binding.authoritative,\n',
|
||||
'+ google_organization_iam_custom_role.roles,\n',
|
||||
'+ google_organization_iam_member.additive,\n',
|
||||
|
||||
@@ -18,7 +18,6 @@ common_tfvars:
|
||||
- common.tfvars
|
||||
|
||||
tests:
|
||||
audit_config:
|
||||
org_policies_list:
|
||||
org_policies_boolean:
|
||||
org_policies_custom_constraints:
|
||||
|
||||
34
tests/modules/project/examples/iam-policy.yaml
Normal file
34
tests/modules/project/examples/iam-policy.yaml
Normal file
@@ -0,0 +1,34 @@
|
||||
# Copyright 2022 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
values:
|
||||
module.project.google_project.project[0]:
|
||||
auto_create_network: false
|
||||
billing_account: 123456-123456-123456
|
||||
folder_id: '1234567890'
|
||||
labels: null
|
||||
name: my-project
|
||||
org_id: null
|
||||
project_id: my-project
|
||||
skip_delete: false
|
||||
timeouts: null
|
||||
module.project.google_project_iam_policy.authoritative[0]:
|
||||
policy_data: '{"auditConfigs":[{"auditLogConfigs":[{"exemptedMembers":["group:organization-admins@example.org"],"logType":"ADMIN_READ"}],"service":"allServices"},{"auditLogConfigs":[{"logType":"DATA_WRITE"},{"logType":"DATA_READ"}],"service":"storage.googleapis.com"}],"bindings":[{"members":["group:org-admins@example.com"],"role":"roles/owner"},{"members":["group:org-admins@example.com"],"role":"roles/resourcemanager.folderAdmin"},{"members":["group:org-admins@example.com"],"role":"roles/resourcemanager.organizationAdmin"},{"members":["group:org-admins@example.com"],"role":"roles/resourcemanager.projectCreator"}]}'
|
||||
project: my-project
|
||||
|
||||
counts:
|
||||
google_project: 1
|
||||
google_project_iam_policy: 1
|
||||
modules: 1
|
||||
resources: 2
|
||||
46
tests/modules/project/examples/logging-data-access.yaml
Normal file
46
tests/modules/project/examples/logging-data-access.yaml
Normal file
@@ -0,0 +1,46 @@
|
||||
# Copyright 2022 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
values:
|
||||
module.project.google_project.project[0]:
|
||||
auto_create_network: false
|
||||
billing_account: 123456-123456-123456
|
||||
folder_id: '1234567890'
|
||||
labels: null
|
||||
name: my-project
|
||||
org_id: null
|
||||
project_id: my-project
|
||||
skip_delete: false
|
||||
timeouts: null
|
||||
module.project.google_project_iam_audit_config.default["allServices"]:
|
||||
audit_log_config:
|
||||
- exempted_members:
|
||||
- group:organization-admins@example.org
|
||||
log_type: ADMIN_READ
|
||||
project: my-project
|
||||
service: allServices
|
||||
module.project.google_project_iam_audit_config.default["storage.googleapis.com"]:
|
||||
audit_log_config:
|
||||
- exempted_members: []
|
||||
log_type: DATA_READ
|
||||
- exempted_members: []
|
||||
log_type: DATA_WRITE
|
||||
project: my-project
|
||||
service: storage.googleapis.com
|
||||
|
||||
counts:
|
||||
google_project: 1
|
||||
google_project_iam_audit_config: 2
|
||||
modules: 1
|
||||
resources: 3
|
||||
Reference in New Issue
Block a user