From a83ce83f5c6dcc292e4dc7cbe8fb219f5572a3df Mon Sep 17 00:00:00 2001 From: sundowndev Date: Fri, 17 Dec 2021 11:44:02 +0400 Subject: [PATCH] fix(google): compute_subnetwork The scan panics because enumerator attributes are not sync with the resource schema. --- pkg/remote/google/google_compute_subnetwork_enumerator.go | 4 ++-- pkg/resource/google/google_compute_subnetwork.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/remote/google/google_compute_subnetwork_enumerator.go b/pkg/remote/google/google_compute_subnetwork_enumerator.go index 9bd852d3..307eee79 100644 --- a/pkg/remote/google/google_compute_subnetwork_enumerator.go +++ b/pkg/remote/google/google_compute_subnetwork_enumerator.go @@ -38,8 +38,8 @@ func (e *GoogleComputeSubnetworkEnumerator) Enumerate() ([]*resource.Resource, e string(e.SupportedType()), trimResourceName(res.GetName()), map[string]interface{}{ - "name": res.GetDisplayName(), - "location": res.GetLocation(), + "name": res.GetDisplayName(), + "region": res.GetLocation(), }, ), ) diff --git a/pkg/resource/google/google_compute_subnetwork.go b/pkg/resource/google/google_compute_subnetwork.go index dfcff587..8497fad4 100644 --- a/pkg/resource/google/google_compute_subnetwork.go +++ b/pkg/resource/google/google_compute_subnetwork.go @@ -8,7 +8,7 @@ func initGoogleComputeSubnetworkMetadata(resourceSchemaRepository resource.Schem resourceSchemaRepository.SetResolveReadAttributesFunc(GoogleComputeSubnetworkResourceType, func(res *resource.Resource) map[string]string { return map[string]string{ "name": *res.Attributes().GetString("name"), - "region": *res.Attributes().GetString("location"), + "region": *res.Attributes().GetString("region"), } }) resourceSchemaRepository.SetNormalizeFunc(GoogleComputeSubnetworkResourceType, func(res *resource.Resource) {