Skip to content

Commit

Permalink
Support ignore_read on nested fields (#10639) (#7400)
Browse files Browse the repository at this point in the history
[upstream:428508734e366159823eda04e20ccffead07eeaa]

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored May 21, 2024
1 parent 6ced89d commit b081e8c
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ func TestAccComputeBackendService_backendServiceBasicExample(t *testing.T) {
Config: testAccComputeBackendService_backendServiceBasicExample(context),
},
{
ResourceName: "google_compute_backend_service.default",
ImportState: true,
ImportStateVerify: true,
ResourceName: "google_compute_backend_service.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"iap.0.oauth2_client_secret"},
},
},
})
Expand Down Expand Up @@ -125,9 +126,10 @@ func TestAccComputeBackendService_backendServiceCacheSimpleExample(t *testing.T)
Config: testAccComputeBackendService_backendServiceCacheSimpleExample(context),
},
{
ResourceName: "google_compute_backend_service.default",
ImportState: true,
ImportStateVerify: true,
ResourceName: "google_compute_backend_service.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"iap.0.oauth2_client_secret"},
},
},
})
Expand Down Expand Up @@ -169,9 +171,10 @@ func TestAccComputeBackendService_backendServiceCacheIncludeHttpHeadersExample(t
Config: testAccComputeBackendService_backendServiceCacheIncludeHttpHeadersExample(context),
},
{
ResourceName: "google_compute_backend_service.default",
ImportState: true,
ImportStateVerify: true,
ResourceName: "google_compute_backend_service.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"iap.0.oauth2_client_secret"},
},
},
})
Expand Down Expand Up @@ -211,9 +214,10 @@ func TestAccComputeBackendService_backendServiceCacheIncludeNamedCookiesExample(
Config: testAccComputeBackendService_backendServiceCacheIncludeNamedCookiesExample(context),
},
{
ResourceName: "google_compute_backend_service.default",
ImportState: true,
ImportStateVerify: true,
ResourceName: "google_compute_backend_service.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"iap.0.oauth2_client_secret"},
},
},
})
Expand Down Expand Up @@ -256,9 +260,10 @@ func TestAccComputeBackendService_backendServiceCacheExample(t *testing.T) {
Config: testAccComputeBackendService_backendServiceCacheExample(context),
},
{
ResourceName: "google_compute_backend_service.default",
ImportState: true,
ImportStateVerify: true,
ResourceName: "google_compute_backend_service.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"iap.0.oauth2_client_secret"},
},
},
})
Expand Down Expand Up @@ -305,9 +310,10 @@ func TestAccComputeBackendService_backendServiceCacheBypassCacheOnRequestHeaders
Config: testAccComputeBackendService_backendServiceCacheBypassCacheOnRequestHeadersExample(context),
},
{
ResourceName: "google_compute_backend_service.default",
ImportState: true,
ImportStateVerify: true,
ResourceName: "google_compute_backend_service.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"iap.0.oauth2_client_secret"},
},
},
})
Expand Down Expand Up @@ -362,9 +368,10 @@ func TestAccComputeBackendService_backendServiceTrafficDirectorRoundRobinExample
Config: testAccComputeBackendService_backendServiceTrafficDirectorRoundRobinExample(context),
},
{
ResourceName: "google_compute_backend_service.default",
ImportState: true,
ImportStateVerify: true,
ResourceName: "google_compute_backend_service.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"iap.0.oauth2_client_secret"},
},
},
})
Expand Down Expand Up @@ -408,9 +415,10 @@ func TestAccComputeBackendService_backendServiceTrafficDirectorRingHashExample(t
Config: testAccComputeBackendService_backendServiceTrafficDirectorRingHashExample(context),
},
{
ResourceName: "google_compute_backend_service.default",
ImportState: true,
ImportStateVerify: true,
ResourceName: "google_compute_backend_service.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"iap.0.oauth2_client_secret"},
},
},
})
Expand Down Expand Up @@ -470,9 +478,10 @@ func TestAccComputeBackendService_backendServiceNetworkEndpointExample(t *testin
Config: testAccComputeBackendService_backendServiceNetworkEndpointExample(context),
},
{
ResourceName: "google_compute_backend_service.default",
ImportState: true,
ImportStateVerify: true,
ResourceName: "google_compute_backend_service.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"iap.0.oauth2_client_secret"},
},
},
})
Expand Down Expand Up @@ -527,9 +536,10 @@ func TestAccComputeBackendService_backendServiceExternalManagedExample(t *testin
Config: testAccComputeBackendService_backendServiceExternalManagedExample(context),
},
{
ResourceName: "google_compute_backend_service.default",
ImportState: true,
ImportStateVerify: true,
ResourceName: "google_compute_backend_service.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"iap.0.oauth2_client_secret"},
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestAccComputeRegionBackendService_regionBackendServiceBasicExample(t *test
ResourceName: "google_compute_region_backend_service.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"network", "region"},
ImportStateVerifyIgnore: []string{"iap.0.oauth2_client_secret", "network", "region"},
},
},
})
Expand Down Expand Up @@ -136,7 +136,7 @@ func TestAccComputeRegionBackendService_regionBackendServiceCacheExample(t *test
ResourceName: "google_compute_region_backend_service.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"network", "region"},
ImportStateVerifyIgnore: []string{"iap.0.oauth2_client_secret", "network", "region"},
},
},
})
Expand Down Expand Up @@ -197,7 +197,7 @@ func TestAccComputeRegionBackendService_regionBackendServiceIlbRoundRobinExample
ResourceName: "google_compute_region_backend_service.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"network", "region"},
ImportStateVerifyIgnore: []string{"iap.0.oauth2_client_secret", "network", "region"},
},
},
})
Expand Down Expand Up @@ -242,7 +242,7 @@ func TestAccComputeRegionBackendService_regionBackendServiceExternalExample(t *t
ResourceName: "google_compute_region_backend_service.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"network", "region"},
ImportStateVerifyIgnore: []string{"iap.0.oauth2_client_secret", "network", "region"},
},
},
})
Expand Down Expand Up @@ -290,7 +290,7 @@ func TestAccComputeRegionBackendService_regionBackendServiceExternalWeightedExam
ResourceName: "google_compute_region_backend_service.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"network", "region"},
ImportStateVerifyIgnore: []string{"iap.0.oauth2_client_secret", "network", "region"},
},
},
})
Expand Down Expand Up @@ -337,7 +337,7 @@ func TestAccComputeRegionBackendService_regionBackendServiceIlbRingHashExample(t
ResourceName: "google_compute_region_backend_service.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"network", "region"},
ImportStateVerifyIgnore: []string{"iap.0.oauth2_client_secret", "network", "region"},
},
},
})
Expand Down Expand Up @@ -398,7 +398,7 @@ func TestAccComputeRegionBackendService_regionBackendServiceBalancingModeExample
ResourceName: "google_compute_region_backend_service.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"network", "region"},
ImportStateVerifyIgnore: []string{"iap.0.oauth2_client_secret", "network", "region"},
},
},
})
Expand Down Expand Up @@ -499,7 +499,7 @@ func TestAccComputeRegionBackendService_regionBackendServiceConnectionTrackingEx
ResourceName: "google_compute_region_backend_service.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"network", "region"},
ImportStateVerifyIgnore: []string{"iap.0.oauth2_client_secret", "network", "region"},
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestAccComputeSnapshot_snapshotBasicExample(t *testing.T) {
ResourceName: "google_compute_snapshot.snapshot",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"labels", "source_disk", "source_disk_encryption_key", "terraform_labels", "zone"},
ImportStateVerifyIgnore: []string{"labels", "snapshot_encryption_key.0.raw_key", "source_disk", "source_disk_encryption_key", "terraform_labels", "zone"},
},
},
})
Expand Down Expand Up @@ -101,7 +101,7 @@ func TestAccComputeSnapshot_snapshotChainnameExample(t *testing.T) {
ResourceName: "google_compute_snapshot.snapshot",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"labels", "source_disk", "source_disk_encryption_key", "terraform_labels", "zone"},
ImportStateVerifyIgnore: []string{"labels", "snapshot_encryption_key.0.raw_key", "source_disk", "source_disk_encryption_key", "terraform_labels", "zone"},
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestAccDialogflowCXAgent_dialogflowcxAgentFullExample(t *testing.T) {
ResourceName: "google_dialogflow_cx_agent.full_agent",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"git_integration_settings.0.github_settings.0.access_token", "location"},
ImportStateVerifyIgnore: []string{"git_integration_settings.0.github_settings.0.access_token", "git_integration_settings.0.github_settings.0.access_token", "location"},
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ func TestAccDataSourceVertexAIIndex_basic(t *testing.T) {
"google_vertex_ai_index.index",
// The projects.locations.indexes.get doesn't return the following fields
map[string]struct{}{
"metadata.0.contents_delta_uri": {},
"metadata.0.is_complete_overwrite": {},
"metadata.0.config.0.feature_norm_type": {},
"metadata.0.contents_delta_uri": {},
"metadata.0.is_complete_overwrite": {},
},
),
),
Expand Down
2 changes: 1 addition & 1 deletion google-beta/services/vertexai/resource_vertex_ai_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ func flattenVertexAIIndexMetadataConfigDistanceMeasureType(v interface{}, d *sch
}

