-
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_machine_learning_workspace #5696
New Resource: azurerm_machine_learning_workspace #5696
Conversation
4aa6624
to
0e3b15e
Compare
0e3b15e
to
ec02938
Compare
This PR depends on the SDK v39.0.0 |
863c148
to
228dced
Compare
1d4c4fc
to
315fe8c
Compare
5cbbe12
to
b60d268
Compare
@cbellee, @ArcturusZhang - i've opened a PR (#6049) to upgrade the SDK as we typically do that separately on their own. 2.1 should go out in the next couple days and this will get merged right after. |
Sure, I will rebase this PR once PR #6049 get merged |
This PR supersedes #6049 as nested go modules and merge conflicts do not spark joy - but fundamentally this: - updates github.com/Azure/azure-sdk-for-go to v40.3.0 - updates github.com/Azure/go-autorest to our fork containing Azure/go-autorest#512 - updates github.com/terraform-providers/terraform-provider-azuread to v0.8.0 - code changes needed for v40.3.0 of the Azure SDK - including opting into the old count 429's as requests which should be retried without adding to the total failure count Enables #5769 Enables #5696
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 @cbellee,
thanks for the new resource! this is off to a great start and most of my comments are pretty minor. Once they are addressed this should be good ot merge!
_, err = client.Update(ctx, id.ResourceGroup, id.Name, update) | ||
if err != nil { |
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.
could we merge these two lines?
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.
Done
_, err = client.Delete(ctx, id.ResourceGroup, id.Name) | ||
if err != nil { |
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.
could we merge these two lines?
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.
Done
|
||
* `friendly_name` - (Optional) Friendly name for this Machine Learning Workspace. | ||
|
||
* `sku_name` - (Optional) SKU/edition of the Machine Learning Workspace, possible values are `Basic` for a basic workspace or `Enterprise` for a feature rich workspace. Default to `Basic`. |
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.
* `sku_name` - (Optional) SKU/edition of the Machine Learning Workspace, possible values are `Basic` for a basic workspace or `Enterprise` for a feature rich workspace. Default to `Basic`. | |
* `sku_name` - (Optional) SKU/edition of the Machine Learning Workspace, possible values are `Basic` for a basic workspace or `Enterprise` for a feature rich workspace. Defaults to `Basic`. |
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.
Done
}) | ||
} | ||
|
||
func TestAccAzureRMMachineLearningWorkspace_withTags(t *testing.T) { |
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 can just merge this with the complete test (and i notice that test isn't setting the tags, it should set as many of the properties as possible)
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.
Sure
azurerm/internal/services/machinelearning/tests/resource_arm_machine_learning_workspace_test.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/machinelearning/tests/data_source_machine_learning_workspace_test.go
Show resolved
Hide resolved
description := d.Get("description").(string) | ||
update.WorkspacePropertiesUpdateParameters.Description = &description |
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.
minor these could be
description := d.Get("description").(string) | |
update.WorkspacePropertiesUpdateParameters.Description = &description | |
update.WorkspacePropertiesUpdateParameters.Description = &utils.String(d.Get("description").(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.
Done, and I also changed some other field assignment with similar pattern
Hi @katbyte I have resolved your comments. And according to Tom's comments in other PR that I spotted recently, I have removed the Plus, since I am neither the author of this PR nor reviewer, I cannot resolve those comment thread, hope you do not mind. |
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.
Thanks for the revisions @ArcturusZhang,
In addition to the comments i've left inline we have a test failure:
Test Failed
------- Stdout: -------
=== RUN TestAccDataSourceAzureRMMachineLearningWorkspace_basic
=== PAUSE TestAccDataSourceAzureRMMachineLearningWorkspace_basic
=== CONT TestAccDataSourceAzureRMMachineLearningWorkspace_basic
--- FAIL: TestAccDataSourceAzureRMMachineLearningWorkspace_basic (332.82s)
testing.go:640: Step 1 error: 11 problems:
- Provider produced invalid object: Provider "azurerm" planned an invalid value for data.azurerm_machine_learning_workspace.test during refresh: unsupported attribute "identity".
This is a bug in the provider, which should be reported in the provider's own issue tracker.
- Provider produced invalid object: Provider "azurerm" planned an invalid value for data.azurerm_machine_learning_workspace.test during refresh: unsupported attribute "key_vault_id".
This is a bug in the provider, which should be reported in the provider's own issue tracker.
- Provider produced invalid object: Provider "azurerm" planned an invalid value for data.azurerm_machine_learning_workspace.test during refresh: unsupported attribute "application_insights_id".
This is a bug in the provider, which should be reported in the provider's own issue tracker.
- Provider produced invalid object: Provider "azurerm" planned an invalid value for data.azurerm_machine_learning_workspace.test during refresh: unsupported attribute "description".
This is a bug in the provider, which should be reported in the provider's own issue tracker.
- Provider produced invalid object: Provider "azurerm" planned an invalid value for data.azurerm_machine_learning_workspace.test during refresh: unsupported attribute "sku_name".
This is a bug in the provider, which should be reported in the provider's own issue tracker.
- Provider produced invalid object: Provider "azurerm" planned an invalid value for data.azurerm_machine_learning_workspace.test during refresh: unsupported attribute "friendly_name".
This is a bug in the provider, which should be reported in the provider's own issue tracker.
- Provider produced invalid object: Provider "azurerm" planned an invalid value for data.azurerm_machine_learning_workspace.test during refresh: unsupported attribute "storage_account_id".
This is a bug in the provider, which should be reported in the provider's own issue tracker.
- Provider produced invalid object: Provider "azurerm" planned an invalid value for data.azurerm_machine_learning_workspace.test during refresh: unsupported attribute "container_registry_id".
This is a bug in the provider, which should be reported in the provider's own issue tracker.
- Provider produced invalid object: Provider "azurerm" planned an invalid value for data.azurerm_machine_learning_workspace.test during refresh: .timeouts: unsupported attribute "update".
This is a bug in the provider, which should be reported in the provider's own issue tracker.
- Provider produced invalid object: Provider "azurerm" planned an invalid value for data.azurerm_machine_learning_workspace.test during refresh: .timeouts: unsupported attribute "create".
This is a bug in the provider, which should be reported in the provider's own issue tracker.
- Provider produced invalid object: Provider "azurerm" planned an invalid value for data.azurerm_machine_learning_workspace.test during refresh: .timeouts: unsupported attribute "delete".
This is a bug in the provider, which should be reported in the provider's own issue tracker.
Location: &location, | ||
Tags: tags.Expand(t), | ||
Sku: &machinelearningservices.Sku{Name: utils.String(skuName)}, | ||
Identity: identity, |
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.
Given that this is always required, i think we could
Identity: identity, | |
Identity: utils.String(d.Get("identity.0.type").(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.
Well, identity is a block, therefore I bring the definition of identity
here in the struct initialization
"sku_name": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
ValidateFunc: validation.StringInSlice([]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.
could we put default just before the validation function?
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.
Done
azurerm/internal/services/machinelearning/data_source_machine_learning_workspace.go
Show resolved
Hide resolved
%s | ||
|
||
resource "azurerm_machine_learning_workspace" "test" { | ||
name = "acctestworkspace-%d" |
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.
could we include capitals in every property that allows them:
name = "acctestworkspace-%d" | |
name = "acctest-MLW-%d" |
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.
Done
Hi @katbyte I have resolved the new comments, and find I missed the |
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.
Thanks for the fixed @ArcturusZhang, tests pass now! LGTM 👍
func expandArmMachineLearningWorkspaceIdentity(input []interface{}) *machinelearningservices.Identity { | ||
if len(input) == 0 { | ||
return nil | ||
} | ||
|
||
v := input[0].(map[string]interface{}) | ||
|
||
identityType := machinelearningservices.ResourceIdentityType(v["type"].(string)) | ||
|
||
identity := machinelearningservices.Identity{ | ||
Type: identityType, | ||
} | ||
|
||
return &identity | ||
} |
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.
It was more if you did the complex d.Get
you could have removed this entire function simplifying the code. minor so not going to block the PR on it
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 see, thank you!
This has been released in version 2.3.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.3.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! |
Terraform resource provider to create a basic Azure Machine Learning Workspace.
Test cases successfully passed
=== RUN TestAccAzureRMMachineLearningWorkspace_basic
=== PAUSE TestAccAzureRMMachineLearningWorkspace_basic
=== CONT TestAccAzureRMMachineLearningWorkspace_basic
=== RUN TestAccAzureRMMachineLearningWorkspace_requiresImport
=== PAUSE TestAccAzureRMMachineLearningWorkspace_requiresImport
=== CONT TestAccAzureRMMachineLearningWorkspace_requiresImport
=== RUN TestAccAzureRMMachineLearningWorkspace_withTags
=== PAUSE TestAccAzureRMMachineLearningWorkspace_withTags
=== CONT TestAccAzureRMMachineLearningWorkspace_withTags
=== RUN TestAccAzureRMMachineLearningWorkspace_withContainerRegistry
=== PAUSE TestAccAzureRMMachineLearningWorkspace_withContainerRegistry
=== CONT TestAccAzureRMMachineLearningWorkspace_withContainerRegistry
=== RUN TestAccAzureRMMachineLearningWorkspace_complete
=== PAUSE TestAccAzureRMMachineLearningWorkspace_complete
=== CONT TestAccAzureRMMachineLearningWorkspace_complete
--- PASS: TestAccAzureRMMachineLearningWorkspace_complete (547.09s)
--- PASS: TestAccAzureRMMachineLearningWorkspace_basic (593.96s)
--- PASS: TestAccAzureRMMachineLearningWorkspace_withContainerRegistry (610.00s)
--- PASS: TestAccAzureRMMachineLearningWorkspace_requiresImport (701.89s)
--- PASS: TestAccAzureRMMachineLearningWorkspace_withTags (836.34s)
PASS