diff --git a/internal/services/machinelearning/machine_learning_compute_cluster_resource.go b/internal/services/machinelearning/machine_learning_compute_cluster_resource.go index 073272c09935b..df42741038014 100644 --- a/internal/services/machinelearning/machine_learning_compute_cluster_resource.go +++ b/internal/services/machinelearning/machine_learning_compute_cluster_resource.go @@ -134,6 +134,13 @@ func resourceComputeCluster() *pluginsdk.Resource { ForceNew: true, }, + "node_public_ip_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + ForceNew: true, + }, + "ssh_public_access_enabled": { Type: pluginsdk.TypeBool, Optional: true, @@ -181,6 +188,7 @@ func resourceComputeClusterCreate(d *pluginsdk.ResourceData, meta interface{}) e VMPriority: &vmPriority, ScaleSettings: expandScaleSettings(d.Get("scale_settings").([]interface{})), UserAccountCredentials: expandUserAccountCredentials(d.Get("ssh").([]interface{})), + EnableNodePublicIP: utils.Bool(d.Get("node_public_ip_enabled").(bool)), } computeClusterAmlComputeProperties.RemoteLoginPortPublicAccess = utils.ToPtr(machinelearningcomputes.RemoteLoginPortPublicAccessDisabled) @@ -270,6 +278,7 @@ func resourceComputeClusterRead(d *pluginsdk.ResourceData, meta interface{}) err d.Set("vm_priority", string(pointer.From(props.VMPriority))) d.Set("scale_settings", flattenScaleSettings(props.ScaleSettings)) d.Set("ssh", flattenUserAccountCredentials(props.UserAccountCredentials)) + d.Set("node_public_ip_enabled", props.EnableNodePublicIP) if props.Subnet != nil { d.Set("subnet_resource_id", props.Subnet.Id) } diff --git a/internal/services/machinelearning/machine_learning_compute_cluster_resource_test.go b/internal/services/machinelearning/machine_learning_compute_cluster_resource_test.go index 3573ede9dafcc..bc1a6c9f09c2d 100644 --- a/internal/services/machinelearning/machine_learning_compute_cluster_resource_test.go +++ b/internal/services/machinelearning/machine_learning_compute_cluster_resource_test.go @@ -219,6 +219,7 @@ resource "azurerm_machine_learning_compute_cluster" "test" { type = "SystemAssigned" } + node_public_ip_enabled = true ssh_public_access_enabled = false ssh { admin_username = "adminuser" diff --git a/internal/services/machinelearning/machine_learning_compute_instance_resource.go b/internal/services/machinelearning/machine_learning_compute_instance_resource.go index 7369b6097f1f4..47fcfde70f6fe 100644 --- a/internal/services/machinelearning/machine_learning_compute_instance_resource.go +++ b/internal/services/machinelearning/machine_learning_compute_instance_resource.go @@ -116,6 +116,13 @@ func resourceComputeInstance() *pluginsdk.Resource { ForceNew: true, }, + "node_public_ip_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + ForceNew: true, + }, + "ssh": { Type: pluginsdk.TypeList, Optional: true, @@ -188,6 +195,7 @@ func resourceComputeInstanceCreate(d *pluginsdk.ResourceData, meta interface{}) computeInstance := &machinelearningcomputes.ComputeInstance{ Properties: &machinelearningcomputes.ComputeInstanceProperties{ + EnableNodePublicIP: utils.Bool(d.Get("node_public_ip_enabled").(bool)), VMSize: utils.String(d.Get("virtual_machine_size").(string)), Subnet: subnet, SshSettings: expandComputeSSHSetting(d.Get("ssh").([]interface{})), @@ -266,6 +274,7 @@ func resourceComputeInstanceRead(d *pluginsdk.ResourceData, meta interface{}) er } d.Set("description", props.Description) if props.Properties != nil { + d.Set("node_public_ip_enabled", props.Properties.EnableNodePublicIP) d.Set("virtual_machine_size", props.Properties.VMSize) if props.Properties.Subnet != nil { d.Set("subnet_resource_id", props.Properties.Subnet.Id) diff --git a/internal/services/machinelearning/machine_learning_compute_instance_resource_test.go b/internal/services/machinelearning/machine_learning_compute_instance_resource_test.go index 0f7676612fb7e..9a18c627ba050 100644 --- a/internal/services/machinelearning/machine_learning_compute_instance_resource_test.go +++ b/internal/services/machinelearning/machine_learning_compute_instance_resource_test.go @@ -189,8 +189,9 @@ resource "azurerm_machine_learning_compute_instance" "test" { ssh { public_key = var.ssh_key } - subnet_resource_id = azurerm_subnet.test.id - description = "this is desc" + subnet_resource_id = azurerm_subnet.test.id + description = "this is desc" + node_public_ip_enabled = true tags = { Label1 = "Value1" } diff --git a/website/docs/r/machine_learning_compute_cluster.html.markdown b/website/docs/r/machine_learning_compute_cluster.html.markdown index f0727da426795..24ae5fc7f5ca8 100644 --- a/website/docs/r/machine_learning_compute_cluster.html.markdown +++ b/website/docs/r/machine_learning_compute_cluster.html.markdown @@ -123,6 +123,8 @@ The following arguments are supported: * `local_auth_enabled` - (Optional) Whether local authentication methods is enabled. Defaults to `true`. Changing this forces a new Machine Learning Compute Cluster to be created. +* `node_public_ip_enabled` - (Optional) Whether to enable public IP address on nodes. Defaults to `true`. Changing this forces a new Machine Learning Compute Cluster to be created. + * `ssh_public_access_enabled` - (Optional) A boolean value indicating whether enable the public SSH port. Changing this forces a new Machine Learning Compute Cluster to be created. * `subnet_resource_id` - (Optional) The ID of the Subnet that the Compute Cluster should reside in. Changing this forces a new Machine Learning Compute Cluster to be created. diff --git a/website/docs/r/machine_learning_compute_instance.html.markdown b/website/docs/r/machine_learning_compute_instance.html.markdown index 2da6223a9631b..824c411f6a443 100644 --- a/website/docs/r/machine_learning_compute_instance.html.markdown +++ b/website/docs/r/machine_learning_compute_instance.html.markdown @@ -117,6 +117,8 @@ The following arguments are supported: * `local_auth_enabled` - (Optional) Whether local authentication methods is enabled. Defaults to `true`. Changing this forces a new Machine Learning Compute Instance to be created. +* `node_public_ip_enabled` - (Optional) Whether public IP is enabled. Defaults to `true`. Changing this forces a new Machine Learning Compute Instance to be created. + * `ssh` - (Optional) A `ssh` block as defined below. Specifies policy and settings for SSH access. Changing this forces a new Machine Learning Compute Instance to be created. * `subnet_resource_id` - (Optional) Virtual network subnet resource ID the compute nodes belong to. Changing this forces a new Machine Learning Compute Instance to be created.