Skip to content

Commit

Permalink
update kusto api version and use constant sku values from the SDK ins…
Browse files Browse the repository at this point in the history
…tead of hard coded ones
  • Loading branch information
r0bnet committed Sep 19, 2019
1 parent 07f8cc8 commit e39a8a3
Show file tree
Hide file tree
Showing 15 changed files with 882 additions and 4,464 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 e39a8a3

Please sign in to comment.