-
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.
Add global forwarding rule generation to InSpec (#1319)
Merged PR #1319.
- Loading branch information
1 parent
58c1a72
commit 6e74928
Showing
7 changed files
with
35 additions
and
3 deletions.
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
2 changes: 2 additions & 0 deletions
2
templates/inspec/examples/attributes/google_compute_global_forwarding_rule.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,2 @@ | ||
gcp_project_id = attribute(:gcp_project_id, default: '<%= external_attribute('gcp_project_id') -%>', description: 'The GCP project identifier.') | ||
global_forwarding_rule = attribute('global_forwarding_rule', default: <%= JSON.pretty_generate(grab_attributes['global_forwarding_rule']) -%>, description: 'Compute global forwarding rule definition') |
11 changes: 11 additions & 0 deletions
11
templates/inspec/examples/google_compute_global_forwarding_rule.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,11 @@ | ||
<% gcp_project_id = "#{external_attribute('gcp_project_id', doc_generation)}" -%> | ||
<% global_forwarding_rule = grab_attributes['global_forwarding_rule'] -%> | ||
describe google_compute_global_forwarding_rule(project: <%= doc_generation ? "#{gcp_project_id}" : "gcp_project_id" -%>, name: <%= doc_generation ? "'#{global_forwarding_rule['name']}'" : "global_forwarding_rule['name']" -%>) do | ||
it { should exist } | ||
its('port_range') { should eq <%= doc_generation ? "'#{global_forwarding_rule['port_range']}'" : "global_forwarding_rule['port_range']" -%> } | ||
its('target') { should match /\/<%= "#{grab_attributes['http_proxy']['name']}" -%>$/ } | ||
end | ||
|
||
describe google_compute_global_forwarding_rule(project: <%= doc_generation ? "#{gcp_project_id}" : "gcp_project_id" -%>, name: 'nonexistent') do | ||
it { should_not exist } | ||
end |
6 changes: 6 additions & 0 deletions
6
templates/inspec/examples/google_compute_global_forwarding_rules.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,6 @@ | ||
<% gcp_project_id = "#{external_attribute('gcp_project_id', doc_generation)}" -%> | ||
<% global_forwarding_rule = grab_attributes['global_forwarding_rule'] -%> | ||
describe google_compute_global_forwarding_rules(project: <%= doc_generation ? "#{gcp_project_id}" : "gcp_project_id" -%>) do | ||
its('count') { should be >= 1 } | ||
its('port_ranges') { should include <%= doc_generation ? "'#{global_forwarding_rule['port_range']}'" : "global_forwarding_rule['port_range']" -%> } | ||
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