Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow import of logging_metric in a non-default project. #5944

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/3270.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
logging: Fixed import issue with `google_logging_metric` in a non-default project.
```
2 changes: 1 addition & 1 deletion google/resource_bigquery_data_transfer_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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<name>.+)"}, d, config); err != nil {
if err := parseImportId([]string{"(?P<project>[^ ]+) (?P<name>[^ ]+)", "(?P<name>[^ ]+)"}, d, config); err != nil {
return nil, err
}

Expand Down
2 changes: 1 addition & 1 deletion google/resource_logging_metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -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<name>.+)"}, d, config); err != nil {
if err := parseImportId([]string{"(?P<project>[^ ]+) (?P<name>[^ ]+)", "(?P<name>[^ ]+)"}, d, config); err != nil {
return nil, err
}

Expand Down
2 changes: 1 addition & 1 deletion google/resource_monitoring_alert_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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<name>.+)"}, d, config); err != nil {
if err := parseImportId([]string{"(?P<project>[^ ]+) (?P<name>[^ ]+)", "(?P<name>[^ ]+)"}, d, config); err != nil {
return nil, err
}

Expand Down
2 changes: 1 addition & 1 deletion google/resource_monitoring_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -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<name>.+)"}, d, config); err != nil {
if err := parseImportId([]string{"(?P<project>[^ ]+) (?P<name>[^ ]+)", "(?P<name>[^ ]+)"}, d, config); err != nil {
return nil, err
}

Expand Down
2 changes: 1 addition & 1 deletion google/resource_monitoring_notification_channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -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<name>.+)"}, d, config); err != nil {
if err := parseImportId([]string{"(?P<project>[^ ]+) (?P<name>[^ ]+)", "(?P<name>[^ ]+)"}, d, config); err != nil {
return nil, err
}

Expand Down
2 changes: 1 addition & 1 deletion google/resource_monitoring_uptime_check_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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<name>.+)"}, d, config); err != nil {
if err := parseImportId([]string{"(?P<project>[^ ]+) (?P<name>[^ ]+)", "(?P<name>[^ ]+)"}, d, config); err != nil {
return nil, err
}

Expand Down
1 change: 1 addition & 0 deletions website/docs/r/logging_metric.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
```

Expand Down