Skip to content

Commit

Permalink
update attributed and add tf scripts
Browse files Browse the repository at this point in the history
Signed-off-by: balasubramanian-s <balasubramanian.s@progress.com>
  • Loading branch information
balasubramanian-s committed Jan 17, 2024
1 parent 6f14306 commit bd7c67d
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 30 deletions.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
Expand All @@ -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
```
Expand Down Expand Up @@ -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.

Expand Down
40 changes: 20 additions & 20 deletions libraries/google_compute_region_network_endpoint_groups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down
10 changes: 9 additions & 1 deletion test/integration/build/gcp-mm.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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
}
6 changes: 6 additions & 0 deletions test/integration/configuration/mm-attributes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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'] }
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit bd7c67d

Please sign in to comment.