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

azurerm_machine_learning_inference_cluster - support for the ssl.leaf_domain_label and ssl. overwrite_existing_domain properties #11830

Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,39 @@ func resourceAksInferenceCluster() *pluginsdk.Resource {
Elem: &pluginsdk.Resource{
Schema: map[string]*pluginsdk.Schema{
"cert": {
Type: pluginsdk.TypeString,
Optional: true,
ForceNew: true,
Default: "",
Type: pluginsdk.TypeString,
Optional: true,
ForceNew: true,
Default: "",
ConflictsWith: []string{"ssl.0.leaf_domain_label", "ssl.0.overwrite_existing_domain"},
},
"key": {
Type: pluginsdk.TypeString,
Optional: true,
ForceNew: true,
Default: "",
Type: pluginsdk.TypeString,
Optional: true,
ForceNew: true,
Default: "",
ConflictsWith: []string{"ssl.0.leaf_domain_label", "ssl.0.overwrite_existing_domain"},
},
"cname": {
Type: pluginsdk.TypeString,
Optional: true,
ForceNew: true,
Default: "",
Type: pluginsdk.TypeString,
Optional: true,
ForceNew: true,
Default: "",
ConflictsWith: []string{"ssl.0.leaf_domain_label", "ssl.0.overwrite_existing_domain"},
},
"leaf_domain_label": {
Type: pluginsdk.TypeString,
Optional: true,
ForceNew: true,
Default: "",
ConflictsWith: []string{"ssl.0.cert", "ssl.0.key", "ssl.0.cname"},
},
"overwrite_existing_domain": {
Type: pluginsdk.TypeBool,
Optional: true,
ForceNew: true,
Default: "",
ConflictsWith: []string{"ssl.0.cert", "ssl.0.key", "ssl.0.cname"},
},
},
},
Expand Down Expand Up @@ -272,10 +289,17 @@ func expandSSLConfig(input []interface{}) *machinelearningservices.SslConfigurat
sslStatus = "Enabled"
}

if !(v["leaf_domain_label"].(string) == "") {
sslStatus = "Auto"
v["cname"] = ""
}

return &machinelearningservices.SslConfiguration{
Status: machinelearningservices.Status1(sslStatus),
Cert: utils.String(v["cert"].(string)),
Key: utils.String(v["key"].(string)),
Cname: utils.String(v["cname"].(string)),
Status: machinelearningservices.Status1(sslStatus),
Cert: utils.String(v["cert"].(string)),
Key: utils.String(v["key"].(string)),
Cname: utils.String(v["cname"].(string)),
LeafDomainLabel: utils.String(v["leaf_domain_label"].(string)),
OverwriteExistingDomain: utils.Bool(v["overwrite_existing_domain"].(bool)),
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,28 @@ func TestAccInferenceCluster_requiresImport(t *testing.T) {
})
}

func TestAccInferenceCluster_complete(t *testing.T) {
func TestAccInferenceCluster_completeCustomSSL(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_machine_learning_inference_cluster", "test")
r := InferenceClusterResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.complete(data),
Config: r.completeCustomSSL(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep("ssl"),
})
}

