-
Notifications
You must be signed in to change notification settings - Fork 542
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
Resolve TF state for PKI Multi-Issuer workflows #1973
Conversation
if err != nil { | ||
return err | ||
var cert *x509.Certificate | ||
isIssuerAPISupported := provider.IsAPISupported(meta, provider.VaultVersion111) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prior to multi-issuer support (<= Vault 1.10), this customize diff would read the default CA in PEM format and compare to what was in the TF state. When there is only one issuer, this makes sense since it will be the default. However, for multiple issuers, all Root Cert resources that are not the default issuer will be forced to be recreated. This was leading users into a constant create-destroy cycle when multiple root certs were added in a TF file.
This update now correctly read the specific issuer's certificate in PEM format, and compare to what is in the TF state. If there is a change in the certificate, the Root Cert is recreated. Also, if an issuer is deleted outside of TF, this update correctly resolves the state by recreating the resource.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
This PR aims to address/fix the following issues:
key_name
,key_ref
) not being written to Vault due to inaccurate conditionals.CustomizeDiff
function not accounting for multi-issuer support. Previously, we were comparing the serials for all root certs to thedefault
issuer's PEM certificate. The function has now been updated to read the PEM certificate for a specific issuer with anissuer_id
and compare with the correct serialFixes #1943 #1944 #1968
Release note for CHANGELOG: