Skip to content

Commit

Permalink
Updated with main
Browse files Browse the repository at this point in the history
Signed-off-by: Samir <[email protected]>
  • Loading branch information
sa-progress committed Apr 29, 2024
2 parents 09d2f5f + 7b0bfec commit be73074
Show file tree
Hide file tree
Showing 15 changed files with 3,833 additions and 309 deletions.
3,618 changes: 3,606 additions & 12 deletions mmv1/products/compute/api.yaml

Large diffs are not rendered by default.

10 changes: 0 additions & 10 deletions mmv1/products/compute/inspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides
override_name: "region_name"
status: !ruby/object:Overrides::Inspec::PropertyOverride
override_name: "region_status"
RegionAutoscaler: !ruby/object:Overrides::Inspec::ResourceOverride
exclude: true
RegionDisk: !ruby/object:Overrides::Inspec::ResourceOverride
exclude: true
RegionDiskType: !ruby/object:Overrides::Inspec::ResourceOverride
Expand All @@ -153,16 +151,8 @@ overrides: !ruby/object:Overrides::ResourceOverrides
override_name: "instance_group_manager_name"
RegionSslCertificate: !ruby/object:Overrides::Inspec::ResourceOverride
exclude: true
RegionTargetHttpProxy: !ruby/object:Overrides::Inspec::ResourceOverride
exclude: true
RegionTargetHttpsProxy: !ruby/object:Overrides::Inspec::ResourceOverride
exclude: true
RegionUrlMap: !ruby/object:Overrides::Inspec::ResourceOverride
exclude: true
Reservation: !ruby/object:Overrides::Inspec::ResourceOverride
exclude: true
ResourcePolicy: !ruby/object:Overrides::Inspec::ResourceOverride
exclude: true
RouterBgpPeer: !ruby/object:Overrides::Inspec::ResourceOverride
exclude: true
Subnetwork: !ruby/object:Overrides::Inspec::ResourceOverride
Expand Down
289 changes: 2 additions & 287 deletions mmv1/products/orgpolicy/api.yaml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions mmv1/products/orgpolicy/inspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@

--- !ruby/object:Provider::Inspec::Config
overrides: !ruby/object:Overrides::ResourceOverrides
OrganizationConstraint: !ruby/object:Overrides::Inspec::ResourceOverride
singular_only: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<% gcp_project_id = "#{external_attribute(pwd, 'gcp_project_id', doc_generation)}" -%>
<% packet_mirroring = grab_attributes(pwd)['packet_mirroring'] -%>
describe google_compute_packet_mirroring(packetMirroring: <%= doc_generation ? "' #{packet_mirroring['packetMirroring']}'":"packet_mirroring['packetMirroring']" -%>, project: <%= gcp_project_id -%>, region: <%= doc_generation ? "' #{packet_mirroring['region']}'":"packet_mirroring['region']" -%>) do
it { should exist }
its('kind') { should cmp <%= doc_generation ? "'#{packet_mirroring['kind']}'" : "packet_mirroring['kind']" -%> }
its('id') { should cmp <%= doc_generation ? "'#{packet_mirroring['id']}'" : "packet_mirroring['id']" -%> }
its('creation_timestamp') { should cmp <%= doc_generation ? "'#{packet_mirroring['creation_timestamp']}'" : "packet_mirroring['creation_timestamp']" -%> }
its('self_link') { should cmp <%= doc_generation ? "'#{packet_mirroring['self_link']}'" : "packet_mirroring['self_link']" -%> }
its('self_link_with_id') { should cmp <%= doc_generation ? "'#{packet_mirroring['self_link_with_id']}'" : "packet_mirroring['self_link_with_id']" -%> }
its('name') { should cmp <%= doc_generation ? "'#{packet_mirroring['name']}'" : "packet_mirroring['name']" -%> }
its('description') { should cmp <%= doc_generation ? "'#{packet_mirroring['description']}'" : "packet_mirroring['description']" -%> }
its('region') { should cmp <%= doc_generation ? "'#{packet_mirroring['region']}'" : "packet_mirroring['region']" -%> }
its('enable') { should cmp <%= doc_generation ? "'#{packet_mirroring['enable']}'" : "packet_mirroring['enable']" -%> }

end

describe google_compute_packet_mirroring(packetMirroring: <%= doc_generation ? "' #{packet_mirroring['packetMirroring']}'":"packet_mirroring['packetMirroring']" -%>, project: <%= gcp_project_id -%>, region: <%= doc_generation ? "' #{packet_mirroring['region']}'":"packet_mirroring['region']" -%>) do
it { should_not exist }
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
gcp_project_id = input(:gcp_project_id, value: '<%= external_attribute(pwd, 'gcp_project_id') -%>', description: 'The GCP project identifier.')

