diff --git a/build/inspec/test/integration/configuration/mm-attributes.yml b/build/inspec/test/integration/configuration/mm-attributes.yml deleted file mode 100644 index e69de29bb..000000000 diff --git a/docs/resources/google_compute_region_network_endpoint_group.md b/docs/resources/google_compute_region_network_endpoint_group.md index 40c050b38..ebb624c7d 100644 --- a/docs/resources/google_compute_region_network_endpoint_group.md +++ b/docs/resources/google_compute_region_network_endpoint_group.md @@ -8,7 +8,7 @@ A `google_compute_region_network_endpoint_group` is used to test a Google Region ## Examples ``` -describe google_compute_region_network_endpoint_group(networkEndpointGroup: ' ', project: 'chef-gcp-inspec', region: ' value_region') do +describe google_compute_region_network_endpoint_group(network_endpoint_group: ' ', project: 'chef-gcp-inspec', region: ' value_region') do it { should exist } its('kind') { should cmp 'value_kind' } its('id') { should cmp 'value_id' } @@ -25,7 +25,7 @@ describe google_compute_region_network_endpoint_group(networkEndpointGroup: ' ', end -describe google_compute_region_network_endpoint_group(networkEndpointGroup: ' ', project: 'chef-gcp-inspec', region: ' value_region') do +describe google_compute_region_network_endpoint_group(network_endpoint_group: ' ', project: 'chef-gcp-inspec', region: ' value_region') do it { should_not exist } end ``` @@ -70,7 +70,7 @@ Properties that can be accessed from the `google_compute_region_network_endpoint * `annotations`: Metadata defined as annotations on the network endpoint group. - * `additional_properties`: + * `additional_properties`: * `cloud_run`: Configuration for a Cloud Run network endpoint group (NEG). The service must be provided explicitly or in the URL mask. The tag is optional, may be provided explicitly or in the URL mask. Note: Cloud Run service must be in the same project and located in the same region as the Serverless NEG. diff --git a/libraries/google_compute_region_network_endpoint_groups.rb b/libraries/google_compute_region_network_endpoint_groups.rb index 414702902..cb7c4a7b6 100644 --- a/libraries/google_compute_region_network_endpoint_groups.rb +++ b/libraries/google_compute_region_network_endpoint_groups.rb @@ -48,7 +48,7 @@ class ComputeRegionNetworkEndpointGroups < GcpResourceBase def initialize(params = {}) super(params.merge({ use_http_transport: true })) @params = params - @table = fetch_wrapped_resource('regionNetworkEndpointGroups') + @table = fetch_wrapped_resource('items') end def fetch_wrapped_resource(wrap_path) @@ -81,25 +81,25 @@ def transform(key, value) def transformers { - 'kind' => ->(obj) { return :kind, obj['kind'] }, - 'id' => ->(obj) { return :id, obj['id'] }, - 'creationTimestamp' => ->(obj) { return :creation_timestamp, obj['creationTimestamp'] }, - 'selfLink' => ->(obj) { return :self_link, obj['selfLink'] }, - 'name' => ->(obj) { return :name, obj['name'] }, - 'description' => ->(obj) { return :description, obj['description'] }, - 'networkEndpointType' => ->(obj) { return :network_endpoint_type, obj['networkEndpointType'] }, - 'size' => ->(obj) { return :size, obj['size'] }, - 'region' => ->(obj) { return :region, obj['region'] }, - 'zone' => ->(obj) { return :zone, obj['zone'] }, - 'network' => ->(obj) { return :network, obj['network'] }, - 'subnetwork' => ->(obj) { return :subnetwork, obj['subnetwork'] }, - 'defaultPort' => ->(obj) { return :default_port, obj['defaultPort'] }, - 'annotations' => ->(obj) { return :annotations, GoogleInSpec::Compute::Property::RegionNetworkEndpointGroupAnnotations.new(obj['annotations'], to_s) }, - 'cloudRun' => ->(obj) { return :cloud_run, GoogleInSpec::Compute::Property::RegionNetworkEndpointGroupCloudRun.new(obj['cloudRun'], to_s) }, - 'appEngine' => ->(obj) { return :app_engine, GoogleInSpec::Compute::Property::RegionNetworkEndpointGroupAppEngine.new(obj['appEngine'], to_s) }, - 'cloudFunction' => ->(obj) { return :cloud_function, GoogleInSpec::Compute::Property::RegionNetworkEndpointGroupCloudFunction.new(obj['cloudFunction'], to_s) }, - 'pscTargetService' => ->(obj) { return :psc_target_service, obj['pscTargetService'] }, - 'pscData' => ->(obj) { return :psc_data, GoogleInSpec::Compute::Property::RegionNetworkEndpointGroupPscData.new(obj['pscData'], to_s) }, + 'kind' => ->(obj) { [:kind, obj['kind']] }, + 'id' => ->(obj) { [:id, obj['id']] }, + 'creationTimestamp' => ->(obj) { [:creation_timestamp, obj['creationTimestamp']] }, + 'selfLink' => ->(obj) { [:self_link, obj['selfLink']] }, + 'name' => ->(obj) { [:name, obj['name']] }, + 'description' => ->(obj) { [:description, obj['description']] }, + 'networkEndpointType' => ->(obj) { [:network_endpoint_type, obj['networkEndpointType']] }, + 'size' => ->(obj) { [:size, obj['size']] }, + 'region' => ->(obj) { [:region, obj['region']] }, + 'zone' => ->(obj) { [:zone, obj['zone']] }, + 'network' => ->(obj) { [:network, obj['network']] }, + 'subnetwork' => ->(obj) { [:subnetwork, obj['subnetwork']] }, + 'defaultPort' => ->(obj) { [:default_port, obj['defaultPort']] }, + 'annotations' => ->(obj) { [:annotations, GoogleInSpec::Compute::Property::RegionNetworkEndpointGroupAnnotations.new(obj['annotations'], to_s)] }, + 'cloudRun' => ->(obj) { [:cloud_run, GoogleInSpec::Compute::Property::RegionNetworkEndpointGroupCloudRun.new(obj['cloudRun'], to_s)] }, + 'appEngine' => ->(obj) { [:app_engine, GoogleInSpec::Compute::Property::RegionNetworkEndpointGroupAppEngine.new(obj['appEngine'], to_s)] }, + 'cloudFunction' => ->(obj) { [:cloud_function, GoogleInSpec::Compute::Property::RegionNetworkEndpointGroupCloudFunction.new(obj['cloudFunction'], to_s)] }, + 'pscTargetService' => ->(obj) { [:psc_target_service, obj['pscTargetService']] }, + 'pscData' => ->(obj) { [:psc_data, GoogleInSpec::Compute::Property::RegionNetworkEndpointGroupPscData.new(obj['pscData'], to_s)] }, } end diff --git a/test/integration/build/gcp-mm.tf b/test/integration/build/gcp-mm.tf index 0d3d82d67..1c4fdb970 100644 --- a/test/integration/build/gcp-mm.tf +++ b/test/integration/build/gcp-mm.tf @@ -239,7 +239,9 @@ variable "organization_envgroup" { variable "vpn_gateway" { type = any } - +variable "region_network_endpoint_group" { + type = any +} resource "google_compute_ssl_policy" "custom-ssl-policy" { name = var.ssl_policy["name"] min_tls_version = var.ssl_policy["min_tls_version"] @@ -1692,3 +1694,9 @@ resource "google_apigee_envgroup_attachment" "engroup_attachment" { envgroup_id = var.apigee_organization_envgroup_attachment.envgroup_id environment = var.apigee_organization_envgroup_attachment.environment } +resource "google_compute_region_network_endpoint_group" "region_network_endpoint_group" { + name = var.region_network_endpoint_group.name + network_endpoint_type = var.region_network_endpoint_group.network_endpoint_type + region = var.region_network_endpoint_group.region + psc_target_service = var.region_network_endpoint_group.target_service +} diff --git a/test/integration/configuration/mm-attributes.yml b/test/integration/configuration/mm-attributes.yml index 8c37d5494..133b45d37 100644 --- a/test/integration/configuration/mm-attributes.yml +++ b/test/integration/configuration/mm-attributes.yml @@ -621,3 +621,9 @@ vpn_gateway: self_link : "value_selflink" label_fingerprint : "value_labelfingerprint" stack_type : "IPV4_ONLY" + +region_network_endpoint_group: + name: "inspec" + region: "us-central1" + network_endpoint_type: "PRIVATE_SERVICE_CONNECT" + target_service: "us-central1-logging.googleapis.com" diff --git a/test/integration/verify/controls/google_compute_region_network_endpoint_group.rb b/test/integration/verify/controls/google_compute_region_network_endpoint_group.rb index 7d72dc2d0..428f33cc6 100644 --- a/test/integration/verify/controls/google_compute_region_network_endpoint_group.rb +++ b/test/integration/verify/controls/google_compute_region_network_endpoint_group.rb @@ -17,7 +17,7 @@ gcp_project_id = input(:gcp_project_id, value: 'gcp_project_id', description: 'The GCP project identifier.') region_network_endpoint_group = input('region_network_endpoint_group', value: { - "network_endpoint_group": "value_networkendpointgroup", + "network_endpoint_group": "apigee-us-west1-xw8iaictllv4", "project": "value_project", "kind": "value_kind", "id": "value_id", @@ -26,7 +26,7 @@ "name": "value_name", "description": "value_description", "network_endpoint_type": "value_networkendpointtype", - "region": "value_region", + "region": "us-west1", "zone": "value_zone", "network": "value_network", "subnetwork": "value_subnetwork", @@ -36,7 +36,7 @@ impact 1.0 title 'google_compute_region_network_endpoint_group resource test' - describe google_compute_region_network_endpoint_group(networkEndpointGroup: region_network_endpoint_group['networkEndpointGroup'], project: gcp_project_id, region: region_network_endpoint_group['region']) do + describe google_compute_region_network_endpoint_group(network_endpoint_group: region_network_endpoint_group['network_endpoint_group'], project: gcp_project_id, region: region_network_endpoint_group['region']) do it { should exist } its('kind') { should cmp region_network_endpoint_group['kind'] } its('id') { should cmp region_network_endpoint_group['id'] } @@ -53,7 +53,7 @@ end - describe google_compute_region_network_endpoint_group(networkEndpointGroup: region_network_endpoint_group['networkEndpointGroup'], project: gcp_project_id, region: region_network_endpoint_group['region']) do + describe google_compute_region_network_endpoint_group(network_endpoint_group: region_network_endpoint_group['network_endpoint_group'], project: gcp_project_id, region: region_network_endpoint_group['region']) do it { should_not exist } end end diff --git a/test/integration/verify/controls/google_compute_region_network_endpoint_groups.rb b/test/integration/verify/controls/google_compute_region_network_endpoint_groups.rb index 3aacfbe4e..fd21b3c1e 100644 --- a/test/integration/verify/controls/google_compute_region_network_endpoint_groups.rb +++ b/test/integration/verify/controls/google_compute_region_network_endpoint_groups.rb @@ -17,7 +17,7 @@ gcp_project_id = input(:gcp_project_id, value: 'gcp_project_id', description: 'The GCP project identifier.') region_network_endpoint_group = input('region_network_endpoint_group', value: { - "network_endpoint_group": "value_networkendpointgroup", + "network_endpoint_group": "apigee-us-west1-xw8iaictllv4", "project": "value_project", "kind": "value_kind", "id": "value_id", @@ -26,7 +26,7 @@ "name": "value_name", "description": "value_description", "network_endpoint_type": "value_networkendpointtype", - "region": "value_region", + "region": "us-west1", "zone": "value_zone", "network": "value_network", "subnetwork": "value_subnetwork",