func TestAccInferenceCluster_completeMicrosoftSSL(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_machine_learning_inference_cluster", "test")
r := InferenceClusterResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.completeMicrosoftSSL(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
Expand Down Expand Up @@ -112,7 +127,7 @@ resource "azurerm_machine_learning_inference_cluster" "test" {
`, r.templateDevTest(data), data.RandomIntOfLength(8))
}

func (r InferenceClusterResource) complete(data acceptance.TestData) string {
func (r InferenceClusterResource) completeCustomSSL(data acceptance.TestData) string {
return fmt.Sprintf(`
%s

Expand All @@ -131,7 +146,28 @@ resource "azurerm_machine_learning_inference_cluster" "test" {
tags = {
ENV = "Test"
}
}
`, r.templateDevTest(data), data.RandomIntOfLength(8))
}

func (r InferenceClusterResource) completeMicrosoftSSL(data acceptance.TestData) string {
return fmt.Sprintf(`
%s

resource "azurerm_machine_learning_inference_cluster" "test" {
name = "AIC-%d"
machine_learning_workspace_id = azurerm_machine_learning_workspace.test.id
location = azurerm_resource_group.test.location
kubernetes_cluster_id = azurerm_kubernetes_cluster.test.id
cluster_purpose = "DevTest"
ssl {
leaf_domain_label = "contoso"
overwrite_existing_domain = true
}

tags = {
ENV = "Test"
}
}
`, r.templateDevTest(data), data.RandomIntOfLength(8))
}
Expand All @@ -155,7 +191,6 @@ resource "azurerm_machine_learning_inference_cluster" "test" {
tags = {
ENV = "Production"
}

}
`, r.templateFastProd(data), data.RandomIntOfLength(8))
}
Expand Down
16 changes: 11 additions & 5 deletions website/docs/r/machine_learning_inference_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,15 @@ The following arguments are supported:

* `machine_learning_workspace_id` - (Required) The ID of the Machine Learning Workspace. Changing this forces a new Machine Learning Inference Cluster to be created.

---

* `cluster_purpose` - (Optional) The purpose of the Inference Cluster. Options are `DevTest`, `DenseProd` and `FastProd`. If used for Development or Testing, use `DevTest` here. Default purpose is `FastProd`, which is recommended for production workloads. Changing this forces a new Machine Learning Inference Cluster to be created.

~> **NOTE:** When creating or attaching a cluster, if the cluster will be used for production (`cluster_purpose = "FastProd"`), then it must contain at least 12 virtual CPUs. The number of virtual CPUs can be calculated by multiplying the number of nodes in the cluster by the number of cores provided by the VM size selected. For example, if you use a VM size of "Standard_D3_v2", which has 4 virtual cores, then you should select 3 or greater as the number of nodes.

* `description` - (Optional) The description of the Machine Learning compute.
* `description` - (Optional) The description of the Machine Learning compute. Changing this forces a new Machine Learning Inference Cluster to be created.

* `ssl` - (Optional) A `ssl` block as defined below.
* `ssl` - (Optional) A `ssl` block as defined below. Changing this forces a new Machine Learning Inference Cluster to be created.

* `tags` - (Optional) A mapping of tags which should be assigned to the Machine Learning Inference Cluster. Changing this forces a new Machine Learning Inference Cluster to be created.

Expand All @@ -137,11 +139,15 @@ The following arguments are supported:

A `ssl` block supports the following:

* `cert` - (Optional) The certificate for the ssl configuration. Changing this forces a new Machine Learning Inference Cluster to be created.
* `cert` - (Optional) The certificate for the ssl configuration.Conflicts with `ssl.0.leaf_domain_label`,`ssl.0.overwrite_existing_domain`. Changing this forces a new Machine Learning Inference Cluster to be created.

* `cname` - (Optional) The cname of the ssl configuration.Conflicts with `ssl.0.leaf_domain_label`,`ssl.0.overwrite_existing_domain`. Changing this forces a new Machine Learning Inference Cluster to be created.

* `key` - (Optional) The key content for the ssl configuration.Conflicts with `ssl.0.leaf_domain_label`,`ssl.0.overwrite_existing_domain`. Changing this forces a new Machine Learning Inference Cluster to be created.

* `cname` - (Optional) The cname of the ssl configuration. Changing this forces a new Machine Learning Inference Cluster to be created.
* `leaf_domain_label` - (Optional) The leaf domain label for the ssl configuration. Conflicts with `ssl.0.cert`,`ssl.0.key`,`ssl.0.cname`. Changing this forces a new Machine Learning Inference Cluster to be created.

* `key` - (Optional) The key content for the ssl configuration. Changing this forces a new Machine Learning Inference Cluster to be created.
* `overwrite_existing_domain` - (Optional) Whether or not to overwrite existing leaf domain. Conflicts with `ssl.0.cert`,`ssl.0.key`,`ssl.0.cname` Changing this forces a new Machine Learning Inference Cluster to be created.

## Attributes Reference

Expand Down