-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
azurerm_key_vault_certificate return thumbprint as hex #1904
Conversation
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.
Hi @steve-hawkins,
Thank you for the PR adding this property, I have left two comments inline with the blocker being the nil check.
Look forward to getting this merged for you once that is resolved 🙂
@@ -349,6 +357,16 @@ func resourceArmKeyVaultCertificateRead(d *schema.ResourceData, meta interface{} | |||
if contents := cert.Cer; contents != nil { | |||
d.Set("certificate_data", string(*contents)) | |||
} | |||
|
|||
x509Thumbprint, err := base64.RawURLEncoding.DecodeString(string(*cert.X509Thumbprint)) |
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.
Could we get a nil check here?
if v := cert.X509Thumbprint; v != nil {
x509Thumbprint, err := base64.RawURLEncoding.DecodeString(string(*v))
|
||
x509ThumbprintHex := hex.EncodeToString(x509Thumbprint) | ||
|
||
d.Set("thumbprint", strings.ToUpper(x509ThumbprintHex)) |
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.
very minor, but we could combine these two lines as such: d.Set("thumbprint", strings.ToUpper(hex.EncodeToString(x509Thumbprint)))
Hi @katbyte thanks for looking into this one All updated |
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.
hey @steve-hawkins
Thanks for this PR :)
I've taken a look through and this now LGTM - if we can add the documentation entry for this field we should be able to get this merged 👍
Thanks!
if err != nil { | ||
return err | ||
} | ||
d.Set("thumbprint", strings.ToUpper(hex.EncodeToString(x509Thumbprint))) |
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.
I'm assuming the thumbprint is case insensitive?
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.
I think the cluster will accept lowercase, I was trying to replicate as close as possible what the Azure CLI returns
@tombuildsstuff documentation has now been updated, thanks for the heads up as this will make it easier for my next PR which should be coming shortly |
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.
Thanks for the quick updates @steve-hawkins, and noticing the missing docs @tombuildsstuff,
This LGTM now 💯
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks! |
this is off the back of #1851
will return the thumbprint in hex for certificates, much like the x509ThumbprintHex returned in the Azure CLI command:-
Can be used like:-
(fixes #1851)