packet_mirroring = input('packet_mirroring', value: <%= JSON.pretty_generate(grab_attributes(pwd)['packet_mirroring']) -%>, description: 'packet_mirroring description')
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<% gcp_project_id = "#{external_attribute(pwd, 'gcp_project_id', doc_generation)}" -%>
<% packet_mirroring = grab_attributes(pwd)['packet_mirroring'] -%>
describe google_compute_packet_mirrorings(project: <%= gcp_project_id -%>, region: <%= doc_generation ? "' #{packet_mirroring['region']}'":"packet_mirroring['region']" -%>) do
it { should exist }
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<% gcp_project_id = "#{external_attribute(pwd, 'gcp_project_id', doc_generation)}" -%>
<% region_security_policy = grab_attributes(pwd)['region_security_policy'] -%>
describe google_compute_region_security_policy(project: <%= gcp_project_id -%>, region: <%= doc_generation ? "' #{region_security_policy['region']}'":"region_security_policy['region']" -%>) do
it { should exist }
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<% gcp_project_id = "#{external_attribute(pwd, 'gcp_project_id', doc_generation)}" -%>
<% region_security_policy = grab_attributes(pwd)['region_security_policy'] -%>
describe google_compute_region_security_policy(project: <%= gcp_project_id -%>, region: <%= doc_generation ? "' #{region_security_policy['region']}'":"region_security_policy['region']" -%>, securityPolicy: <%= doc_generation ? "' #{region_security_policy['securityPolicy']}'":"region_security_policy['securityPolicy']" -%>) do
it { should exist }
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
gcp_project_id = input(:gcp_project_id, value: '<%= external_attribute(pwd, 'gcp_project_id') -%>', description: 'The GCP project identifier.')

region_security_policy = input('region_security_policy', value: <%= JSON.pretty_generate(grab_attributes(pwd)['region_security_policy']) -%>, description: 'region_security_policy description')
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<% gcp_project_id = "#{external_attribute(pwd, 'gcp_project_id', doc_generation)}" -%>
<% resource_policy = grab_attributes(pwd)['resource_policy'] -%>
describe google_compute_resource_policies(project: <%= gcp_project_id -%>, region: <%= doc_generation ? "' #{resource_policy['region']}'":"resource_policy['region']" -%>) do
it { should exist }
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<% gcp_project_id = "#{external_attribute(pwd, 'gcp_project_id', doc_generation)}" -%>
<% resource_policy = grab_attributes(pwd)['resource_policy'] -%>
describe google_compute_resource_policy(project: <%= gcp_project_id -%>, region: <%= doc_generation ? "' #{resource_policy['region']}'":"resource_policy['region']" -%>, resourcePolicy: <%= doc_generation ? "' #{resource_policy['resourcePolicy']}'":"resource_policy['resourcePolicy']" -%>) do
it { should exist }
its('kind') { should cmp <%= doc_generation ? "'#{resource_policy['kind']}'" : "resource_policy['kind']" -%> }
its('id') { should cmp <%= doc_generation ? "'#{resource_policy['id']}'" : "resource_policy['id']" -%> }
its('creation_timestamp') { should cmp <%= doc_generation ? "'#{resource_policy['creation_timestamp']}'" : "resource_policy['creation_timestamp']" -%> }
its('self_link') { should cmp <%= doc_generation ? "'#{resource_policy['self_link']}'" : "resource_policy['self_link']" -%> }
its('self_link_with_id') { should cmp <%= doc_generation ? "'#{resource_policy['self_link_with_id']}'" : "resource_policy['self_link_with_id']" -%> }
its('region') { should cmp <%= doc_generation ? "'#{resource_policy['region']}'" : "resource_policy['region']" -%> }
its('description') { should cmp <%= doc_generation ? "'#{resource_policy['description']}'" : "resource_policy['description']" -%> }
its('name') { should cmp <%= doc_generation ? "'#{resource_policy['name']}'" : "resource_policy['name']" -%> }
its('status') { should cmp <%= doc_generation ? "'#{resource_policy['status']}'" : "resource_policy['status']" -%> }

end

describe google_compute_resource_policy(project: <%= gcp_project_id -%>, region: <%= doc_generation ? "' #{resource_policy['region']}'":"resource_policy['region']" -%>, resourcePolicy: <%= doc_generation ? "' #{resource_policy['resourcePolicy']}'":"resource_policy['resourcePolicy']" -%>) do
it { should_not exist }
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
gcp_project_id = input(:gcp_project_id, value: '<%= external_attribute(pwd, 'gcp_project_id') -%>', description: 'The GCP project identifier.')

