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_cluster, azurerm_machine_learning_compute_cluster, azurerm_machine_learning_synapse_spark - support for local_auth_enabled #13820

Merged
Merged
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 @@ -89,6 +89,13 @@ func resourceComputeCluster() *pluginsdk.Resource {
},
},

"local_auth_enabled": {
Type: pluginsdk.TypeBool,
Optional: true,
Default: true,
ForceNew: true,
},

"ssh": {
Type: pluginsdk.TypeList,
Optional: true,
Expand Down Expand Up @@ -183,9 +190,10 @@ func resourceComputeClusterCreate(d *pluginsdk.ResourceData, meta interface{}) e
}

computeClusterProperties := machinelearningservices.AmlCompute{
Properties: &computeClusterAmlComputeProperties,
ComputeLocation: utils.String(d.Get("location").(string)),
Description: utils.String(d.Get("description").(string)),
Properties: &computeClusterAmlComputeProperties,
ComputeLocation: utils.String(d.Get("location").(string)),
Description: utils.String(d.Get("description").(string)),
DisableLocalAuth: utils.Bool(!d.Get("local_auth_enabled").(bool)),
}

// Get SKU from Workspace
Expand Down Expand Up @@ -256,6 +264,9 @@ func resourceComputeClusterRead(d *pluginsdk.ResourceData, meta interface{}) err
return fmt.Errorf("compute resource %s is not an Aml Compute cluster", id.ComputeName)
}

