Skip to content

Commit

Permalink
SM docs fix (#5080)
Browse files Browse the repository at this point in the history
* SC addition

* SC addition

* SC addition

* update function updated

* SC unit tests added

* SC unit tests added

* d

* tests fixes

* tests fixes

* update sdk

* .secrets.baseline update

* .secrets.baseline update

* .secrets.baseline update

* Update sm_service_credentials_secret_metadata.html.markdown

* bugs fixes

* bugs fixes

* bugs fixes

* docs bugs fixes

* preferred_chain added for public cert lets encrypt configuration

* support for creating secret version for username password & version_custom_metadata for all

* support for creating secret version for username password & version_custom_metadata for all

* support for creating secret version for username password & version_custom_metadata for all

* support for creating secret version for username password & version_custom_metadata for all

* support for creating secret version for username password & version_custom_metadata for all

* support for creating secret version for username password & version_custom_metadata for all

* preferred chain docs update

* support for creating secret version for username password & version_custom_metadata for all

* support for creating secret version for username password & version_custom_metadata for all

* support for creating secret version for username password & version_custom_metadata for all

* fix public cert bug

---------

Co-authored-by: Yonathan-Yellin <[email protected]>
Co-authored-by: Avi Ribchinsky <[email protected]>
Co-authored-by: Tatyana <[email protected]>
Co-authored-by: Idan Adar <[email protected]>
Co-authored-by: HARINI KANTAREDDY <[email protected]>
  • Loading branch information
6 people authored Jan 30, 2024
1 parent ef4e365 commit 998a204
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": "go.mod|go.sum|.*.map|^.secrets.baseline$",
"lines": null
},
"generated_at": "2024-01-27T06:56:14Z",
"generated_at": "2024-01-29T11:06:53Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
Expand Down
29 changes: 16 additions & 13 deletions ibm/service/secretsmanager/resource_ibm_sm_public_certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -635,21 +635,24 @@ func resourceIbmSmPublicCertificateRead(context context.Context, d *schema.Resou
if err = d.Set("private_key", secret.PrivateKey); err != nil {
return diag.FromErr(fmt.Errorf("Error setting private_key: %s", err))
}
// Call get version metadata API to get the current version_custom_metadata
getVersionMetdataOptions := &secretsmanagerv2.GetSecretVersionMetadataOptions{}
getVersionMetdataOptions.SetSecretID(secretId)
getVersionMetdataOptions.SetID("current")

versionMetadataIntf, response, err := secretsManagerClient.GetSecretVersionMetadataWithContext(context, getVersionMetdataOptions)
if err != nil {
log.Printf("[DEBUG] GetSecretVersionMetadataWithContext failed %s\n%s", err, response)
return diag.FromErr(fmt.Errorf("GetSecretVersionMetadataWithContext failed %s\n%s", err, response))
}
if *secret.StateDescription == "active" {
// Call get version metadata API to get the current version_custom_metadata
getVersionMetdataOptions := &secretsmanagerv2.GetSecretVersionMetadataOptions{}
getVersionMetdataOptions.SetSecretID(secretId)
getVersionMetdataOptions.SetID("current")

versionMetadataIntf, response, err := secretsManagerClient.GetSecretVersionMetadataWithContext(context, getVersionMetdataOptions)
if err != nil {
log.Printf("[DEBUG] GetSecretVersionMetadataWithContext failed %s\n%s", err, response)
return diag.FromErr(fmt.Errorf("GetSecretVersionMetadataWithContext failed %s\n%s", err, response))
}

versionMetadata := versionMetadataIntf.(*secretsmanagerv2.PublicCertificateVersionMetadata)
if versionMetadata.VersionCustomMetadata != nil {
if err = d.Set("version_custom_metadata", versionMetadata.VersionCustomMetadata); err != nil {
return diag.FromErr(fmt.Errorf("Error setting version_custom_metadata: %s", err))
versionMetadata := versionMetadataIntf.(*secretsmanagerv2.PublicCertificateVersionMetadata)
if versionMetadata.VersionCustomMetadata != nil {
if err = d.Set("version_custom_metadata", versionMetadata.VersionCustomMetadata); err != nil {
return diag.FromErr(fmt.Errorf("Error setting version_custom_metadata: %s", err))
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ Review the argument reference that you can specify for your resource.
* Constraints: Allowable values are: `private`, `public`.
* `lets_encrypt_environment` - (Required, String) The configuration of the Let's Encrypt CA environment.
* Constraints: Allowable values are: `production`, `staging`.
* `lets_encrypt_preferred_chain` - (Optional, String) Prefer the chain with an issuer matching this Subject Common Name.
* Constraints: The maximum length is `30` characters. The minimum length is `2` characters. The value must match regular expression `/(.*?)/`.
* `lets_encrypt_preferred_chain` - (Optional, String) This field supports only the chains that Let's Encrypt provides. Keep empty to use the default or supply a valid Let's Encrypt-provided value. For a list of supported chains, see: https://letsencrypt.org/certificates/.
* Constraints: The value must match regular expression `/(.*?)/`.
* `lets_encrypt_private_key` - (Required, String) The PEM encoded private key of your Lets Encrypt account.
* Constraints: The maximum length is `100000` characters. The minimum length is `50` characters. The value must match regular expression `/(^-----BEGIN PRIVATE KEY-----.*?)/`.
* `name` - (Required, String) A human-readable unique name to assign to your configuration.
Expand Down

0 comments on commit 998a204

Please sign in to comment.