Skip to content
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

r/key_vault_certificate: exposing the certificate data field #1200

Merged

Conversation

thomastaylor312
Copy link
Contributor

Every other key vault resource returns the data

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

hey @thomastaylor312

Thanks for this PR :)

I've taken a look through and this mostly LGTM - if we can fix up the potential crash this should be good to merge :)

Thanks!

@@ -339,6 +344,7 @@ func resourceArmKeyVaultCertificateRead(d *schema.ResourceData, meta interface{}
// Computed
d.Set("version", id.Version)
d.Set("secret_id", cert.Sid)
d.Set("certificate_data", string(*cert.Cer))
Copy link
Contributor

Choose a reason for hiding this comment

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

there's a potential for a crash here, can we make this:

if contents := cert.Cer; contents != nil {
  d.Set("certificate_data", string(*contents))
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was wondering about that. It seemed like a certificate should always be set, but I'll put in a check.

Copy link
Contributor

Choose a reason for hiding this comment

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

that's generally true - however the Azure API's return the state of a resource when it was last modified, rather than as it is right now (as such, it's possible it could be nil)

@tombuildsstuff tombuildsstuff changed the title feat(keyvault): Adds certificate data to the key vault resource r/key_vault_certificate: exposing the certificate data field May 4, 2018
@thomastaylor312
Copy link
Contributor Author

Ok, changes made! Thanks for the review @tombuildsstuff

@tombuildsstuff tombuildsstuff added this to the 1.5.0 milestone May 6, 2018
Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

hey @thomastaylor312

Thanks for pushing the latest changes - this now LGTM, so I'll kick off the test suite now 👍

Thanks!

@tombuildsstuff
Copy link
Contributor

Tests pass:

screen shot 2018-05-06 at 06 53 35

@tombuildsstuff tombuildsstuff merged commit e0a7e85 into hashicorp:master May 6, 2018
tombuildsstuff added a commit that referenced this pull request May 6, 2018
Also updating a couple of the older resource names to be correct
@thomastaylor312 thomastaylor312 deleted the feat/add_cert_data branch May 7, 2018 16:30
@ghost
Copy link

ghost commented Mar 31, 2020

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 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants