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_hpc_cache #5528

Merged
merged 27 commits into from
Mar 5, 2020
Merged

New Resource: azurerm_hpc_cache #5528

merged 27 commits into from
Mar 5, 2020

Conversation

aqche
Copy link
Contributor

@aqche aqche commented Jan 26, 2020

Fixes: #5504

Adds the azurerm_hpc_cache resource.

@ghost ghost added the size/XL label Jan 26, 2020
@ghost ghost added dependencies size/XXL and removed size/XL labels Jan 26, 2020
@ghost ghost added the documentation label Jan 27, 2020
@aqche aqche changed the title [WIP] New Resource: azurerm_hpc_cache New Resource: azurerm_hpc_cache Jan 31, 2020
@aqche aqche marked this pull request as ready for review January 31, 2020 02:46
@aqche
Copy link
Contributor Author

aqche commented Jan 31, 2020

PR should be ready for review now.

One note is I didn't add support for tags b/c I was running into a strange issue where client.Get always returned the tags that the cache was initially created with despite if they changed. (For example. I deployed a HPC Cache with a label:test tag. And although I was able to update the tags withclient.CreateOrUpdate to label:test1 and see the changes in the portal, client.Get still returned label:test.)

@aqche
Copy link
Contributor Author

aqche commented Jan 31, 2020

Tests Pass:

=== RUN   TestAccAzureRMHPCCache_basic
=== PAUSE TestAccAzureRMHPCCache_basic
=== CONT  TestAccAzureRMHPCCache_basic
--- PASS: TestAccAzureRMHPCCache_basic (1609.49s)
PASS
ok      github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/storagecache/tests  1609.518s

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 @aqche

Thanks for this PR - apologies for the delayed review here!

I've taken a look through and left some comments inline, but this is mostly looking good to me - I'll send a request to opt us into the HPC Cache RP now too 👍

Thanks!

website/allowed-subcategories Outdated Show resolved Hide resolved
website/docs/r/hpc_cache.html.markdown Outdated Show resolved Hide resolved
website/docs/r/hpc_cache.html.markdown Outdated Show resolved Hide resolved
HPC Cache can be imported using the `resource id`, e.g.