resource_policy = input('resource_policy', value: <%= JSON.pretty_generate(grab_attributes(pwd)['resource_policy']) -%>, description: 'resource_policy description')
130 changes: 130 additions & 0 deletions mmv1/templates/inspec/tests/integration/build/gcp-mm.tf
Original file line number Diff line number Diff line change
Expand Up @@ -1346,6 +1346,82 @@ resource "google_data_loss_prevention_stored_info_type" "basic" {
}
}

resource "google_compute_region_security_policy" "default" {
provider = google-beta

region = "us-west2"
name = "policyruletest-${local.name_suffix}"
description = "basic region security policy"
type = "CLOUD_ARMOR"
}

resource "google_compute_region_security_policy_rule" "policy_rule" {
provider = google-beta

region = "us-west2"
security_policy = google_compute_region_security_policy.default.name
description = "new rule"
priority = 100
match {
versioned_expr = "SRC_IPS_V1"
config {
src_ip_ranges = ["10.10.0.0/16"]
}
}
action = "allow"
preview = true
}


resource "google_compute_region_security_policy" "default" {
provider = google-beta

region = "us-west2"
name = "policyruletest-${local.name_suffix}"
description = "basic region security policy"
type = "CLOUD_ARMOR"
}

resource "google_compute_region_security_policy_rule" "policy_rule" {
provider = google-beta

region = "us-west2"
security_policy = google_compute_region_security_policy.default.name
description = "new rule"
priority = 100
match {
versioned_expr = "SRC_IPS_V1"
config {
src_ip_ranges = ["10.10.0.0/16"]
}
}
action = "allow"
preview = true
}


resource "google_compute_interconnect_attachment" "on_prem" {
name = "on-prem-attachment-${local.name_suffix}"
edge_availability_domain = "AVAILABILITY_DOMAIN_1"
type = "PARTNER"
router = google_compute_router.foobar.id
mtu = 1500
}

resource "google_compute_router" "foobar" {
name = "router-1-${local.name_suffix}"
network = google_compute_network.foobar.name
bgp {
asn = 16550
}
}

resource "google_compute_network" "foobar" {
name = "network-1-${local.name_suffix}"
auto_create_subnetworks = false
}





Expand Down Expand Up @@ -1551,3 +1627,57 @@ resource "google_datastore_index" "default" {
}
}


resource "google_compute_region_security_policy" "default" {
provider = google-beta

region = "us-west2"
name = "policyruletest-${local.name_suffix}"
description = "basic region security policy"
type = "CLOUD_ARMOR"
}

resource "google_compute_region_security_policy_rule" "policy_rule" {
provider = google-beta

region = "us-west2"
security_policy = google_compute_region_security_policy.default.name
description = "new rule"
priority = 100
match {
versioned_expr = "SRC_IPS_V1"
config {
src_ip_ranges = ["10.10.0.0/16"]
}
}
action = "allow"
preview = true
}


resource "google_compute_region_security_policy" "default" {
provider = google-beta

region = "us-west2"
name = "policyruletest-${local.name_suffix}"
description = "basic region security policy"
type = "CLOUD_ARMOR"
}

resource "google_compute_region_security_policy_rule" "policy_rule" {
provider = google-beta

region = "us-west2"
security_policy = google_compute_region_security_policy.default.name
description = "new rule"
priority = 100
match {
versioned_expr = "SRC_IPS_V1"
config {
src_ip_ranges = ["10.10.0.0/16"]
}
}
action = "allow"
preview = true
}

Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,18 @@ node_type:
description : "value_description"
cpu_platform : "value_cpuplatform"
self_link : "value_selflink"
packet_mirroring:
packet_mirroring : "value_packetmirroring"
project : "value_project"
region : "value_region"
kind : "value_kind"
id : "value_id"
creation_timestamp : "value_creationtimestamp"
self_link : "value_selflink"
self_link_with_id : "value_selflinkwithid"
name : "value_name"
description : "value_description"
enable : "value_enable"
region_disk_type:
disk_type : "value_disktype"
project : "value_project"
Expand All @@ -1105,6 +1117,20 @@ region_disk_type:
zone : "value_zone"
self_link : "value_selflink"
default_disk_size_gb : "value_defaultdisksizegb"
resource_policy:
project : "value_project"
region : "value_region"
resource_policy : "value_resourcepolicy"
kind : "value_kind"
id : "value_id"
creation_timestamp : "value_creationtimestamp"
self_link : "value_selflink"
self_link_with_id : "value_selflinkwithid"
description : "value_description"
name : "value_name"
status : "value_status"
region_security_policy:
securitypolicy : "value_securitypolicy"
interconnect_attachment:
interconnect_attachment : "value_interconnectattachment"
project : "value_project"
Expand Down

0 comments on commit be73074

Please sign in to comment.