-
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
New Resource - azurerm_signalr_service_custom_certificate
#21112
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 @xiaxyi, thanks for this. I've left a couple of comments inline for you to consider and then we can take another look at this. Thanks!
if _, err := client.CustomCertificatesCreateOrUpdate(ctx, id, customCert); err != nil { | ||
return fmt.Errorf("creating signalR custom certificate binding: %s: %+v", id, err) | ||
} | ||
|
||
stateConf := &pluginsdk.StateChangeConf{ | ||
Pending: []string{string(signalr.ProvisioningStateCreating), string(signalr.ProvisioningStateUpdating), string(signalr.ProvisioningStateFailed)}, | ||
Target: []string{string(signalr.ProvisioningStateSucceeded)}, | ||
Refresh: signalrCustomCertBindingStateRefreshFunc(ctx, client, id), | ||
MinTimeout: 15 * time.Second, | ||
Timeout: 30 * time.Minute, | ||
} | ||
|
||
if _, err := stateConf.WaitForStateContext(ctx); err != nil { | ||
return fmt.Errorf("waiting for creation of %s: %+v", id, 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.
would it make sense to use something like client.CustomCertificatesCreateOrUpdateThenPoll
here?
} | ||
|
||
if err := client.CustomCertificatesCreateOrUpdateThenPoll(ctx, *id, *props); err != nil { | ||
return fmt.Errorf("creating signalR custom certificate binding: %s: %+v", id, 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.
return fmt.Errorf("creating signalR custom certificate binding: %s: %+v", id, err) | |
return fmt.Errorf("updating signalR custom certificate binding: %s: %+v", id, err) |
} | ||
} | ||
|
||
return nil, "", fmt.Errorf("error fetching the custom certificate provisioing state") |
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.
return nil, "", fmt.Errorf("error fetching the custom certificate provisioing state") | |
return nil, "", fmt.Errorf("error fetching the custom certificate provisioning state") |
"github.com/hashicorp/terraform-provider-azurerm/utils" | ||
) | ||
|
||
type CustomCertBindingSignalrModel struct { |
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.
type CustomCertBindingSignalrModel struct { | |
type CustomCertBindingSignalrResourceModel struct { |
"certificate_version": { | ||
Type: pluginsdk.TypeString, | ||
Optional: true, | ||
Computed: true, |
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.
does this need to be computed?
azurerm_signalr_custom_certificate_binding
azurerm_signalr_service_custom_certificate
Thansk @catriona-m for the review and suggestions! I renamed the resource to Completed the test cases and removed the status check function as I the polling function itself is checking the resource provisioning status. Feel free to let me know if you have any other suggestions! |
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.
LGTM 🍰
This functionality has been released in v3.51.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
acc test:
--- PASS: TestAccCustomCertBindingSignalrService_basic (619.70s)
PASS
ok github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr 620.378s