```shell
terraform import azurerm_hpc_cache.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.StorageCache/caches/cacheName
Copy link
Contributor

Choose a reason for hiding this comment

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

since this is a new Resource Provider (Microsoft.StorageCache) could we add that to this list

website/docs/r/hpc_cache.html.markdown Outdated Show resolved Hide resolved
website/docs/r/hpc_cache.html.markdown Outdated Show resolved Hide resolved
website/docs/r/hpc_cache.html.markdown Outdated Show resolved Hide resolved
@@ -2224,6 +2224,15 @@
</ul>
</li>

<li>
<a href="#">Storage Cache Resources</a>
Copy link
Contributor

Choose a reason for hiding this comment

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

rather than making this it's own group could we move this into the Storage list?

// SupportedResources returns the supported Resources supported by this Service
func (r Registration) SupportedResources() map[string]*schema.Resource {
return map[string]*schema.Resource{
"azurerm_hpc_cache": resourceArmHPCCache(),
Copy link
Contributor

Choose a reason for hiding this comment

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

rather than making this it's own service could we move this into the Storage service, since it forms part of that?


return &Client{
CachesClient: &cachesClient,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

rather than making this it's own service could we move this into the Storage service, since it forms part of that?

@aqche
Copy link
Contributor Author

aqche commented Feb 11, 2020

Looks like website-lint is failing to something unrelated to these PR changes.

edit: fixed after merging master in

Copy link
Collaborator

@WodansSon WodansSon left a comment

Choose a reason for hiding this comment

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

@aqche , Thanks for the PR and pushing the updates... This LGTM now! 🚀

return fmt.Errorf("Error creating HPC Cache %q (Resource Group %q): %+v", name, resourceGroup, err)
}

stateConf := &resource.StateChangeConf{
Copy link
Collaborator

@magodo magodo Feb 28, 2020

Choose a reason for hiding this comment

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

@aqche
I may be dumb here, why not just use future.WaitForCompletionRef() here? Is there some limitation about this API?

Copy link
Contributor Author

@aqche aqche Feb 28, 2020

Choose a reason for hiding this comment

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

@magodo thanks for calling that out, it actually slipped my mind to try future.WaitForCompletionRef() here first. I'll give it a test and report back.

update: worked like a charm!

@aqche
Copy link
Contributor Author

aqche commented Feb 28, 2020

@tombuildsstuff @WodansSon made a small update to use future.WaitForCompletionRef() as suggested by @magodo. Feel free to review the PR again whenever ya'll have time!

=== RUN   TestAccAzureRMHPCCache_basic
=== PAUSE TestAccAzureRMHPCCache_basic
=== CONT  TestAccAzureRMHPCCache_basic
--- PASS: TestAccAzureRMHPCCache_basic (1701.61s)
PASS
ok      github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/storage/tests       1701.700s

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.

Thanks for the revisions @aqche, have left some additional mostly minor comments that once addressed this should be good to merge

Comment on lines 146 to 151
id, err := azure.ParseAzureResourceID(d.Id())
if err != nil {
return err
}
resourceGroup := id.ResourceGroup
name := id.Path["caches"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

We are starting to write Parse ID functions for all resources, you can see an example here: #5779


Manages a HPC Cache.

~> **Note**: During the first several months of the GA release, a request must be made to the Azure HPC Cache team to add your subscription to the access list before it can be used to create a cache instance.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we add a link to where a user could do that?

Comment on lines 26 to 27
location = "${azurerm_resource_group.example.location}"
resource_group_name = "${azurerm_resource_group.example.name}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we use .12 syntax for the docs?

website/docs/r/hpc_cache.html.markdown Show resolved Hide resolved
website/docs/r/hpc_cache.html.markdown Show resolved Hide resolved
@aqche
Copy link
Contributor Author

aqche commented Feb 29, 2020

@katbyte, thanks for the review! make the updates you suggested 👍

Resource Test:

=== RUN   TestAccAzureRMHPCCache_basic
=== PAUSE TestAccAzureRMHPCCache_basic
=== CONT  TestAccAzureRMHPCCache_basic
--- PASS: TestAccAzureRMHPCCache_basic (1439.18s)
PASS
ok      github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/storage/tests       1439.417s

Parser Test:

go test hpc_cache.go hpc_cache_test.go
ok      command-line-arguments  0.009s

@ghost ghost removed the waiting-response label Feb 29, 2020
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.

Thanks for the revisions @aqche, LGTM aside from one missed comment, as per toms request we need to add this to the list of required resource providers. once that is done this is good to merge

@@ -62,6 +62,7 @@ func RequiredResourceProviders() map[string]struct{} {
"Microsoft.ServiceFabric": {},
"Microsoft.Sql": {},
"Microsoft.Storage": {},
"Microsoft.StorageCache": {},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@katbyte i've updated the RequiredResourceProviders func here. let me know if this is correct. thanks!

@aqche
Copy link
Contributor Author

aqche commented Mar 2, 2020

@katbyte thanks for reviewing the PR again! added a review comment addressing your last request. (just commenting so the waiting-response tag gets removed)

@ghost ghost removed the waiting-response label Mar 2, 2020
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.

Thanks @aqche! LGTM, now just waiting on approval from the HPC team so we can test this.

@katbyte katbyte added this to the v2.1.0 milestone Mar 5, 2020
@katbyte katbyte merged commit 4858607 into hashicorp:master Mar 5, 2020
katbyte added a commit that referenced this pull request Mar 5, 2020
@aqche aqche deleted the azurerm_hpc_cache branch March 6, 2020 00:00
@ghost
Copy link

ghost commented Mar 11, 2020

This has been released in version 2.1.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.1.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Apr 5, 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 Apr 5, 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.

Support for Azure HPC Cache
5 participants