Skip to content

Add support to set default issuers configuration for PKI Secrets Engine - #1937

Merged
vinay-gopalan merged 6 commits into
mainfrom
VAULT-17755/add-pki-config-issuers
Jul 12, 2023
Merged

Add support to set default issuers configuration for PKI Secrets Engine#1937
vinay-gopalan merged 6 commits into
mainfrom
VAULT-17755/add-pki-config-issuers

Conversation

@vinay-gopalan

Copy link
Copy Markdown
Contributor

Adds a new resource with relevant tests and documentation that allows users to set the default issuer under a mount.

@fairclothjm fairclothjm self-assigned this Jul 12, 2023
var pkiSecretBackendFromConfigIssuersPathRegex = regexp.MustCompile("^(.+)/config/issuers")

const (
fieldDefaultFollowsLatestIssuer = "default_follows_latest_issuer"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this might be a good spot for an example to showcase that if a schema field seems very specific to only a single resource, we need not export it out of the package and needlessly bulk up our consts package. Instead, we can define an unexported constant within the same file. However, if this feels a bit unclean, I'm happy to move it to the constants package

leading or trailing `/`s.

* `default` - (Required) Specifies the default issuer using the issuer ID.
**NOTE:** It is recommended to only set the default issuer using the ID.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Vault, one can provide both the issuer name and issuer ID to set this field. However, since the Vault response only ever returns the issuer ID for this field, there can be a drift in the TF state if we provide an issuer name but Vault returns an issuer ID. I opted to document for now that we recommend only using the ID (since that is fairly easy to do in TF), but in the future if users feel like they specifically want to be able to set this parameter by the issuer name we can always add an additional read-only schema field that will store the ID separately (thereby removing any drifts)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! thanks for the context!

Comment thread vault/resource_pki_secret_backend_config_issuers_test.go

@robmonte robmonte left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Let me know if my question doesn't apply in this context.

Comment thread vault/resource_pki_secret_backend_config_issuers.go Outdated
Comment thread website/docs/r/pki_secret_backend_config_issuers.html.md Outdated
Comment thread website/docs/r/pki_secret_backend_config_issuers.html.md Outdated

@fairclothjm fairclothjm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just a few suggestions

vinay-gopalan and others added 2 commits July 12, 2023 13:19
Co-authored-by: John-Michael Faircloth <fairclothjm@users.noreply.github.com>
@vinay-gopalan
vinay-gopalan merged commit 43da33d into main Jul 12, 2023
@vinay-gopalan vinay-gopalan added this to the 3.18.0 milestone Jul 12, 2023
@vinay-gopalan
vinay-gopalan deleted the VAULT-17755/add-pki-config-issuers branch July 12, 2023 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants