-
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_inference_cluster
#11550
new resource azurerm_machine_learning_inference_cluster
#11550
Conversation
azurerm_machine_learning_inference_cluster
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 @gro1m - i've given this a quick review and it's off the a great start!
azurerm/internal/services/machinelearning/machine_learning_inference_cluster_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/machinelearning/machine_learning_inference_cluster_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/machinelearning/machine_learning_inference_cluster_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/machinelearning/machine_learning_inference_cluster_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/machinelearning/machine_learning_inference_cluster_resource_test.go
Outdated
Show resolved
Hide resolved
Default: false, | ||
}, | ||
|
||
"ssl_certificate_custom": { |
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 we can remove custom as its implied?
"ssl_certificate_custom": { | |
"ssl_certificate": { |
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 was thinking about doing a ssl_certificate_custom
and ssl_certificate_microsoft
block, but the Microsoft SSL configuration does not seem to work (just specifying leaf_domain_label
still requests cert and key files). In the second commit I just go for ssl
here and I removed the ssl_enabled
parameter as I think this can be implied if you specify non-empty certificates and keys.
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.
ssl_certificate/ssl_certificate_microsoft would 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.
Does that mean you are not happy with:
ssl {
cert = file("testdata/cert.pem")
key = file("testdata/key.pem")
cname = "www.contoso.com"
}
In principle the schema could be - correct me if I am wrong - improved in future (if the Microsoft bug does not occur - I think it is a bug) as follows:
"ssl": {
Type: schema.TypeSet,
Optional: true,
ForceNew: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"cert": {
Type: schema.TypeString,
Optional: true,
Default: "",
ConflictsWith: {"leaf_domain_label", "overwrite_existing_domain"},
},
"key": {
Type: schema.TypeString,
Optional: true,
Default: "",
ConflictsWith: {"leaf_domain_label", "overwrite_existing_domain"},
},
"cname": {
Type: schema.TypeString,
Optional: true,
Default: "",
ConflictsWith: {"leaf_domain_label", "overwrite_existing_domain"},
},
"leaf_domain_label": {
Type: schema.TypeString,
Optional: true,
Default: "",
ConflictsWith: {"cert", "key", "cname"},
},
"overwrite_existing_domain": {
Type: schema.TypeString,
Optional: true,
Default: "",
ConflictsWith: {"cert", "key", "cname"},
},
},
},
},
What do you think is best for possible future enhancements: 2 separate blocks with now only an "ssl_certificate" block or everything in the "ssl" block or if you want "ssl_certificate" block?
azurerm/internal/services/machinelearning/machine_learning_inference_cluster_resource.go
Show resolved
Hide resolved
I included the update now, but I expect it to fail: TF_ACC=1 go test -v ./azurerm/internal/services/machinelearning -run=TestAccInferenceCluster -timeout 60m -ldflags="-X=github.com/terraform-providers/terraform-provider-azurerm/version.ProviderVersion=acc"
2021/05/05 08:24:20 [DEBUG] not using binary driver name, it's no longer needed
2021/05/05 08:24:20 [DEBUG] not using binary driver name, it's no longer needed
=== RUN TestAccInferenceCluster_basic
=== PAUSE TestAccInferenceCluster_basic
=== RUN TestAccInferenceCluster_requiresImport
=== PAUSE TestAccInferenceCluster_requiresImport
=== RUN TestAccInferenceCluster_complete
=== PAUSE TestAccInferenceCluster_complete
=== RUN TestAccInferenceCluster_basicUpdate
=== PAUSE TestAccInferenceCluster_basicUpdate
=== RUN TestAccInferenceCluster_completeUpdate
=== PAUSE TestAccInferenceCluster_completeUpdate
=== CONT TestAccInferenceCluster_basicUpdate
=== CONT TestAccInferenceCluster_completeUpdate
=== CONT TestAccInferenceCluster_complete
=== CONT TestAccInferenceCluster_requiresImport
=== CONT TestAccInferenceCluster_basic
Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420799178" "Microsoft.MachineLearningServices" map[]}Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420797524" "Microsoft.MachineLearningServices" map[]}Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420791885" "Microsoft.MachineLearningServices" map[]}Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420797028" "Microsoft.MachineLearningServices" map[]}Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420799508" "Microsoft.MachineLearningServices" map[]}Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420799178" "Microsoft.MachineLearningServices" map[]}Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420797524" "Microsoft.MachineLearningServices" map[]}Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420791885" "Microsoft.MachineLearningServices" map[]}Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420797028" "Microsoft.MachineLearningServices" map[]}Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420799508" "Microsoft.MachineLearningServices" map[]}Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420799178" "Microsoft.MachineLearningServices" map[]}Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420799508" "Microsoft.MachineLearningServices" map[]}Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420797028" "Microsoft.MachineLearningServices" map[]}Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420791885" "Microsoft.MachineLearningServices" map[]}Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420797524" "Microsoft.MachineLearningServices" map[]}Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420799178" "Microsoft.MachineLearningServices" map[]}Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420799178" "Microsoft.MachineLearningServices" map[]}Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420797028" "Microsoft.MachineLearningServices" map[]}Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420797028" "Microsoft.MachineLearningServices" map[]}Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420791885" "Microsoft.MachineLearningServices" map[]}Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420791885" "Microsoft.MachineLearningServices" map[]}Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420797524" "Microsoft.MachineLearningServices" map[]}Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420797524" "Microsoft.MachineLearningServices" map[]}Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420799508" "Microsoft.MachineLearningServices" map[]}Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420799178" "Microsoft.MachineLearningServices" map[]}Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420797524" "Microsoft.MachineLearningServices" map[]}Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420791885" "Microsoft.MachineLearningServices" map[]}Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420797028" "Microsoft.MachineLearningServices" map[]}=== CONT TestAccInferenceCluster_basicUpdate
testing.go:620: Step 3/4 error: Error running apply:
Error: A resource with the ID "/subscriptions/b609167b-ec1b-406c-accc-dc6cb5df9f43/resourceGroups/acctestRG-ml-210505082420799178/providers/Microsoft.MachineLearningServices/workspaces/acctest-MLW2105050824207991/computes/AIC-21050578" already exists - to be managed via Terraform this resource needs to be imported into the State. Please see the resource documentation for "azurerm_machine_learning_inference_cluster" for more information.
on ../../../../../../../../var/folders/t2/y0zhp0x97q5bk_s_sjq4b3zh0000gn/T/tftest210209280/work723527519/config879850977/terraform_plugin_test.tf line 111, in resource "azurerm_machine_learning_inference_cluster" "test":
111: resource "azurerm_machine_learning_inference_cluster" "test" {
Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420799508" "Microsoft.MachineLearningServices" map[]}=== CONT TestAccInferenceCluster_completeUpdate
testing.go:620: Step 3/4 error: Error running apply:
Error: A resource with the ID "/subscriptions/b609167b-ec1b-406c-accc-dc6cb5df9f43/resourceGroups/acctestRG-ml-210505082420797028/providers/Microsoft.MachineLearningServices/workspaces/acctest-MLW2105050824207970/computes/AIC-21050528" already exists - to be managed via Terraform this resource needs to be imported into the State. Please see the resource documentation for "azurerm_machine_learning_inference_cluster" for more information.
on ../../../../../../../../var/folders/t2/y0zhp0x97q5bk_s_sjq4b3zh0000gn/T/tftest210209280/work965243913/config501865756/terraform_plugin_test.tf line 111, in resource "azurerm_machine_learning_inference_cluster" "test":
111: resource "azurerm_machine_learning_inference_cluster" "test" {
Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420799178" "Microsoft.MachineLearningServices" map[]}Debug: id = &{"b609167b-ec1b-406c-accc-dc6cb5df9f43" "acctestRG-ml-210505082420797028" "Microsoft.MachineLearningServices" map[]}--- PASS: TestAccInferenceCluster_requiresImport (947.45s)
--- PASS: TestAccInferenceCluster_basic (1009.88s)
--- PASS: TestAccInferenceCluster_complete (1015.03s)
--- FAIL: TestAccInferenceCluster_basicUpdate (1034.19s)
--- FAIL: TestAccInferenceCluster_completeUpdate (1038.56s)
FAIL
FAIL github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/machinelearning 1043.327s
FAIL
make: *** [acctests] Error 1 I have no clue what I am doing wrong, so if someone can help me with this I would be very happy |
e376dc1
to
94639c6
Compare
@katbyte I thought the git diff was incorrect (i.e. all lines changed), but I was looking at commit 1 instead of commit 2. So then I pushed 3 commits to fix that just to realize that there were unneccessary. In order not to pollute this PR I reset hard these three commits with: git reset --hard 94639c6f1
git push --force-with-lease The only problem we have now is that it states "16 workflows awaiting approval" instead of "8 workflows awaiting approval" - maybe has to do something with my "hard reset" - sorry about that. |
THanks @gro1m - have 5 failing tests now: |
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.
A few comments to give you an idea how I'd start here to rework it. This makes it easier to cut to functionality later together
azurerm/internal/services/machinelearning/machine_learning_inference_cluster_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/machinelearning/machine_learning_inference_cluster_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/machinelearning/machine_learning_inference_cluster_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/machinelearning/machine_learning_inference_cluster_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/machinelearning/machine_learning_inference_cluster_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/machinelearning/machine_learning_inference_cluster_resource.go
Outdated
Show resolved
Hide resolved
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.
Round 2 😄
Your changes make it a lot easier for me to go through your code, just some small remarks on minor details left.
I went a bit further and inspected your implementation against the API from a TF point of view. What I see is that you implemented and filled almost all possible fields of the objects. I have a suspicion it might be too much for a first implementation (and probably not necessary), especially as it requires information as input which is not exposed from the resource itself.
Nice job anyway, I think it's almost there if we can tweak the input parameters a bit!
azurerm/internal/services/machinelearning/machine_learning_inference_cluster_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/machinelearning/machine_learning_inference_cluster_resource.go
Show resolved
Hide resolved
azurerm/internal/services/machinelearning/machine_learning_inference_cluster_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/machinelearning/machine_learning_inference_cluster_resource.go
Outdated
Show resolved
Hide resolved
…-> no ignores in ImportStep anymore
azurerm/internal/services/machinelearning/machine_learning_inference_cluster_resource_test.go
Outdated
Show resolved
Hide resolved
a5aed24
to
650409e
Compare
Did also test here the latest stand and every test passes. TF_ACC=1 go test -v ./azurerm/internal/services/machinelearning -run=TestAccInferenceCluster -timeout 60m -ldflags="-X=github.com/terraform-providers/terraform-provider-azurerm/version.ProviderVersion=acc"
2021/05/19 21:43:59 [DEBUG] not using binary driver name, it's no longer needed
2021/05/19 21:43:59 [DEBUG] not using binary driver name, it's no longer needed
=== RUN TestAccInferenceCluster_basic
=== PAUSE TestAccInferenceCluster_basic
=== RUN TestAccInferenceCluster_requiresImport
=== PAUSE TestAccInferenceCluster_requiresImport
=== RUN TestAccInferenceCluster_complete
=== PAUSE TestAccInferenceCluster_complete
=== RUN TestAccInferenceCluster_completeProduction
=== PAUSE TestAccInferenceCluster_completeProduction
=== CONT TestAccInferenceCluster_basic
=== CONT TestAccInferenceCluster_completeProduction
=== CONT TestAccInferenceCluster_complete
=== CONT TestAccInferenceCluster_requiresImport
--- PASS: TestAccInferenceCluster_complete (898.54s)
--- PASS: TestAccInferenceCluster_requiresImport (917.88s)
--- PASS: TestAccInferenceCluster_completeProduction (951.42s)
--- PASS: TestAccInferenceCluster_basic (952.04s)
PASS
ok github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/machinelearning 957.246s |
@ArcturusZhang Am I right that there is no sense to update anything here?
|
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 @gro1m - LGTM 👍
This has been released in version 2.60.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.60.0"
}
# ... other configuration ... |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Fixes #11252
Test results:
PASS: TestAccInferenceCluster_requiresImport (858.19s)
--- PASS: TestAccInferenceCluster_custom_ssl_complete (899.78s)
--- PASS: TestAccInferenceCluster_basic (905.25s)
PASS
ok github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/machinelearning 910.925s
Notes for the reviewer: