-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Add azurerm_key_vault_certificate_issuer #7074
Conversation
7aaf9af
to
9e68b7c
Compare
7c53815
to
8d212b5
Compare
I've only been force-pushing to keep up to date with master. Other than that this should be ready. |
@katbyte @tombuildsstuff I've been using this for a while and seems to work fine; is there anything missing? |
It is required when you have an actual account with the provider, e.g.
DigiCert.
…On Sun, 14 Jun 2020, 19:41 Paul Wiens, ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In website/docs/r/key_vault_certificate_issuer.html.markdown
<#7074 (comment)>
:
> +
+resource "azurerm_key_vault_certificate_issuer" "example" {
+ name = "example-issuer"
+ org_id = "0000"
+ key_vault_id = data.azurerm_key_vault.example.id
+ provider_name = "DigiCert"
+ account_id = "0000"
+ password = "example-password"
+}
+```
+
+## Arguments Reference
+
+The following arguments are supported:
+
+* `account_id` - (Required) The account number with the third-party Certificate Issuer.
This isn't actually required. I have a fork that implements this same
resource provider and passing anything other than key_keyvault_id,
provider_name, and name isn't required.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#7074 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADH5IMHXU6PNBKEQW4HBI3RWUDS7ANCNFSM4NJV3R5A>
.
|
I would love it if this got merged. I've been waiting for this feature since 2.0 |
Rebased on the main branch and resolved contention from the newly added |
I'd love for this to get merged too. @pwiens Was it company policy or something that prevented you from contributing your fork? |
@sirlatrom This is the first time I've touched go code and I didn't feel comfortable enough putting together a PR with decent tests. I was going to invest some time in doing that but I saw your PR and the issue you opened. Thanks for taking the time to do the work. |
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 @sirlatrom
Thanks for this PR for new resource and data source, it's off to a good start, and apologies for the fairly rushed review here (but I did promise I'd try to get to it today!).
I've made some comments and suggestions below on the code. I've not covered the testing or docs fully yet, but I'll loop back to that after you've had a look at the review so far. (I will mention that the tests for the data source are missing and we would want to see a requiresImport
and an update
test on the resource.)
azurerm/internal/services/keyvault/key_vault_certificate_issuer_data_source.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/keyvault/key_vault_certificate_issuer_data_source.go
Outdated
Show resolved
Hide resolved
d.Set("org_id", resp.OrganizationDetails.ID) | ||
d.Set("account_id", resp.Credentials.AccountID) |
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 these should probably be nil checked before setting, if the response is missing elements for some reason we'll get a panic here.
azurerm/internal/services/keyvault/key_vault_certificate_issuer_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/keyvault/key_vault_certificate_issuer_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/keyvault/key_vault_certificate_issuer_resource.go
Show resolved
Hide resolved
d.Set("org_id", resp.OrganizationDetails.ID) | ||
d.Set("account_id", resp.Credentials.AccountID) | ||
d.Set("password", resp.Credentials.Password) |
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.
These (OrganizationDetails
and Credentials
) are potentially nil, so should probably be nil checked before attempting to set the schema attributes to the values contained within to avoid panic.
name := d.Get("name").(string) | ||
keyVaultId := d.Get("key_vault_id").(string) |
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.
We should get the information to make the Read
call from the ID in the state (using d.Id()
), rather than the config, this allows us to understand the difference between the config and what Terraform last knew about.
if utils.ResponseWasNotFound(resp.Response) { | ||
return fmt.Errorf("KeyVault Certificate Issuer %q (KeyVault URI %q) does not exist", name, keyVaultBaseUri) | ||
} | ||
return fmt.Errorf("Error making Read request on Azure KeyVault Certificate Issuer %s: %+v", name, err) |
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.
As above, re: removing duplication of the word Error
from message output
name := d.Get("name").(string) | ||
keyVaultId := d.Get("key_vault_id").(string) |
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.
As with Read
, Delete
should use the state for this information.
@jackofallops Just missing the datasource tests now, but perhaps you could already now validate the changes to the rest of the PR? |
@jackofallops I've added a very basic test of the datasource. What is the expected level of detail? |
Thanks! Usually we create an example resource and ensure that each expected exported attribute in the data source is populated as expected. I'll re-review now, sorry for the delay in looping back. |
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 @sirlatrom
Thanks for the updates and great work so far, a few more changes noted below (sorry, I missed a couple things last pass). I've also left a question around the change to the custom poller for certificate creation, if you can explain the scenario you're looking to mitigate I can review that again.
Thanks again!
azurerm/internal/services/keyvault/key_vault_certificate_issuer_data_source.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/keyvault/key_vault_certificate_issuer_data_source.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/keyvault/key_vault_certificate_issuer_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/keyvault/key_vault_certificate_issuer_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/keyvault/key_vault_certificate_issuer_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/keyvault/key_vault_certificate_issuer_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/keyvault/key_vault_certificate_issuer_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/keyvault/key_vault_certificate_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/keyvault/tests/key_vault_certificate_issuer_data_source_test.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/keyvault/tests/key_vault_certificate_issuer_resource_test.go
Outdated
Show resolved
Hide resolved
Hi @jackofallops, A quick answer regarding the poller: Our issuer turns out to include manual processing on the issuer's side, with an initial estimated time returned in a message that would be frail to parse. They do however have a SLA that should fall within the updated timeouts. Alternatively, the timeouts could be exposed as attributes, too. I'll handle the other review items early next week. |
Signed-off-by: Sune Keller <[email protected]>
Signed-off-by: Sune Keller <[email protected]> Co-authored-by: Steve <[email protected]>
Signed-off-by: Sune Keller <[email protected]>
Signed-off-by: Sune Keller <[email protected]>
Signed-off-by: Sune Keller <[email protected]>
Signed-off-by: Sune Keller <[email protected]>
Signed-off-by: Sune Keller <[email protected]>
Signed-off-by: Sune Keller <[email protected]>
Signed-off-by: Sune Keller <[email protected]> Co-authored-by: Steve <[email protected]>
Signed-off-by: Sune Keller <[email protected]>
Signed-off-by: Sune Keller <[email protected]>
Signed-off-by: Sune Keller <[email protected]> Co-authored-by: Tom Harvey <[email protected]>
Signed-off-by: Sune Keller <[email protected]>
Signed-off-by: Sune Keller <[email protected]>
Signed-off-by: Sune Keller <[email protected]>
Signed-off-by: Sune Keller <[email protected]>
@tombuildsstuff @jackofallops I've applied your suggestions and also rebased on origin/ |
Thanks @sirlatrom - I've just fixed a minor issue we introduced along the way, so hopefully travis will be happy now. As soon as that goes green I think we're good to rerun the tests and, all being well, get this merged in. |
This has been released in version 2.18.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example: provider "azurerm" {
version = "~> 2.18.0"
}
# ... other configuration ... |
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! |
Fixes #7073.