-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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_workspace
- Add support for serverless_compute
#25660
Merged
+193
−0
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
66324eb
add support for serverlesscompute
xuzhang3 9378f15
merge upstream
xuzhang3 e2fa392
add support for serverlesscompute
xuzhang3 df90c80
fix test case
xuzhang3 8efd38c
fix test case
xuzhang3 d92a211
fix test case
xuzhang3 fd9afde
fix test case
xuzhang3 58578c3
change default value
xuzhang3 3b93028
1. rename custom_subnet_id to custom_subnet_id
xuzhang3 110fbcb
formant
xuzhang3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -353,6 +353,41 @@ func TestAccMachineLearningWorkspace_purgeSoftDelete(t *testing.T) { | |
}) | ||
} | ||
|
||
func TestAccMachineLearningWorkspace_serverlessCompute(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azurerm_machine_learning_workspace", "test") | ||
r := WorkspaceResource{} | ||
|
||
data.ResourceTest(t, r, []acceptance.TestStep{ | ||
{ | ||
Config: r.serverlessCompute(data), | ||
Check: acceptance.ComposeTestCheckFunc( | ||
check.That(data.ResourceName).ExistsInAzure(r), | ||
check.That(data.ResourceName).Key("serverless_compute.#").HasValue("1"), | ||
check.That(data.ResourceName).Key("serverless_compute.0.subnet_id").Exists(), | ||
check.That(data.ResourceName).Key("serverless_compute.0.public_ip_enabled").HasValue("false"), | ||
), | ||
}, | ||
data.ImportStep(), | ||
}) | ||
} | ||
|
||
func TestAccMachineLearningWorkspace_serverlessCompute_withoutSubnet(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azurerm_machine_learning_workspace", "test") | ||
r := WorkspaceResource{} | ||
|
||
data.ResourceTest(t, r, []acceptance.TestStep{ | ||
{ | ||
Config: r.serverlessComputeWithoutSubnet(data), | ||
Check: acceptance.ComposeTestCheckFunc( | ||
check.That(data.ResourceName).ExistsInAzure(r), | ||
check.That(data.ResourceName).Key("serverless_compute.#").HasValue("1"), | ||
check.That(data.ResourceName).Key("serverless_compute.0.public_ip_enabled").HasValue("true"), | ||
), | ||
}, | ||
data.ImportStep(), | ||
}) | ||
} | ||
|
||
func (r WorkspaceResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { | ||
workspacesClient := client.MachineLearning.Workspaces | ||
id, err := workspaces.ParseWorkspaceID(state.ID) | ||
|
@@ -1166,3 +1201,76 @@ resource "azurerm_machine_learning_workspace" "test" { | |
} | ||
`, template, data.RandomInteger) | ||
} | ||
|
||
func (r WorkspaceResource) serverlessCompute(data acceptance.TestData) string { | ||
template := r.template(data) | ||
return fmt.Sprintf(` | ||
%s | ||
|
||
resource "azurerm_virtual_network" "test" { | ||
name = "acctestvirtnet%[2]d" | ||
address_space = ["10.0.0.0/16"] | ||
location = azurerm_resource_group.test.location | ||
resource_group_name = azurerm_resource_group.test.name | ||
} | ||
resource "azurerm_subnet" "test" { | ||
name = "internal" | ||
resource_group_name = azurerm_resource_group.test.name | ||
virtual_network_name = azurerm_virtual_network.test.name | ||
address_prefixes = ["10.0.2.0/24"] | ||
} | ||
|
||
resource "azurerm_machine_learning_workspace" "test" { | ||
name = "acctest-MLW-%[2]d" | ||
location = azurerm_resource_group.test.location | ||
resource_group_name = azurerm_resource_group.test.name | ||
application_insights_id = azurerm_application_insights.test.id | ||
key_vault_id = azurerm_key_vault.test.id | ||
storage_account_id = azurerm_storage_account.test.id | ||
|
||
serverless_compute { | ||
subnet_id = azurerm_subnet.test.id | ||
} | ||
Comment on lines
+1231
to
+1233
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should also add a test for the case where we don't supply |
||
|
||
identity { | ||
type = "SystemAssigned" | ||
} | ||
} | ||
`, template, data.RandomInteger) | ||
} | ||
|
||
func (r WorkspaceResource) serverlessComputeWithoutSubnet(data acceptance.TestData) string { | ||
template := r.template(data) | ||
return fmt.Sprintf(` | ||
%s | ||
|
||
resource "azurerm_virtual_network" "test" { | ||
name = "acctestvirtnet%[2]d" | ||
address_space = ["10.0.0.0/16"] | ||
location = azurerm_resource_group.test.location | ||
resource_group_name = azurerm_resource_group.test.name | ||
} | ||
resource "azurerm_subnet" "test" { | ||
name = "internal" | ||
resource_group_name = azurerm_resource_group.test.name | ||
virtual_network_name = azurerm_virtual_network.test.name | ||
address_prefixes = ["10.0.2.0/24"] | ||
} | ||
|
||
resource "azurerm_machine_learning_workspace" "test" { | ||
name = "acctest-MLW-%[2]d" | ||
location = azurerm_resource_group.test.location | ||
resource_group_name = azurerm_resource_group.test.name | ||
application_insights_id = azurerm_application_insights.test.id | ||
key_vault_id = azurerm_key_vault.test.id | ||
storage_account_id = azurerm_storage_account.test.id | ||
|
||
serverless_compute { | ||
public_ip_enabled = true | ||
} | ||
identity { | ||
type = "SystemAssigned" | ||
} | ||
} | ||
`, template, data.RandomInteger) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic looks like it belongs in a
CustomizeDiff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will add a
CustomizeDiff
for thisThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried several ways to update this property, customers can still update it but it takes several steps. We can omit `CustomizeDiff``, cx can update the settings according to the error message.
serverless_compute.subnet_id
serverless_compute.public_ip_enabled
fromtrue
tofalse
Error message cx may get:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation @xuzhang3.
Is this something we can do in the resource by calling the
CreateOrUpdate
method twice in the same apply ifpublic_ip_enabled
changes fromtrue
->false
?e.g. First
CreateOrUpdate
call setssubnet_id
Second
CreateOrUpdate
call updatedpublic_ip_enabled
fromtrue
->false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, the operation needs to be split into several steps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that because of
Is this an external thing that they need to configure? What is meant by may are there situations where they don't need to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example, I create a new MLW with following config and I want to set the
serverless_compute.public_ip_enabled
tofalse
, I need to update thepublic_network_access_enabled
andserverless_compute.subnet_id
and I need add a private endpoint for this MLW then I can update theserverless_compute.public_ip_enabled
, this is one of the scenario. Other scenario depends on the MLW configurations.