Skip to content

Commit 375474f

Browse files
committed
Address feedback
1 parent b9b1740 commit 375474f

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

docs/resources/service_principal_secret.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ In addition to all arguments above, the following attributes are exported:
3737
* `create_time` - UTC time when the secret was created.
3838
* `expire_time` - UTC time when the secret will expire. If the field is not present, the secret does not expire.
3939
* `secret_hash` - Secret Hash.
40-
* `status` - Status of the secret (i.e., `ACTIVE`).
40+
* `status` - Status of the secret (i.e., `ACTIVE` - see [REST API docs for full list](https://docs.databricks.com/api/account/serviceprincipalsecrets/list#secrets-status)).
4141
* `update_time` - UTC time when the secret was updated.
4242

4343
## Related Resources

tokens/resource_service_principal_secret.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ type ServicePrincipalSecret struct {
1919
Lifetime string `json:"lifetime,omitempty" tf:"computed,force_new"`
2020
}
2121

22+
func createFailedToConvertServicePrincipalIdToNumericError(err error) error {
23+
return fmt.Errorf("failed to convert service principal ID to numeric: %w", err)
24+
}
25+
2226
func ResourceServicePrincipalSecret() common.Resource {
2327
spnSecretSchema := common.StructToSchema(ServicePrincipalSecret{},
2428
func(m map[string]*schema.Schema) map[string]*schema.Schema {
@@ -45,7 +49,7 @@ func ResourceServicePrincipalSecret() common.Resource {
4549
spId := d.Get("service_principal_id").(string)
4650
spIdNumeric, err := strconv.ParseInt(spId, 10, 64)
4751
if err != nil {
48-
return fmt.Errorf("failed to convert service principal ID to numeric: %w", err)
52+
return createFailedToConvertServicePrincipalIdToNumericError(err)
4953
}
5054
lifetime := d.Get("lifetime").(string)
5155
res, err := ac.ServicePrincipalSecrets.Create(ctx, oauth2.CreateServicePrincipalSecretRequest{
@@ -73,7 +77,7 @@ func ResourceServicePrincipalSecret() common.Resource {
7377
spId := d.Get("service_principal_id").(string)
7478
spIdNumeric, err := strconv.ParseInt(spId, 10, 64)
7579
if err != nil {
76-
return fmt.Errorf("failed to convert service principal ID to numeric: %w", err)
80+
return createFailedToConvertServicePrincipalIdToNumericError(err)
7781
}
7882
secrets, err := ac.ServicePrincipalSecrets.ListByServicePrincipalId(ctx, spIdNumeric)
7983
if err != nil {

0 commit comments

Comments
 (0)