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

Replaced the panic statement with error in google_secret_manager_secret_version resource import function #6296

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/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