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_compute_instance azurerm_machine_learning_compute_cluster - support for the node_public_ip_enabled property #21706

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -270,6 +278,11 @@ 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))
nodePublicIPEnabled := true
if props.EnableNodePublicIP != nil {
nodePublicIPEnabled = *props.EnableNodePublicIP
}
d.Set("node_public_ip_enabled", nodePublicIPEnabled)
if props.Subnet != nil {
d.Set("subnet_resource_id", props.Subnet.Id)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -367,7 +368,11 @@ resource "azurerm_machine_learning_compute_cluster" "test" {
func (r ComputeClusterResource) template_basic(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
features {
resource_group {
prevent_deletion_if_contains_resources = false
}
}
}

data "azurerm_client_config" "current" {}
Expand Down Expand Up @@ -426,7 +431,11 @@ resource "azurerm_machine_learning_workspace" "test" {
func (r ComputeClusterResource) template_complete(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
features {
resource_group {
prevent_deletion_if_contains_resources = false
}
}
}

data "azurerm_client_config" "current" {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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{})),
Expand Down Expand Up @@ -266,6 +274,11 @@ func resourceComputeInstanceRead(d *pluginsdk.ResourceData, meta interface{}) er
}
d.Set("description", props.Description)
if props.Properties != nil {
nodePublicIPEnabled := true
if props.Properties.EnableNodePublicIP != nil {
nodePublicIPEnabled = *props.Properties.EnableNodePublicIP
}
d.Set("node_public_ip_enabled", nodePublicIPEnabled)
d.Set("virtual_machine_size", props.Properties.VMSize)
if props.Properties.Subnet != nil {
d.Set("subnet_resource_id", props.Properties.Subnet.Id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down Expand Up @@ -287,7 +288,11 @@ resource "azurerm_machine_learning_compute_instance" "test" {
func (r ComputeInstanceResource) template(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
features {
resource_group {
prevent_deletion_if_contains_resources = false
}
}
}

data "azurerm_client_config" "current" {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,11 @@ resource "azurerm_machine_learning_inference_cluster" "test" {
func (r InferenceClusterResource) template(data acceptance.TestData, vmSize string, nodeCount int) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
features {
resource_group {
prevent_deletion_if_contains_resources = false
}
}
}

data "azurerm_client_config" "current" {}
Expand Down Expand Up @@ -468,7 +472,11 @@ resource "azurerm_kubernetes_cluster" "test" {
func (r InferenceClusterResource) privateTemplate(data acceptance.TestData, vmSize string, nodeCount int) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
features {
resource_group {
prevent_deletion_if_contains_resources = false
}
}
}

data "azurerm_client_config" "current" {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,11 @@ resource "azurerm_machine_learning_synapse_spark" "test" {
func (r SynapseSparkResource) template(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
features {
resource_group {
prevent_deletion_if_contains_resources = false
}
}
}

data "azurerm_client_config" "current" {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down