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

new resource azurerm_machine_learning_inference_cluster #11550

Merged
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
97e4b03
Add support for Azure Machine Learning Inference Cluster Resource
gro1m May 1, 2021
94639c6
Changes due to review#1
gro1m May 5, 2021
9c92e3b
Update website docs
gro1m May 5, 2021
8206781
tflint (terrafmt -f .)
gro1m May 5, 2021
58dc726
Fix golint errors (unused argument and comment formatting)
gro1m May 5, 2021
c7685b9
Fix tflint issues (S018, S020, R002, gofmt -s, whitespace)
gro1m May 6, 2021
35117bb
make generate (use resourceids.go)
gro1m May 7, 2021
09d96fe
Use node pool id and auto-generated node pool validators and parsers
gro1m May 7, 2021
8c3f213
update docs (website lint)
gro1m May 7, 2021
5293cf2
use camel case for all variables
gro1m May 8, 2021
48c75a7
Fix missing camel cases
gro1m May 9, 2021
c1d6dbe
Use ComputeResource to get AKS Cluster ID and other properties
gro1m May 9, 2021
c737bec
Infer cluster_purpose, description and ssl config parameters as well …
gro1m May 10, 2021
8b23ccf
simplification of `inference_cluster`
May 14, 2021
6912f3e
cleanup and fix aks id
May 14, 2021
f403887
DiffSuppresFunc for AKS ID added
May 14, 2021
ed3c5e3
Stringify ssl variables
May 14, 2021
177ff79
Error msg fix
May 14, 2021
490af9e
Fix linter issues
May 14, 2021
982e37f
Fix ssl configuration
May 14, 2021
52782d9
Remove AKS clients from ML client package
May 14, 2021
748bf9e
Simplify expand for AKS Compute properties
May 14, 2021
b5bd269
Add production acctest
May 14, 2021
e35934e
Update docs
May 14, 2021
7fc3646
Remove superfluous node pool parse and validate files
gro1m May 15, 2021
2dd75e9
Fix FastProd test
May 15, 2021
a715f51
Remove go generate for agentpools
May 15, 2021
650409e
Optimize cluster_purpose values and validation
May 15, 2021
23ae0d3
resolve merge conflict
gro1m May 16, 2021
90761b5
git pull
gro1m May 16, 2021
423cf23
update read of ml workspace id
gro1m May 16, 2021
5666a72
make fmt
gro1m May 16, 2021
c704fe3
remove compute type
gro1m May 18, 2021
79ab9b7
Fix cluster purpose validation: DenseProd -> DevTest
gro1m May 18, 2021
5c22aed
upgrade aks api version to 2021-03-01
gro1m May 19, 2021
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 @@ -61,6 +61,21 @@ func TestAccInferenceCluster_complete(t *testing.T) {
})
}

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

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

func (r InferenceClusterResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) {
inferenceClusterClient := client.MachineLearning.MachineLearningComputeClient
id, err := parse.InferenceClusterID(state.ID)
Expand All @@ -80,7 +95,6 @@ func (r InferenceClusterResource) Exists(ctx context.Context, client *clients.Cl
}

func (r InferenceClusterResource) basic(data acceptance.TestData) string {
template := r.template(data)
return fmt.Sprintf(`
%s

Expand All @@ -96,11 +110,10 @@ resource "azurerm_machine_learning_inference_cluster" "test" {
ENV = "Test"
}
}
`, template, data.RandomIntOfLength(8))
`, r.templateDevTest(data), data.RandomIntOfLength(8))
}

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

Expand All @@ -121,11 +134,34 @@ resource "azurerm_machine_learning_inference_cluster" "test" {
}

}
`, template, data.RandomIntOfLength(8))
`, r.templateDevTest(data), data.RandomIntOfLength(8))
}

func (r InferenceClusterResource) completeProduction(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 = "FastProd"
ssl {
cert = file("testdata/cert.pem")
key = file("testdata/key.pem")
cname = "www.contoso.com"
}

tags = {
ENV = "Production"
}

}
`, r.templateFastProd(data), data.RandomIntOfLength(8))
}

func (r InferenceClusterResource) requiresImport(data acceptance.TestData) string {
template := r.basic(data)
return fmt.Sprintf(`
%s

Expand All @@ -138,10 +174,17 @@ resource "azurerm_machine_learning_inference_cluster" "import" {

tags = azurerm_machine_learning_inference_cluster.test.tags
}
`, template)
`, r.basic(data))
}

func (r InferenceClusterResource) templateFastProd(data acceptance.TestData) string {
return r.template(data, "SStandard_D3_v2", 3)
gro1m marked this conversation as resolved.
Show resolved Hide resolved
}
func (r InferenceClusterResource) templateDevTest(data acceptance.TestData) string {
return r.template(data, "Standard_DS2_v2", 1)
}

func (r InferenceClusterResource) template(data acceptance.TestData) string {
func (r InferenceClusterResource) template(data acceptance.TestData, vmSize string, nodeCount int) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
Expand Down Expand Up @@ -219,8 +262,8 @@ resource "azurerm_kubernetes_cluster" "test" {

default_node_pool {
name = "default"
node_count = 1
vm_size = "Standard_DS2_v2"
node_count = %d
vm_size = "%s"
vnet_subnet_id = azurerm_subnet.test.id
}

Expand All @@ -230,5 +273,5 @@ resource "azurerm_kubernetes_cluster" "test" {
}
`, data.RandomInteger, data.Locations.Primary,
data.RandomIntOfLength(12), data.RandomIntOfLength(15), data.RandomIntOfLength(16),
data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger)
data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger, nodeCount, vmSize)
}