func flattenVertexAIIndexMetadataConfigFeatureNormType(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
return d.Get("metadata.0.config.0.feature_norm_type")
}

func flattenVertexAIIndexMetadataConfigAlgorithmConfig(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func TestAccVertexAIIndex_vertexAiIndexExample(t *testing.T) {
ResourceName: "google_vertex_ai_index.index",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"etag", "labels", "metadata.0.contents_delta_uri", "metadata.0.is_complete_overwrite", "region", "terraform_labels"},
ImportStateVerifyIgnore: []string{"etag", "labels", "metadata.0.config.0.feature_norm_type", "metadata.0.contents_delta_uri", "metadata.0.is_complete_overwrite", "region", "terraform_labels"},
},
},
})
Expand Down Expand Up @@ -123,7 +123,7 @@ func TestAccVertexAIIndex_vertexAiIndexStreamingExample(t *testing.T) {
ResourceName: "google_vertex_ai_index.index",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"etag", "labels", "metadata.0.contents_delta_uri", "metadata.0.is_complete_overwrite", "region", "terraform_labels"},
ImportStateVerifyIgnore: []string{"etag", "labels", "metadata.0.config.0.feature_norm_type", "metadata.0.contents_delta_uri", "metadata.0.is_complete_overwrite", "region", "terraform_labels"},
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestAccVertexAIIndex_updated(t *testing.T) {
ResourceName: "google_vertex_ai_index.index",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"etag", "region", "metadata.0.contents_delta_uri", "metadata.0.is_complete_overwrite", "labels", "terraform_labels"},
ImportStateVerifyIgnore: []string{"etag", "region", "metadata.0.contents_delta_uri", "metadata.0.is_complete_overwrite", "metadata.0.config.0.feature_norm_type", "labels", "terraform_labels"},
},
{
Config: testAccVertexAIIndex_updated(context),
Expand All @@ -45,7 +45,7 @@ func TestAccVertexAIIndex_updated(t *testing.T) {
ResourceName: "google_vertex_ai_index.index",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"etag", "region", "metadata.0.contents_delta_uri", "metadata.0.is_complete_overwrite", "labels", "terraform_labels"},
ImportStateVerifyIgnore: []string{"etag", "region", "metadata.0.contents_delta_uri", "metadata.0.is_complete_overwrite", "metadata.0.config.0.feature_norm_type", "labels", "terraform_labels"},
},
},
})
Expand Down

0 comments on commit b081e8c

Please sign in to comment.