Skip to content

Commit

Permalink
Replaced the panic statement with error in `google_secret_manager_sec…
Browse files Browse the repository at this point in the history
…ret_version` resource import function (#8923) (#6296)

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Sep 18, 2023
1 parent 07ca3ed commit e2b55b3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/8923.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
secretmanager: replaced the panic block with an error in import function of `google_secret_manager_secret_version` resource
```
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ func resourceSecretManagerSecretVersionImport(d *schema.ResourceData, meta inter

parts := secretRegex.FindStringSubmatch(name)
if len(parts) != 2 {
panic(fmt.Sprintf("Version name does not fit the format `projects/{{project}}/secrets/{{secret}}/versions/{{version}}`"))
return nil, fmt.Errorf("Version name does not fit the format `projects/{{project}}/secrets/{{secret}}/versions/{{version}}`")
}
if err := d.Set("secret", parts[1]); err != nil {
return nil, fmt.Errorf("Error setting secret: %s", err)
Expand Down

0 comments on commit e2b55b3

Please sign in to comment.