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

New Resource - azurerm_signalr_service_custom_certificate #21112

Merged
merged 13 commits into from
Apr 1, 2023

Conversation

xiaxyi
Copy link
Contributor

@xiaxyi xiaxyi commented Mar 24, 2023

acc test:
--- PASS: TestAccCustomCertBindingSignalrService_basic (619.70s)
PASS
ok github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr 620.378s

Copy link
Member

@catriona-m catriona-m left a 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!

Comment on lines 124 to 138
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)
}
Copy link
Member

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)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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 {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
type CustomCertBindingSignalrModel struct {
type CustomCertBindingSignalrResourceModel struct {

"certificate_version": {
Type: pluginsdk.TypeString,
Optional: true,
Computed: true,
Copy link
Member

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?

@xiaxyi xiaxyi changed the title New Resource - azurerm_signalr_custom_certificate_binding New Resource - azurerm_signalr_service_custom_certificate Mar 28, 2023
@xiaxyi
Copy link
Contributor Author

xiaxyi commented Mar 28, 2023

Thansk @catriona-m for the review and suggestions!

I renamed the resource to azurerm_signalr_service_custom_certificate to make it the same as another signalr sub-resources.

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!

Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

LGTM 🍰

@katbyte katbyte merged commit e236dd2 into hashicorp:main Apr 1, 2023
katbyte added a commit that referenced this pull request Apr 1, 2023
@github-actions github-actions bot added this to the v3.51.0 milestone Apr 1, 2023
katbyte added a commit that referenced this pull request Apr 7, 2023
@github-actions
Copy link

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!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 11, 2024
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.

3 participants