Skip to content

Commit

Permalink
Reverse regex logic
Browse files Browse the repository at this point in the history
  • Loading branch information
slevenick committed Jul 17, 2019
1 parent 65d169b commit 7eb1501
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions third_party/terraform/resources/resource_google_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,12 +451,12 @@ func resourceGoogleProjectDelete(d *schema.ResourceData, meta interface{}) error
func resourceProjectImportState(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
pid := d.Id()
// Prevent importing via project number, this will cause issues later
matched, err := regexp.MatchString("[^\\d]", pid)
matched, err := regexp.MatchString("^\\d+$", pid)
if err != nil {
return nil, fmt.Errorf("Error matching project %q: %s", pid, err)
}

if matched == false {
if matched {
return nil, fmt.Errorf("Error importing project %q, please use project_id", pid)
}

Expand Down

0 comments on commit 7eb1501

Please sign in to comment.