From 707dd95968af2f24bfcb10ca54afc32b4e7991cb Mon Sep 17 00:00:00 2001 From: Chris Stephens Date: Fri, 16 Nov 2018 20:47:11 +0000 Subject: [PATCH] Ignore empty maps inside arrays --- .../resource_binaryauthorization_attestor.go | 7 ++++ .../resource_binaryauthorization_policy.go | 7 ++++ google-beta/resource_compute_autoscaler.go | 13 +++++++ google-beta/resource_compute_disk.go | 9 +++++ google-beta/resource_compute_firewall.go | 8 +++++ google-beta/resource_compute_health_check.go | 12 +++++++ ...esource_compute_interconnect_attachment.go | 3 ++ .../resource_compute_region_autoscaler.go | 13 +++++++ google-beta/resource_compute_region_disk.go | 6 ++++ google-beta/resource_compute_router.go | 7 ++++ google-beta/resource_compute_subnetwork.go | 4 +++ google-beta/resource_compute_url_map.go | 16 +++++++++ .../resource_containeranalysis_note.go | 6 ++++ google-beta/resource_filestore_instance.go | 8 +++++ .../resource_monitoring_alert_policy.go | 34 +++++++++++++++++++ ...e_storage_default_object_access_control.go | 3 ++ .../resource_storage_object_access_control.go | 3 ++ 17 files changed, 159 insertions(+) diff --git a/google-beta/resource_binaryauthorization_attestor.go b/google-beta/resource_binaryauthorization_attestor.go index 8d1d90ede4..5124b857e4 100644 --- a/google-beta/resource_binaryauthorization_attestor.go +++ b/google-beta/resource_binaryauthorization_attestor.go @@ -259,6 +259,9 @@ func flattenBinaryAuthorizationAttestorAttestationAuthorityNote(v interface{}) i return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["note_reference"] = flattenBinaryAuthorizationAttestorAttestationAuthorityNoteNoteReference(original["noteReference"]) @@ -280,6 +283,10 @@ func flattenBinaryAuthorizationAttestorAttestationAuthorityNotePublicKeys(v inte transformed := make([]interface{}, 0, len(l)) for _, raw := range l { original := raw.(map[string]interface{}) + if len(original) < 1 { + // Do not include empty json objects coming back from the api + continue + } transformed = append(transformed, map[string]interface{}{ "comment": flattenBinaryAuthorizationAttestorAttestationAuthorityNotePublicKeysComment(original["comment"]), "id": flattenBinaryAuthorizationAttestorAttestationAuthorityNotePublicKeysId(original["id"]), diff --git a/google-beta/resource_binaryauthorization_policy.go b/google-beta/resource_binaryauthorization_policy.go index 5bc0e01417..21120eac2c 100644 --- a/google-beta/resource_binaryauthorization_policy.go +++ b/google-beta/resource_binaryauthorization_policy.go @@ -332,6 +332,10 @@ func flattenBinaryAuthorizationPolicyAdmissionWhitelistPatterns(v interface{}) i transformed := make([]interface{}, 0, len(l)) for _, raw := range l { original := raw.(map[string]interface{}) + if len(original) < 1 { + // Do not include empty json objects coming back from the api + continue + } transformed = append(transformed, map[string]interface{}{ "name_pattern": flattenBinaryAuthorizationPolicyAdmissionWhitelistPatternsNamePattern(original["namePattern"]), }) @@ -379,6 +383,9 @@ func flattenBinaryAuthorizationPolicyDefaultAdmissionRule(v interface{}) interfa return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["evaluation_mode"] = flattenBinaryAuthorizationPolicyDefaultAdmissionRuleEvaluationMode(original["evaluationMode"]) diff --git a/google-beta/resource_compute_autoscaler.go b/google-beta/resource_compute_autoscaler.go index 972afe25aa..5dd92ddcd2 100644 --- a/google-beta/resource_compute_autoscaler.go +++ b/google-beta/resource_compute_autoscaler.go @@ -417,6 +417,9 @@ func flattenComputeAutoscalerAutoscalingPolicy(v interface{}) interface{} { return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["min_replicas"] = flattenComputeAutoscalerAutoscalingPolicyMinReplicas(original["minNumReplicas"]) @@ -467,6 +470,9 @@ func flattenComputeAutoscalerAutoscalingPolicyCpuUtilization(v interface{}) inte return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["target"] = flattenComputeAutoscalerAutoscalingPolicyCpuUtilizationTarget(original["utilizationTarget"]) @@ -484,6 +490,10 @@ func flattenComputeAutoscalerAutoscalingPolicyMetric(v interface{}) interface{} transformed := make([]interface{}, 0, len(l)) for _, raw := range l { original := raw.(map[string]interface{}) + if len(original) < 1 { + // Do not include empty json objects coming back from the api + continue + } transformed = append(transformed, map[string]interface{}{ "name": flattenComputeAutoscalerAutoscalingPolicyMetricName(original["metric"]), "target": flattenComputeAutoscalerAutoscalingPolicyMetricTarget(original["utilizationTarget"]), @@ -514,6 +524,9 @@ func flattenComputeAutoscalerAutoscalingPolicyLoadBalancingUtilization(v interfa return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["target"] = flattenComputeAutoscalerAutoscalingPolicyLoadBalancingUtilizationTarget(original["utilizationTarget"]) diff --git a/google-beta/resource_compute_disk.go b/google-beta/resource_compute_disk.go index fba3f74ecf..9a8a9d15f2 100644 --- a/google-beta/resource_compute_disk.go +++ b/google-beta/resource_compute_disk.go @@ -931,6 +931,9 @@ func flattenComputeDiskSourceImageEncryptionKey(v interface{}) interface{} { return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["raw_key"] = flattenComputeDiskSourceImageEncryptionKeyRawKey(original["rawKey"]) @@ -961,6 +964,9 @@ func flattenComputeDiskDiskEncryptionKey(v interface{}) interface{} { return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["raw_key"] = flattenComputeDiskDiskEncryptionKeyRawKey(original["rawKey"]) @@ -994,6 +1000,9 @@ func flattenComputeDiskSourceSnapshotEncryptionKey(v interface{}) interface{} { return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["raw_key"] = flattenComputeDiskSourceSnapshotEncryptionKeyRawKey(original["rawKey"]) diff --git a/google-beta/resource_compute_firewall.go b/google-beta/resource_compute_firewall.go index f40840afad..7744806f2f 100644 --- a/google-beta/resource_compute_firewall.go +++ b/google-beta/resource_compute_firewall.go @@ -612,6 +612,10 @@ func flattenComputeFirewallAllow(v interface{}) interface{} { transformed := make([]interface{}, 0, len(l)) for _, raw := range l { original := raw.(map[string]interface{}) + if len(original) < 1 { + // Do not include empty json objects coming back from the api + continue + } transformed = append(transformed, map[string]interface{}{ "protocol": flattenComputeFirewallAllowProtocol(original["IPProtocol"]), "ports": flattenComputeFirewallAllowPorts(original["ports"]), @@ -639,6 +643,10 @@ func flattenComputeFirewallDeny(v interface{}) interface{} { transformed := make([]interface{}, 0, len(l)) for _, raw := range l { original := raw.(map[string]interface{}) + if len(original) < 1 { + // Do not include empty json objects coming back from the api + continue + } transformed = append(transformed, map[string]interface{}{ "protocol": flattenComputeFirewallDenyProtocol(original["IPProtocol"]), "ports": flattenComputeFirewallDenyPorts(original["ports"]), diff --git a/google-beta/resource_compute_health_check.go b/google-beta/resource_compute_health_check.go index a262e61c5d..24978f90c5 100644 --- a/google-beta/resource_compute_health_check.go +++ b/google-beta/resource_compute_health_check.go @@ -601,6 +601,9 @@ func flattenComputeHealthCheckHttpHealthCheck(v interface{}) interface{} { return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["host"] = flattenComputeHealthCheckHttpHealthCheckHost(original["host"]) @@ -639,6 +642,9 @@ func flattenComputeHealthCheckHttpsHealthCheck(v interface{}) interface{} { return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["host"] = flattenComputeHealthCheckHttpsHealthCheckHost(original["host"]) @@ -677,6 +683,9 @@ func flattenComputeHealthCheckTcpHealthCheck(v interface{}) interface{} { return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["request"] = flattenComputeHealthCheckTcpHealthCheckRequest(original["request"]) @@ -715,6 +724,9 @@ func flattenComputeHealthCheckSslHealthCheck(v interface{}) interface{} { return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["request"] = flattenComputeHealthCheckSslHealthCheckRequest(original["request"]) diff --git a/google-beta/resource_compute_interconnect_attachment.go b/google-beta/resource_compute_interconnect_attachment.go index a52183c7fe..47dea2f403 100644 --- a/google-beta/resource_compute_interconnect_attachment.go +++ b/google-beta/resource_compute_interconnect_attachment.go @@ -321,6 +321,9 @@ func flattenComputeInterconnectAttachmentPrivateInterconnectInfo(v interface{}) return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["tag8021q"] = flattenComputeInterconnectAttachmentPrivateInterconnectInfoTag8021q(original["tag8021q"]) diff --git a/google-beta/resource_compute_region_autoscaler.go b/google-beta/resource_compute_region_autoscaler.go index 0806acb85c..86e302a06a 100644 --- a/google-beta/resource_compute_region_autoscaler.go +++ b/google-beta/resource_compute_region_autoscaler.go @@ -416,6 +416,9 @@ func flattenComputeRegionAutoscalerAutoscalingPolicy(v interface{}) interface{} return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["min_replicas"] = flattenComputeRegionAutoscalerAutoscalingPolicyMinReplicas(original["minNumReplicas"]) @@ -466,6 +469,9 @@ func flattenComputeRegionAutoscalerAutoscalingPolicyCpuUtilization(v interface{} return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["target"] = flattenComputeRegionAutoscalerAutoscalingPolicyCpuUtilizationTarget(original["utilizationTarget"]) @@ -483,6 +489,10 @@ func flattenComputeRegionAutoscalerAutoscalingPolicyMetric(v interface{}) interf transformed := make([]interface{}, 0, len(l)) for _, raw := range l { original := raw.(map[string]interface{}) + if len(original) < 1 { + // Do not include empty json objects coming back from the api + continue + } transformed = append(transformed, map[string]interface{}{ "name": flattenComputeRegionAutoscalerAutoscalingPolicyMetricName(original["metric"]), "target": flattenComputeRegionAutoscalerAutoscalingPolicyMetricTarget(original["utilizationTarget"]), @@ -513,6 +523,9 @@ func flattenComputeRegionAutoscalerAutoscalingPolicyLoadBalancingUtilization(v i return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["target"] = flattenComputeRegionAutoscalerAutoscalingPolicyLoadBalancingUtilizationTarget(original["utilizationTarget"]) diff --git a/google-beta/resource_compute_region_disk.go b/google-beta/resource_compute_region_disk.go index 0273d49eb3..2c1dfda731 100644 --- a/google-beta/resource_compute_region_disk.go +++ b/google-beta/resource_compute_region_disk.go @@ -653,6 +653,9 @@ func flattenComputeRegionDiskDiskEncryptionKey(v interface{}) interface{} { return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["raw_key"] = flattenComputeRegionDiskDiskEncryptionKeyRawKey(original["rawKey"]) @@ -686,6 +689,9 @@ func flattenComputeRegionDiskSourceSnapshotEncryptionKey(v interface{}) interfac return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["raw_key"] = flattenComputeRegionDiskSourceSnapshotEncryptionKeyRawKey(original["rawKey"]) diff --git a/google-beta/resource_compute_router.go b/google-beta/resource_compute_router.go index 58fea2143c..db562c1450 100644 --- a/google-beta/resource_compute_router.go +++ b/google-beta/resource_compute_router.go @@ -396,6 +396,9 @@ func flattenComputeRouterBgp(v interface{}) interface{} { return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["asn"] = flattenComputeRouterBgpAsn(original["asn"]) @@ -433,6 +436,10 @@ func flattenComputeRouterBgpAdvertisedIpRanges(v interface{}) interface{} { transformed := make([]interface{}, 0, len(l)) for _, raw := range l { original := raw.(map[string]interface{}) + if len(original) < 1 { + // Do not include empty json objects coming back from the api + continue + } transformed = append(transformed, map[string]interface{}{ "range": flattenComputeRouterBgpAdvertisedIpRangesRange(original["range"]), "description": flattenComputeRouterBgpAdvertisedIpRangesDescription(original["description"]), diff --git a/google-beta/resource_compute_subnetwork.go b/google-beta/resource_compute_subnetwork.go index ba76d27ca8..d858ee7de3 100644 --- a/google-beta/resource_compute_subnetwork.go +++ b/google-beta/resource_compute_subnetwork.go @@ -595,6 +595,10 @@ func flattenComputeSubnetworkSecondaryIpRange(v interface{}) interface{} { transformed := make([]interface{}, 0, len(l)) for _, raw := range l { original := raw.(map[string]interface{}) + if len(original) < 1 { + // Do not include empty json objects coming back from the api + continue + } transformed = append(transformed, map[string]interface{}{ "range_name": flattenComputeSubnetworkSecondaryIpRangeRangeName(original["rangeName"]), "ip_cidr_range": flattenComputeSubnetworkSecondaryIpRangeIpCidrRange(original["ipCidrRange"]), diff --git a/google-beta/resource_compute_url_map.go b/google-beta/resource_compute_url_map.go index 39602107f1..e6dac3747e 100644 --- a/google-beta/resource_compute_url_map.go +++ b/google-beta/resource_compute_url_map.go @@ -473,6 +473,10 @@ func flattenComputeUrlMapHost_rule(v interface{}) interface{} { transformed := make([]interface{}, 0, len(l)) for _, raw := range l { original := raw.(map[string]interface{}) + if len(original) < 1 { + // Do not include empty json objects coming back from the api + continue + } transformed = append(transformed, map[string]interface{}{ "description": flattenComputeUrlMapHost_ruleDescription(original["description"]), "hosts": flattenComputeUrlMapHost_ruleHosts(original["hosts"]), @@ -522,6 +526,10 @@ func flattenComputeUrlMapPath_matcher(v interface{}) interface{} { transformed := make([]interface{}, 0, len(l)) for _, raw := range l { original := raw.(map[string]interface{}) + if len(original) < 1 { + // Do not include empty json objects coming back from the api + continue + } transformed = append(transformed, map[string]interface{}{ "default_service": flattenComputeUrlMapPath_matcherDefaultService(original["defaultService"]), "description": flattenComputeUrlMapPath_matcherDescription(original["description"]), @@ -554,6 +562,10 @@ func flattenComputeUrlMapPath_matcherPath_rule(v interface{}) interface{} { transformed := make([]interface{}, 0, len(l)) for _, raw := range l { original := raw.(map[string]interface{}) + if len(original) < 1 { + // Do not include empty json objects coming back from the api + continue + } transformed = append(transformed, map[string]interface{}{ "paths": flattenComputeUrlMapPath_matcherPath_rulePaths(original["paths"]), "service": flattenComputeUrlMapPath_matcherPath_ruleService(original["service"]), @@ -583,6 +595,10 @@ func flattenComputeUrlMapTest(v interface{}) interface{} { transformed := make([]interface{}, 0, len(l)) for _, raw := range l { original := raw.(map[string]interface{}) + if len(original) < 1 { + // Do not include empty json objects coming back from the api + continue + } transformed = append(transformed, map[string]interface{}{ "description": flattenComputeUrlMapTestDescription(original["description"]), "host": flattenComputeUrlMapTestHost(original["host"]), diff --git a/google-beta/resource_containeranalysis_note.go b/google-beta/resource_containeranalysis_note.go index f69d1776ad..f050f22ad6 100644 --- a/google-beta/resource_containeranalysis_note.go +++ b/google-beta/resource_containeranalysis_note.go @@ -223,6 +223,9 @@ func flattenContainerAnalysisNoteAttestationAuthority(v interface{}) interface{} return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["hint"] = flattenContainerAnalysisNoteAttestationAuthorityHint(original["hint"]) @@ -233,6 +236,9 @@ func flattenContainerAnalysisNoteAttestationAuthorityHint(v interface{}) interfa return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["human_readable_name"] = flattenContainerAnalysisNoteAttestationAuthorityHintHumanReadableName(original["humanReadableName"]) diff --git a/google-beta/resource_filestore_instance.go b/google-beta/resource_filestore_instance.go index d79edcd0fa..a95d96de62 100644 --- a/google-beta/resource_filestore_instance.go +++ b/google-beta/resource_filestore_instance.go @@ -423,6 +423,10 @@ func flattenFilestoreInstanceFileShares(v interface{}) interface{} { transformed := make([]interface{}, 0, len(l)) for _, raw := range l { original := raw.(map[string]interface{}) + if len(original) < 1 { + // Do not include empty json objects coming back from the api + continue + } transformed = append(transformed, map[string]interface{}{ "name": flattenFilestoreInstanceFileSharesName(original["name"]), "capacity_gb": flattenFilestoreInstanceFileSharesCapacityGb(original["capacityGb"]), @@ -452,6 +456,10 @@ func flattenFilestoreInstanceNetworks(v interface{}) interface{} { transformed := make([]interface{}, 0, len(l)) for _, raw := range l { original := raw.(map[string]interface{}) + if len(original) < 1 { + // Do not include empty json objects coming back from the api + continue + } transformed = append(transformed, map[string]interface{}{ "network": flattenFilestoreInstanceNetworksNetwork(original["network"]), "modes": flattenFilestoreInstanceNetworksModes(original["modes"]), diff --git a/google-beta/resource_monitoring_alert_policy.go b/google-beta/resource_monitoring_alert_policy.go index b0cf883d3e..4ebe8d9a17 100644 --- a/google-beta/resource_monitoring_alert_policy.go +++ b/google-beta/resource_monitoring_alert_policy.go @@ -555,6 +555,9 @@ func flattenMonitoringAlertPolicyCreationRecord(v interface{}) interface{} { return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["mutate_time"] = flattenMonitoringAlertPolicyCreationRecordMutateTime(original["mutateTime"]) @@ -582,6 +585,10 @@ func flattenMonitoringAlertPolicyConditions(v interface{}) interface{} { transformed := make([]interface{}, 0, len(l)) for _, raw := range l { original := raw.(map[string]interface{}) + if len(original) < 1 { + // Do not include empty json objects coming back from the api + continue + } transformed = append(transformed, map[string]interface{}{ "condition_absent": flattenMonitoringAlertPolicyConditionsConditionAbsent(original["conditionAbsent"]), "name": flattenMonitoringAlertPolicyConditionsName(original["name"]), @@ -596,6 +603,9 @@ func flattenMonitoringAlertPolicyConditionsConditionAbsent(v interface{}) interf return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["aggregations"] = flattenMonitoringAlertPolicyConditionsConditionAbsentAggregations(original["aggregations"]) @@ -615,6 +625,10 @@ func flattenMonitoringAlertPolicyConditionsConditionAbsentAggregations(v interfa transformed := make([]interface{}, 0, len(l)) for _, raw := range l { original := raw.(map[string]interface{}) + if len(original) < 1 { + // Do not include empty json objects coming back from the api + continue + } transformed = append(transformed, map[string]interface{}{ "per_series_aligner": flattenMonitoringAlertPolicyConditionsConditionAbsentAggregationsPerSeriesAligner(original["perSeriesAligner"]), "group_by_fields": flattenMonitoringAlertPolicyConditionsConditionAbsentAggregationsGroupByFields(original["groupByFields"]), @@ -645,6 +659,9 @@ func flattenMonitoringAlertPolicyConditionsConditionAbsentTrigger(v interface{}) return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["percent"] = flattenMonitoringAlertPolicyConditionsConditionAbsentTriggerPercent(original["percent"]) @@ -683,6 +700,9 @@ func flattenMonitoringAlertPolicyConditionsConditionThreshold(v interface{}) int return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["threshold_value"] = flattenMonitoringAlertPolicyConditionsConditionThresholdThresholdValue(original["thresholdValue"]) @@ -718,6 +738,10 @@ func flattenMonitoringAlertPolicyConditionsConditionThresholdDenominatorAggregat transformed := make([]interface{}, 0, len(l)) for _, raw := range l { original := raw.(map[string]interface{}) + if len(original) < 1 { + // Do not include empty json objects coming back from the api + continue + } transformed = append(transformed, map[string]interface{}{ "per_series_aligner": flattenMonitoringAlertPolicyConditionsConditionThresholdDenominatorAggregationsPerSeriesAligner(original["perSeriesAligner"]), "group_by_fields": flattenMonitoringAlertPolicyConditionsConditionThresholdDenominatorAggregationsGroupByFields(original["groupByFields"]), @@ -756,6 +780,9 @@ func flattenMonitoringAlertPolicyConditionsConditionThresholdTrigger(v interface return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["percent"] = flattenMonitoringAlertPolicyConditionsConditionThresholdTriggerPercent(original["percent"]) @@ -785,6 +812,10 @@ func flattenMonitoringAlertPolicyConditionsConditionThresholdAggregations(v inte transformed := make([]interface{}, 0, len(l)) for _, raw := range l { original := raw.(map[string]interface{}) + if len(original) < 1 { + // Do not include empty json objects coming back from the api + continue + } transformed = append(transformed, map[string]interface{}{ "per_series_aligner": flattenMonitoringAlertPolicyConditionsConditionThresholdAggregationsPerSeriesAligner(original["perSeriesAligner"]), "group_by_fields": flattenMonitoringAlertPolicyConditionsConditionThresholdAggregationsGroupByFields(original["groupByFields"]), @@ -831,6 +862,9 @@ func flattenMonitoringAlertPolicyDocumentation(v interface{}) interface{} { return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["content"] = flattenMonitoringAlertPolicyDocumentationContent(original["content"]) diff --git a/google-beta/resource_storage_default_object_access_control.go b/google-beta/resource_storage_default_object_access_control.go index 5ae86adbc1..cdab4147cd 100644 --- a/google-beta/resource_storage_default_object_access_control.go +++ b/google-beta/resource_storage_default_object_access_control.go @@ -297,6 +297,9 @@ func flattenStorageDefaultObjectAccessControlProjectTeam(v interface{}) interfac return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["project_number"] = flattenStorageDefaultObjectAccessControlProjectTeamProjectNumber(original["projectNumber"]) diff --git a/google-beta/resource_storage_object_access_control.go b/google-beta/resource_storage_object_access_control.go index 5b6e57ee50..396f6feb16 100644 --- a/google-beta/resource_storage_object_access_control.go +++ b/google-beta/resource_storage_object_access_control.go @@ -307,6 +307,9 @@ func flattenStorageObjectAccessControlProjectTeam(v interface{}) interface{} { return nil } original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } transformed := make(map[string]interface{}) transformed["project_number"] = flattenStorageObjectAccessControlProjectTeamProjectNumber(original["projectNumber"])