Skip to content

Commit

Permalink
Merge pull request #4376 from r0bnet/kusto_cluster-use-constant-sku-v…
Browse files Browse the repository at this point in the history
…alues

Use SDK values for kusto_cluster sku names
  • Loading branch information
tombuildsstuff authored Sep 19, 2019
2 parents 07f8cc8 + ba0e934 commit ad2578b
Show file tree
Hide file tree
Showing 17 changed files with 2,016 additions and 179 deletions.
2 changes: 1 addition & 1 deletion azurerm/internal/services/kusto/client.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package kusto

import (
"github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-01-21/kusto"
"github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/common"
)

Expand Down
42 changes: 17 additions & 25 deletions azurerm/resource_arm_kusto_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"regexp"
"strings"

"github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-01-21/kusto"
"github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
Expand Down Expand Up @@ -46,9 +46,22 @@ func resourceArmKustoCluster() *schema.Resource {
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validateAzureRMKustoClusterSkuName(),
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{
string(kusto.DevNoSLAStandardD11V2),
string(kusto.StandardD11V2),
string(kusto.StandardD12V2),
string(kusto.StandardD13V2),
string(kusto.StandardD14V2),
string(kusto.StandardDS13V21TBPS),
string(kusto.StandardDS13V22TBPS),
string(kusto.StandardDS14V23TBPS),
string(kusto.StandardDS14V24TBPS),
string(kusto.StandardL16s),
string(kusto.StandardL4s),
string(kusto.StandardL8s),
}, false),
},

"capacity": {
Expand Down Expand Up @@ -218,27 +231,6 @@ func validateAzureRMKustoClusterName(v interface{}, k string) (warnings []string
return warnings, errors
}

func validateAzureRMKustoClusterSkuName() schema.SchemaValidateFunc {
// using hard coded values because they're not like this in the sdk as constants
// found them here: https://docs.microsoft.com/en-us/rest/api/azurerekusto/clusters/createorupdate#azureskuname
possibleSkuNames := []string{
"Dev(No SLA)_Standard_D11_v2",
"Standard_D11_v2",
"Standard_D12_v2",
"Standard_D13_v2",
"Standard_D14_v2",
"Standard_DS13_v2+1TB_PS",
"Standard_DS13_v2+2TB_PS",
"Standard_DS14_v2+3TB_PS",
"Standard_DS14_v2+4TB_PS",
"Standard_L16s",
"Standard_L4s",
"Standard_L8s",
}

return validation.StringInSlice(possibleSkuNames, false)
}

func expandKustoClusterSku(d *schema.ResourceData) (*kusto.AzureSku, error) {
skuList := d.Get("sku").([]interface{})

Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_kusto_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"regexp"

"github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-01-21/kusto"
"github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto"
"github.com/hashicorp/terraform/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ad2578b

Please sign in to comment.