diff --git a/.changelog/3270.txt b/.changelog/3270.txt new file mode 100644 index 0000000000..2886c39c82 --- /dev/null +++ b/.changelog/3270.txt @@ -0,0 +1,3 @@ +```release-note:bug +logging: Fixed import issue with `google_logging_metric` in a non-default project. +``` diff --git a/google-beta/resource_bigquery_data_transfer_config.go b/google-beta/resource_bigquery_data_transfer_config.go index 6e3f141a69..38f21e4f88 100644 --- a/google-beta/resource_bigquery_data_transfer_config.go +++ b/google-beta/resource_bigquery_data_transfer_config.go @@ -364,7 +364,7 @@ func resourceBigqueryDataTransferConfigImport(d *schema.ResourceData, meta inter config := meta.(*Config) // current import_formats can't import fields with forward slashes in their value - if err := parseImportId([]string{"(?P.+)"}, d, config); err != nil { + if err := parseImportId([]string{"(?P[^ ]+) (?P[^ ]+)", "(?P[^ ]+)"}, d, config); err != nil { return nil, err } diff --git a/google-beta/resource_billing_budget.go b/google-beta/resource_billing_budget.go index 36388603ac..1df4fa16b2 100644 --- a/google-beta/resource_billing_budget.go +++ b/google-beta/resource_billing_budget.go @@ -335,7 +335,7 @@ func resourceBillingBudgetImport(d *schema.ResourceData, meta interface{}) ([]*s config := meta.(*Config) // current import_formats can't import fields with forward slashes in their value - if err := parseImportId([]string{"(?P.+)"}, d, config); err != nil { + if err := parseImportId([]string{"(?P[^ ]+) (?P[^ ]+)", "(?P[^ ]+)"}, d, config); err != nil { return nil, err } diff --git a/google-beta/resource_logging_metric.go b/google-beta/resource_logging_metric.go index 8b3bf61d29..5aa056a48c 100644 --- a/google-beta/resource_logging_metric.go +++ b/google-beta/resource_logging_metric.go @@ -505,7 +505,7 @@ func resourceLoggingMetricImport(d *schema.ResourceData, meta interface{}) ([]*s config := meta.(*Config) // current import_formats can't import fields with forward slashes in their value - if err := parseImportId([]string{"(?P.+)"}, d, config); err != nil { + if err := parseImportId([]string{"(?P[^ ]+) (?P[^ ]+)", "(?P[^ ]+)"}, d, config); err != nil { return nil, err } diff --git a/google-beta/resource_monitoring_alert_policy.go b/google-beta/resource_monitoring_alert_policy.go index 5acbf96f90..52eea048aa 100644 --- a/google-beta/resource_monitoring_alert_policy.go +++ b/google-beta/resource_monitoring_alert_policy.go @@ -1023,7 +1023,7 @@ func resourceMonitoringAlertPolicyImport(d *schema.ResourceData, meta interface{ config := meta.(*Config) // current import_formats can't import fields with forward slashes in their value - if err := parseImportId([]string{"(?P.+)"}, d, config); err != nil { + if err := parseImportId([]string{"(?P[^ ]+) (?P[^ ]+)", "(?P[^ ]+)"}, d, config); err != nil { return nil, err } diff --git a/google-beta/resource_monitoring_group.go b/google-beta/resource_monitoring_group.go index 946f6ce806..7309fc2eaf 100644 --- a/google-beta/resource_monitoring_group.go +++ b/google-beta/resource_monitoring_group.go @@ -291,7 +291,7 @@ func resourceMonitoringGroupImport(d *schema.ResourceData, meta interface{}) ([] config := meta.(*Config) // current import_formats can't import fields with forward slashes in their value - if err := parseImportId([]string{"(?P.+)"}, d, config); err != nil { + if err := parseImportId([]string{"(?P[^ ]+) (?P[^ ]+)", "(?P[^ ]+)"}, d, config); err != nil { return nil, err } diff --git a/google-beta/resource_monitoring_notification_channel.go b/google-beta/resource_monitoring_notification_channel.go index 2121236468..c00313e596 100644 --- a/google-beta/resource_monitoring_notification_channel.go +++ b/google-beta/resource_monitoring_notification_channel.go @@ -416,7 +416,7 @@ func resourceMonitoringNotificationChannelImport(d *schema.ResourceData, meta in config := meta.(*Config) // current import_formats can't import fields with forward slashes in their value - if err := parseImportId([]string{"(?P.+)"}, d, config); err != nil { + if err := parseImportId([]string{"(?P[^ ]+) (?P[^ ]+)", "(?P[^ ]+)"}, d, config); err != nil { return nil, err } diff --git a/google-beta/resource_monitoring_uptime_check_config.go b/google-beta/resource_monitoring_uptime_check_config.go index 7f0dee7cff..7af6d7a067 100644 --- a/google-beta/resource_monitoring_uptime_check_config.go +++ b/google-beta/resource_monitoring_uptime_check_config.go @@ -566,7 +566,7 @@ func resourceMonitoringUptimeCheckConfigImport(d *schema.ResourceData, meta inte config := meta.(*Config) // current import_formats can't import fields with forward slashes in their value - if err := parseImportId([]string{"(?P.+)"}, d, config); err != nil { + if err := parseImportId([]string{"(?P[^ ]+) (?P[^ ]+)", "(?P[^ ]+)"}, d, config); err != nil { return nil, err } diff --git a/google-beta/resource_security_scanner_scan_config.go b/google-beta/resource_security_scanner_scan_config.go index f3ff763608..f9b218dfe9 100644 --- a/google-beta/resource_security_scanner_scan_config.go +++ b/google-beta/resource_security_scanner_scan_config.go @@ -502,7 +502,7 @@ func resourceSecurityScannerScanConfigImport(d *schema.ResourceData, meta interf config := meta.(*Config) // current import_formats can't import fields with forward slashes in their value - if err := parseImportId([]string{"(?P.+)"}, d, config); err != nil { + if err := parseImportId([]string{"(?P[^ ]+) (?P[^ ]+)", "(?P[^ ]+)"}, d, config); err != nil { return nil, err } diff --git a/website/docs/r/logging_metric.html.markdown b/website/docs/r/logging_metric.html.markdown index 9a8f09ead5..f7be1eff68 100644 --- a/website/docs/r/logging_metric.html.markdown +++ b/website/docs/r/logging_metric.html.markdown @@ -298,6 +298,7 @@ This resource provides the following Metric can be imported using any of these accepted formats: ``` +$ terraform import google_logging_metric.default {{project}} {{name}} $ terraform import google_logging_metric.default {{name}} ```