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_machine_learning_inference_cluster #11550

Merged

Conversation

gro1m
Copy link
Contributor

@gro1m gro1m commented May 1, 2021

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:

  1. Update did not work -> Tests commented out, but functionality left in. I do not know where the mistake lies, but I guess I cannot let the update in, when the tests fail. Hoping the reviewer can suggest a fix for the tests.
  2. Microsoft SSL Certificates did not work, even after passing cert and key as was requested by the error message -> not included.
  3. As the Inference Cluster attaches to a Kubernetes Service of Type machinelearningservices.AKS unfortunately not all properties could be retrieved (via containerservice.AKS), namely "description", "cluster purpose" and the (custom) SSL Configuration.

@gro1m gro1m changed the title Add support for Azure Machine Learning Inference Cluster Resource new resource azurerm_machine_learning_inference_cluster May 1, 2021
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 @gro1m - i've given this a quick review and it's off the a great start!

Default: false,
},

"ssl_certificate_custom": {
Copy link
Collaborator

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?

Suggested change
"ssl_certificate_custom": {
"ssl_certificate": {

Copy link
Contributor Author

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.

Copy link
Collaborator

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

Copy link
Contributor Author

@gro1m gro1m May 5, 2021

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?

@gro1m
Copy link
Contributor Author

gro1m commented May 5, 2021

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

@ghost ghost removed the waiting-response label May 5, 2021
@gro1m gro1m force-pushed the r/azurerm_machine_learning_inference_cluster branch from e376dc1 to 94639c6 Compare May 5, 2021 14:41
@gro1m
Copy link
Contributor Author

gro1m commented May 5, 2021

@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.
Apart from that, I should have addressed all your comments and I would be happy if you could further review:)

@katbyte
Copy link
Collaborator

katbyte commented May 7, 2021

THanks @gro1m - have 5 failing tests now:
image

Copy link
Collaborator

@aristosvo aristosvo left a 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

Copy link
Collaborator

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

@aristosvo
Copy link
Collaborator

aristosvo commented May 14, 2021

@katbyte @gro1m I took the liberty to update the docs and tests based on the last 2 comments to make it easier to comment on/review it.

Hope you don't mind 🥺

@gro1m gro1m requested a review from katbyte May 15, 2021 15:03
@aristosvo aristosvo force-pushed the r/azurerm_machine_learning_inference_cluster branch from a5aed24 to 650409e Compare May 15, 2021 17:42
@gro1m
Copy link
Contributor Author

gro1m commented May 19, 2021

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

@gro1m
Copy link
Contributor Author

gro1m commented May 19, 2021

@ArcturusZhang Am I right that there is no sense to update anything here?
I checked with @aristosvo, but we did not find anything useful to update nor did it work.
The only parameters that we found that may be updatable were:

  1. ssl -> we think that changes in SSL certificate should force the creation of a new inference cluster.
  2. tags -> also do not seem to be updatable nor setable via the Portal UI.

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 @gro1m - LGTM 👍

@katbyte katbyte added this to the v2.60.0 milestone May 19, 2021
@katbyte katbyte merged commit 57b1158 into hashicorp:master May 19, 2021
katbyte added a commit that referenced this pull request May 19, 2021
@gro1m gro1m deleted the r/azurerm_machine_learning_inference_cluster branch May 20, 2021 06:10
@ghost
Copy link

ghost commented May 21, 2021

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 ...

favoretti pushed a commit to gro1m/terraform-provider-azurerm that referenced this pull request May 26, 2021
favoretti pushed a commit to gro1m/terraform-provider-azurerm that referenced this pull request May 26, 2021
favoretti pushed a commit to gro1m/terraform-provider-azurerm that referenced this pull request May 26, 2021
favoretti pushed a commit to gro1m/terraform-provider-azurerm that referenced this pull request May 26, 2021
@github-actions
Copy link

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 20, 2021
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 Machine Learning Inference cluster (requires new resource)
3 participants