if computeCluster.DisableLocalAuth != nil {
d.Set("local_auth_enabled", !*computeCluster.DisableLocalAuth)
}
if props := computeCluster.Properties; props != nil {
d.Set("vm_size", props.VMSize)
d.Set("vm_priority", props.VMPriority)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ resource "azurerm_machine_learning_compute_cluster" "test" {
vm_priority = "LowPriority"
vm_size = "STANDARD_DS2_V2"
machine_learning_workspace_id = azurerm_machine_learning_workspace.test.id
local_auth_enabled = false

scale_settings {
min_node_count = 0
Expand Down Expand Up @@ -183,7 +184,6 @@ resource "azurerm_machine_learning_compute_cluster" "test" {
vm_size = "STANDARD_DS2_V2"
machine_learning_workspace_id = azurerm_machine_learning_workspace.test.id
subnet_resource_id = azurerm_subnet.test.id

scale_settings {
min_node_count = 0
max_node_count = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ func resourceComputeInstance() *pluginsdk.Resource {

"identity": SystemAssignedUserAssigned{}.Schema(),

"local_auth_enabled": {
Type: pluginsdk.TypeBool,
Optional: true,
Default: true,
ForceNew: true,
},

"ssh": {
Type: pluginsdk.TypeList,
Optional: true,
Expand Down Expand Up @@ -181,8 +188,9 @@ func resourceComputeInstanceCreate(d *pluginsdk.ResourceData, meta interface{})
ComputeInstanceAuthorizationType: machinelearningservices.ComputeInstanceAuthorizationType(d.Get("authorization_type").(string)),
PersonalComputeInstanceSettings: expandComputePersonalComputeInstanceSetting(d.Get("assign_to_user").([]interface{})),
},
ComputeLocation: utils.String(d.Get("location").(string)),
Description: utils.String(d.Get("description").(string)),
ComputeLocation: utils.String(d.Get("location").(string)),
Description: utils.String(d.Get("description").(string)),
DisableLocalAuth: utils.Bool(!d.Get("local_auth_enabled").(bool)),
},
Identity: identity,
Location: utils.String(location.Normalize(d.Get("location").(string))),
Expand Down Expand Up @@ -238,6 +246,9 @@ func resourceComputeInstanceRead(d *pluginsdk.ResourceData, meta interface{}) er
d.Set("identity", identity)

if props, ok := resp.Properties.AsComputeInstance(); ok && props != nil {
if props.DisableLocalAuth != nil {
d.Set("local_auth_enabled", !*props.DisableLocalAuth)
}
d.Set("description", props.Description)
if props.Properties != nil {
d.Set("virtual_machine_size", props.Properties.VMSize)
Expand All @@ -264,7 +275,7 @@ func resourceComputeInstanceDelete(d *pluginsdk.ResourceData, meta interface{})
return err
}

future, err := client.Delete(ctx, id.ResourceGroup, id.WorkspaceName, id.Name, machinelearningservices.UnderlyingResourceActionDetach)
future, err := client.Delete(ctx, id.ResourceGroup, id.WorkspaceName, id.Name, machinelearningservices.UnderlyingResourceActionDelete)
if err != nil {
return fmt.Errorf("deleting Machine Learning Compute (%q): %+v", id, err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ resource "azurerm_machine_learning_compute_instance" "test" {
location = azurerm_resource_group.test.location
machine_learning_workspace_id = azurerm_machine_learning_workspace.test.id
virtual_machine_size = "STANDARD_DS2_V2"
local_auth_enabled = false
}
`, template, data.RandomIntOfLength(8))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ func resourceSynapseSpark() *pluginsdk.Resource {

"identity": SystemAssignedUserAssigned{}.Schema(),

"local_auth_enabled": {
Type: pluginsdk.TypeBool,
Optional: true,
Default: true,
ForceNew: true,
},

"tags": tags.ForceNewSchema(),
},
}
Expand Down Expand Up @@ -105,10 +112,11 @@ func resourceSynapseSparkCreate(d *pluginsdk.ResourceData, meta interface{}) err

parameters := machinelearningservices.ComputeResource{
Properties: &machinelearningservices.SynapseSpark{
Properties: nil,
ComputeLocation: utils.String(d.Get("location").(string)),
Description: utils.String(d.Get("description").(string)),
ResourceID: utils.String(d.Get("synapse_spark_pool_id").(string)),
Properties: nil,
ComputeLocation: utils.String(d.Get("location").(string)),
Description: utils.String(d.Get("description").(string)),
ResourceID: utils.String(d.Get("synapse_spark_pool_id").(string)),
DisableLocalAuth: utils.Bool(!d.Get("local_auth_enabled").(bool)),
},
Identity: identity,
Location: utils.String(location.Normalize(d.Get("location").(string))),
Expand Down Expand Up @@ -165,6 +173,9 @@ func resourceSynapseSparkRead(d *pluginsdk.ResourceData, meta interface{}) error
d.Set("identity", identity)

if props, ok := resp.Properties.AsSynapseSpark(); ok && props != nil {
if props.DisableLocalAuth != nil {
d.Set("local_auth_enabled", !*props.DisableLocalAuth)
}
d.Set("description", props.Description)
d.Set("synapse_spark_pool_id", props.ResourceID)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ resource "azurerm_machine_learning_synapse_spark" "test" {
machine_learning_workspace_id = azurerm_machine_learning_workspace.test.id
location = azurerm_resource_group.test.location
synapse_spark_pool_id = azurerm_synapse_spark_pool.test.id
local_auth_enabled = false
}
`, template, data.RandomIntOfLength(8))
}
Expand All @@ -143,7 +144,6 @@ resource "azurerm_machine_learning_synapse_spark" "test" {
location = azurerm_resource_group.test.location
synapse_spark_pool_id = azurerm_synapse_spark_pool.test.id
description = "this is desc changed"

identity {
type = "SystemAssigned"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ The following arguments are supported:

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

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

* `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 @@ -115,6 +115,8 @@ The following arguments are supported:

* `identity` - (Optional) A `identity` block as defined below. Changing this forces a new Machine Learning Compute Instance to be created.

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

* `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
2 changes: 2 additions & 0 deletions website/docs/r/machine_learning_synapse_spark.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ The following arguments are supported:

* `identity` - (Optional) A `identity` block as defined below. Changing this forces a new Machine Learning Synapse Spark to be created.

* `local_auth_enabled` - (Optional) Whether local authentication methods is enabled. Defaults to `true`. Changing this forces a new Machine Learning Synapse Spark to be created.

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

---
Expand Down