diff --git a/google-beta/resource_accesscontextmanager_access_policy.go b/google-beta/resource_accesscontextmanager_access_policy.go index 37d8f206c3..f3e26eeb0e 100644 --- a/google-beta/resource_accesscontextmanager_access_policy.go +++ b/google-beta/resource_accesscontextmanager_access_policy.go @@ -261,7 +261,9 @@ func resourceAccessContextManagerAccessPolicyDelete(d *schema.ResourceData, meta func resourceAccessContextManagerAccessPolicyImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{name}}") diff --git a/google-beta/resource_binaryauthorization_attestor.go b/google-beta/resource_binaryauthorization_attestor.go index ff5ba53135..6dcc9ddba1 100644 --- a/google-beta/resource_binaryauthorization_attestor.go +++ b/google-beta/resource_binaryauthorization_attestor.go @@ -239,7 +239,9 @@ func resourceBinaryAuthorizationAttestorDelete(d *schema.ResourceData, meta inte func resourceBinaryAuthorizationAttestorImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/attestors/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/attestors/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{name}}") diff --git a/google-beta/resource_binaryauthorization_policy.go b/google-beta/resource_binaryauthorization_policy.go index 14c81e4178..b9a9233c1e 100644 --- a/google-beta/resource_binaryauthorization_policy.go +++ b/google-beta/resource_binaryauthorization_policy.go @@ -316,7 +316,9 @@ func resourceBinaryAuthorizationPolicyDelete(d *schema.ResourceData, meta interf func resourceBinaryAuthorizationPolicyImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{project}}") diff --git a/google-beta/resource_compute_address.go b/google-beta/resource_compute_address.go index b779c9b716..4b578e09b7 100644 --- a/google-beta/resource_compute_address.go +++ b/google-beta/resource_compute_address.go @@ -418,7 +418,9 @@ func resourceComputeAddressDelete(d *schema.ResourceData, meta interface{}) erro func resourceComputeAddressImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/regions/(?P[^/]+)/addresses/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/regions/(?P[^/]+)/addresses/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{project}}/{{region}}/{{name}}") diff --git a/google-beta/resource_compute_autoscaler.go b/google-beta/resource_compute_autoscaler.go index 19be6d8f82..48e5d42298 100644 --- a/google-beta/resource_compute_autoscaler.go +++ b/google-beta/resource_compute_autoscaler.go @@ -389,7 +389,9 @@ func resourceComputeAutoscalerDelete(d *schema.ResourceData, meta interface{}) e func resourceComputeAutoscalerImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/zones/(?P[^/]+)/autoscalers/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/zones/(?P[^/]+)/autoscalers/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{zone}}/{{name}}") diff --git a/google-beta/resource_compute_backend_bucket.go b/google-beta/resource_compute_backend_bucket.go index a2b1653504..15384ea85c 100644 --- a/google-beta/resource_compute_backend_bucket.go +++ b/google-beta/resource_compute_backend_bucket.go @@ -294,7 +294,9 @@ func resourceComputeBackendBucketDelete(d *schema.ResourceData, meta interface{} func resourceComputeBackendBucketImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/global/backendBuckets/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/global/backendBuckets/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{name}}") diff --git a/google-beta/resource_compute_disk.go b/google-beta/resource_compute_disk.go index c6c5c3fbd6..aa9dc3fa5e 100644 --- a/google-beta/resource_compute_disk.go +++ b/google-beta/resource_compute_disk.go @@ -827,7 +827,9 @@ func resourceComputeDiskDelete(d *schema.ResourceData, meta interface{}) error { func resourceComputeDiskImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/zones/(?P[^/]+)/disks/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/zones/(?P[^/]+)/disks/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{name}}") diff --git a/google-beta/resource_compute_firewall.go b/google-beta/resource_compute_firewall.go index 949a158225..57f74d6fe8 100644 --- a/google-beta/resource_compute_firewall.go +++ b/google-beta/resource_compute_firewall.go @@ -603,7 +603,9 @@ func resourceComputeFirewallDelete(d *schema.ResourceData, meta interface{}) err func resourceComputeFirewallImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/global/firewalls/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/global/firewalls/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{name}}") diff --git a/google-beta/resource_compute_forwarding_rule.go b/google-beta/resource_compute_forwarding_rule.go index 213dcaf30b..80b6ddc0e8 100644 --- a/google-beta/resource_compute_forwarding_rule.go +++ b/google-beta/resource_compute_forwarding_rule.go @@ -579,7 +579,9 @@ func resourceComputeForwardingRuleDelete(d *schema.ResourceData, meta interface{ func resourceComputeForwardingRuleImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/regions/(?P[^/]+)/forwardingRules/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/regions/(?P[^/]+)/forwardingRules/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{name}}") diff --git a/google-beta/resource_compute_global_address.go b/google-beta/resource_compute_global_address.go index 4d209d18b8..0bf0ad80ef 100644 --- a/google-beta/resource_compute_global_address.go +++ b/google-beta/resource_compute_global_address.go @@ -421,7 +421,9 @@ func resourceComputeGlobalAddressDelete(d *schema.ResourceData, meta interface{} func resourceComputeGlobalAddressImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/global/addresses/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/global/addresses/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{name}}") diff --git a/google-beta/resource_compute_health_check.go b/google-beta/resource_compute_health_check.go index 7d3322d930..bb96c6684f 100644 --- a/google-beta/resource_compute_health_check.go +++ b/google-beta/resource_compute_health_check.go @@ -537,7 +537,9 @@ func resourceComputeHealthCheckDelete(d *schema.ResourceData, meta interface{}) func resourceComputeHealthCheckImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/global/healthChecks/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/global/healthChecks/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{name}}") diff --git a/google-beta/resource_compute_http_health_check.go b/google-beta/resource_compute_http_health_check.go index 78ffde82c9..9013d339df 100644 --- a/google-beta/resource_compute_http_health_check.go +++ b/google-beta/resource_compute_http_health_check.go @@ -395,7 +395,9 @@ func resourceComputeHttpHealthCheckDelete(d *schema.ResourceData, meta interface func resourceComputeHttpHealthCheckImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/global/httpHealthChecks/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/global/httpHealthChecks/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{name}}") diff --git a/google-beta/resource_compute_https_health_check.go b/google-beta/resource_compute_https_health_check.go index 466d49bccf..7bd24462e7 100644 --- a/google-beta/resource_compute_https_health_check.go +++ b/google-beta/resource_compute_https_health_check.go @@ -395,7 +395,9 @@ func resourceComputeHttpsHealthCheckDelete(d *schema.ResourceData, meta interfac func resourceComputeHttpsHealthCheckImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/global/httpsHealthChecks/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/global/httpsHealthChecks/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{name}}") diff --git a/google-beta/resource_compute_interconnect_attachment.go b/google-beta/resource_compute_interconnect_attachment.go index 1867cd4ff4..f008563e1f 100644 --- a/google-beta/resource_compute_interconnect_attachment.go +++ b/google-beta/resource_compute_interconnect_attachment.go @@ -289,7 +289,9 @@ func resourceComputeInterconnectAttachmentDelete(d *schema.ResourceData, meta in func resourceComputeInterconnectAttachmentImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/regions/(?P[^/]+)/interconnectAttachments/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/regions/(?P[^/]+)/interconnectAttachments/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{name}}") diff --git a/google-beta/resource_compute_region_autoscaler.go b/google-beta/resource_compute_region_autoscaler.go index 7033dcc633..9bf1e0cf3d 100644 --- a/google-beta/resource_compute_region_autoscaler.go +++ b/google-beta/resource_compute_region_autoscaler.go @@ -388,7 +388,9 @@ func resourceComputeRegionAutoscalerDelete(d *schema.ResourceData, meta interfac func resourceComputeRegionAutoscalerImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/regions/(?P[^/]+)/autoscalers/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/regions/(?P[^/]+)/autoscalers/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{region}}/{{name}}") diff --git a/google-beta/resource_compute_region_disk.go b/google-beta/resource_compute_region_disk.go index 4a0069a6bf..d2c42330b9 100644 --- a/google-beta/resource_compute_region_disk.go +++ b/google-beta/resource_compute_region_disk.go @@ -572,7 +572,9 @@ func resourceComputeRegionDiskDelete(d *schema.ResourceData, meta interface{}) e func resourceComputeRegionDiskImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/regions/(?P[^/]+)/disks/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/regions/(?P[^/]+)/disks/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{name}}") diff --git a/google-beta/resource_compute_route.go b/google-beta/resource_compute_route.go index 60d48d205a..cb67ea6910 100644 --- a/google-beta/resource_compute_route.go +++ b/google-beta/resource_compute_route.go @@ -336,7 +336,9 @@ func resourceComputeRouteDelete(d *schema.ResourceData, meta interface{}) error func resourceComputeRouteImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/global/routes/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/global/routes/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{name}}") diff --git a/google-beta/resource_compute_router.go b/google-beta/resource_compute_router.go index 7e07daf32d..3cf1d85201 100644 --- a/google-beta/resource_compute_router.go +++ b/google-beta/resource_compute_router.go @@ -361,7 +361,9 @@ func resourceComputeRouterDelete(d *schema.ResourceData, meta interface{}) error func resourceComputeRouterImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/regions/(?P[^/]+)/routers/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/regions/(?P[^/]+)/routers/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{region}}/{{name}}") diff --git a/google-beta/resource_compute_snapshot.go b/google-beta/resource_compute_snapshot.go index cf34b8f8ec..5c56bbb0d3 100644 --- a/google-beta/resource_compute_snapshot.go +++ b/google-beta/resource_compute_snapshot.go @@ -436,7 +436,9 @@ func resourceComputeSnapshotDelete(d *schema.ResourceData, meta interface{}) err func resourceComputeSnapshotImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/global/snapshots/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/global/snapshots/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{name}}") diff --git a/google-beta/resource_compute_ssl_certificate.go b/google-beta/resource_compute_ssl_certificate.go index 639e0461a3..de6ee9e32d 100644 --- a/google-beta/resource_compute_ssl_certificate.go +++ b/google-beta/resource_compute_ssl_certificate.go @@ -259,7 +259,9 @@ func resourceComputeSslCertificateDelete(d *schema.ResourceData, meta interface{ func resourceComputeSslCertificateImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/global/sslCertificates/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/global/sslCertificates/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{name}}") diff --git a/google-beta/resource_compute_ssl_policy.go b/google-beta/resource_compute_ssl_policy.go index 5428f6f6d9..4c67d55836 100644 --- a/google-beta/resource_compute_ssl_policy.go +++ b/google-beta/resource_compute_ssl_policy.go @@ -353,7 +353,9 @@ func resourceComputeSslPolicyDelete(d *schema.ResourceData, meta interface{}) er func resourceComputeSslPolicyImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/global/sslPolicies/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/global/sslPolicies/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{name}}") diff --git a/google-beta/resource_compute_subnetwork.go b/google-beta/resource_compute_subnetwork.go index 107805341d..62a01a1124 100644 --- a/google-beta/resource_compute_subnetwork.go +++ b/google-beta/resource_compute_subnetwork.go @@ -543,7 +543,9 @@ func resourceComputeSubnetworkDelete(d *schema.ResourceData, meta interface{}) e func resourceComputeSubnetworkImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/regions/(?P[^/]+)/subnetworks/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/regions/(?P[^/]+)/subnetworks/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{region}}/{{name}}") diff --git a/google-beta/resource_compute_target_http_proxy.go b/google-beta/resource_compute_target_http_proxy.go index 326b64f030..c3d193c002 100644 --- a/google-beta/resource_compute_target_http_proxy.go +++ b/google-beta/resource_compute_target_http_proxy.go @@ -277,7 +277,9 @@ func resourceComputeTargetHttpProxyDelete(d *schema.ResourceData, meta interface func resourceComputeTargetHttpProxyImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/global/targetHttpProxies/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/global/targetHttpProxies/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{name}}") diff --git a/google-beta/resource_compute_target_https_proxy.go b/google-beta/resource_compute_target_https_proxy.go index afc9d6ae0f..ce55febdf7 100644 --- a/google-beta/resource_compute_target_https_proxy.go +++ b/google-beta/resource_compute_target_https_proxy.go @@ -437,7 +437,9 @@ func resourceComputeTargetHttpsProxyDelete(d *schema.ResourceData, meta interfac func resourceComputeTargetHttpsProxyImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/global/targetHttpsProxies/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/global/targetHttpsProxies/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{name}}") diff --git a/google-beta/resource_compute_target_ssl_proxy.go b/google-beta/resource_compute_target_ssl_proxy.go index 869c9b712b..da9fc70645 100644 --- a/google-beta/resource_compute_target_ssl_proxy.go +++ b/google-beta/resource_compute_target_ssl_proxy.go @@ -439,7 +439,9 @@ func resourceComputeTargetSslProxyDelete(d *schema.ResourceData, meta interface{ func resourceComputeTargetSslProxyImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/global/targetSslProxies/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/global/targetSslProxies/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{name}}") diff --git a/google-beta/resource_compute_target_tcp_proxy.go b/google-beta/resource_compute_target_tcp_proxy.go index 114c2c3e78..95b56ae691 100644 --- a/google-beta/resource_compute_target_tcp_proxy.go +++ b/google-beta/resource_compute_target_tcp_proxy.go @@ -331,7 +331,9 @@ func resourceComputeTargetTcpProxyDelete(d *schema.ResourceData, meta interface{ func resourceComputeTargetTcpProxyImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/global/targetTcpProxies/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/global/targetTcpProxies/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{name}}") diff --git a/google-beta/resource_compute_url_map.go b/google-beta/resource_compute_url_map.go index 50f334cbc9..926b481477 100644 --- a/google-beta/resource_compute_url_map.go +++ b/google-beta/resource_compute_url_map.go @@ -443,7 +443,9 @@ func resourceComputeUrlMapDelete(d *schema.ResourceData, meta interface{}) error func resourceComputeUrlMapImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/global/urlMaps/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/global/urlMaps/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{name}}") diff --git a/google-beta/resource_compute_vpn_gateway.go b/google-beta/resource_compute_vpn_gateway.go index da5a65fd3b..28ffaee5dd 100644 --- a/google-beta/resource_compute_vpn_gateway.go +++ b/google-beta/resource_compute_vpn_gateway.go @@ -235,7 +235,9 @@ func resourceComputeVpnGatewayDelete(d *schema.ResourceData, meta interface{}) e func resourceComputeVpnGatewayImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/regions/(?P[^/]+)/targetVpnGateways/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/regions/(?P[^/]+)/targetVpnGateways/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{name}}") diff --git a/google-beta/resource_compute_vpn_tunnel.go b/google-beta/resource_compute_vpn_tunnel.go index 81e2305d72..2c454b6bd6 100644 --- a/google-beta/resource_compute_vpn_tunnel.go +++ b/google-beta/resource_compute_vpn_tunnel.go @@ -539,7 +539,9 @@ func resourceComputeVpnTunnelDelete(d *schema.ResourceData, meta interface{}) er func resourceComputeVpnTunnelImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/regions/(?P[^/]+)/vpnTunnels/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/regions/(?P[^/]+)/vpnTunnels/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{name}}") diff --git a/google-beta/resource_containeranalysis_note.go b/google-beta/resource_containeranalysis_note.go index f829039097..0e9676b3e2 100644 --- a/google-beta/resource_containeranalysis_note.go +++ b/google-beta/resource_containeranalysis_note.go @@ -207,7 +207,9 @@ func resourceContainerAnalysisNoteDelete(d *schema.ResourceData, meta interface{ func resourceContainerAnalysisNoteImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/notes/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/notes/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{name}}") diff --git a/google-beta/resource_dns_managed_zone.go b/google-beta/resource_dns_managed_zone.go index 133db685fa..d92174901c 100644 --- a/google-beta/resource_dns_managed_zone.go +++ b/google-beta/resource_dns_managed_zone.go @@ -229,7 +229,9 @@ func resourceDnsManagedZoneDelete(d *schema.ResourceData, meta interface{}) erro func resourceDnsManagedZoneImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/managedZones/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/managedZones/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{name}}") diff --git a/google-beta/resource_filestore_instance.go b/google-beta/resource_filestore_instance.go index e508c6f4de..b7b7b8717f 100644 --- a/google-beta/resource_filestore_instance.go +++ b/google-beta/resource_filestore_instance.go @@ -381,7 +381,9 @@ func resourceFilestoreInstanceDelete(d *schema.ResourceData, meta interface{}) e func resourceFilestoreInstanceImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/locations/(?P[^/]+)/instances/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/locations/(?P[^/]+)/instances/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{project}}/{{zone}}/{{name}}") diff --git a/google-beta/resource_redis_instance.go b/google-beta/resource_redis_instance.go index 373bc3faf6..f562cc22db 100644 --- a/google-beta/resource_redis_instance.go +++ b/google-beta/resource_redis_instance.go @@ -442,7 +442,9 @@ func resourceRedisInstanceDelete(d *schema.ResourceData, meta interface{}) error func resourceRedisInstanceImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"projects/(?P[^/]+)/locations/(?P[^/]+)/instances/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"projects/(?P[^/]+)/locations/(?P[^/]+)/instances/(?P[^/]+)", "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", "(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{project}}/{{region}}/{{name}}") diff --git a/google-beta/resource_resourcemanager_lien.go b/google-beta/resource_resourcemanager_lien.go index 4539a88461..2384ded290 100644 --- a/google-beta/resource_resourcemanager_lien.go +++ b/google-beta/resource_resourcemanager_lien.go @@ -230,7 +230,9 @@ func resourceResourceManagerLienDelete(d *schema.ResourceData, meta interface{}) func resourceResourceManagerLienImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"(?P[^/]+)/(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"(?P[^/]+)/(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{name}}") diff --git a/google-beta/resource_storage_default_object_access_control.go b/google-beta/resource_storage_default_object_access_control.go index 2278f95ade..a692b1e649 100644 --- a/google-beta/resource_storage_default_object_access_control.go +++ b/google-beta/resource_storage_default_object_access_control.go @@ -257,7 +257,9 @@ func resourceStorageDefaultObjectAccessControlDelete(d *schema.ResourceData, met func resourceStorageDefaultObjectAccessControlImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"(?P[^/]+)/(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"(?P[^/]+)/(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{bucket}}/{{entity}}") diff --git a/google-beta/resource_storage_object_access_control.go b/google-beta/resource_storage_object_access_control.go index f3f07f3752..a8cb0d520c 100644 --- a/google-beta/resource_storage_object_access_control.go +++ b/google-beta/resource_storage_object_access_control.go @@ -260,7 +260,9 @@ func resourceStorageObjectAccessControlDelete(d *schema.ResourceData, meta inter func resourceStorageObjectAccessControlImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) - parseImportId([]string{"(?P[^/]+)/(?P[^/]+)/(?P[^/]+)"}, d, config) + if err := parseImportId([]string{"(?P[^/]+)/(?P[^/]+)/(?P[^/]+)"}, d, config); err != nil { + return nil, err + } // Replace import id for the resource id id, err := replaceVars(d, config, "{{bucket}}/{{object}}/{{entity}}")