Skip to content

Commit

Permalink
Change regex to reject only all-number ids
Browse files Browse the repository at this point in the history
  • Loading branch information
slevenick committed Jul 17, 2019
1 parent d776d22 commit 65d169b
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 @@ -450,8 +450,8 @@ func resourceGoogleProjectDelete(d *schema.ResourceData, meta interface{}) error

func resourceProjectImportState(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
pid := d.Id()
// Project id must start with a letter. This prevents users from importing with project number
matched, err := regexp.MatchString("^[^\\d]", pid)
// Prevent importing via project number, this will cause issues later
matched, err := regexp.MatchString("[^\\d]", pid)
if err != nil {
return nil, fmt.Errorf("Error matching project %q: %s", pid, err)
}
Expand Down

0 comments on commit 65d169b

Please sign in to comment.