-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
InSpec Folder log sink resource (#2419)
Merged PR #2419.
- Loading branch information
1 parent
0b1345c
commit ec5e46c
Showing
9 changed files
with
93 additions
and
1 deletion.
There are no files selected for viewing
Submodule inspec
updated
8 files
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
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
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
13 changes: 13 additions & 0 deletions
13
templates/inspec/examples/google_logging_folder_log_sink/google_logging_folder_log_sink.erb
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,13 @@ | ||
<% gcp_organization_id = "#{external_attribute('gcp_organization_id', doc_generation)}" -%> | ||
<% folder_sink = grab_attributes['folder_sink'] -%> | ||
# Getting folder sinks is complicated due to the name being generated by the server. | ||
# This can be drastically simplified if you have the folder name when writing the test | ||
describe.one do | ||
google_resourcemanager_folders(parent: <%= doc_generation ? "'organizations/12345'" : "\"organizations/\#{gcp_organization_id}\"" -%>).names.each do |folder_name| | ||
# name on a folder is in the form `folders/12345` | ||
describe google_logging_folder_log_sink(folder: folder_name.split('/')[1], name: <%= doc_generation ? "'#{folder_sink['name']}'" : "folder_sink['name']" -%>) do | ||
it { should exist } | ||
its('filter') { should cmp <%= doc_generation ? "'#{folder_sink['filter']}'" : "folder_sink['filter']" -%> } | ||
end | ||
end | ||
end |
3 changes: 3 additions & 0 deletions
3
...pec/examples/google_logging_folder_log_sink/google_logging_folder_log_sink_attributes.erb
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,3 @@ | ||
folder_sink = attribute('folder_sink', default: <%= grab_attributes['folder_sink'] -%>) | ||
gcp_organization_id = attribute(:gcp_organization_id, default: <%= external_attribute('gcp_organization_id') -%>, description: 'The identifier of the organization that is the parent of the folder') | ||
gcp_enable_privileged_resources = attribute(:gcp_enable_privileged_resources, default:0, description:'Flag to enable privileged resources requiring elevated privileges in GCP.') |
13 changes: 13 additions & 0 deletions
13
templates/inspec/examples/google_logging_folder_log_sink/google_logging_folder_log_sinks.erb
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,13 @@ | ||
<% gcp_organization_id = "#{external_attribute('gcp_organization_id', doc_generation)}" -%> | ||
<% folder_sink = grab_attributes['folder_sink'] -%> | ||
# Getting folder sinks is complicated due to the name being generated by the server. | ||
# This can be drastically simplified if you have the folder name when writing the test | ||
describe.one do | ||
google_resourcemanager_folders(parent: <%= doc_generation ? "'organizations/12345'" : "\"organizations/\#{gcp_organization_id}\"" -%>).names.each do |folder_name| | ||
# name on a folder is in the form `folders/12345` | ||
describe google_logging_folder_log_sinks(folder: folder_name.split('/')[1]) do | ||
its('names') { should include <%= doc_generation ? "'#{folder_sink['name']}'" : "folder_sink['name']" -%> } | ||
its('filters') { should include <%= doc_generation ? "'#{folder_sink['filter']}'" : "folder_sink['filter']" -%> } | ||
end | ||
end | ||
end |
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
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