From ee47b4ca398a169ea2cd2d1d4a84919c21913bbb Mon Sep 17 00:00:00 2001 From: Yun Liu Date: Wed, 6 Jul 2022 11:32:53 +0800 Subject: [PATCH 1/8] Update public_ip_address property to kusto cluster.go. --- internal/services/kusto/kusto_cluster_resource.go | 12 ++++++++++++ .../services/kusto/kusto_cluster_resource_test.go | 9 +++++++-- website/docs/r/kusto_cluster.html.markdown | 2 ++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/internal/services/kusto/kusto_cluster_resource.go b/internal/services/kusto/kusto_cluster_resource.go index f4369fc301c8..d0fff67f8fd0 100644 --- a/internal/services/kusto/kusto_cluster_resource.go +++ b/internal/services/kusto/kusto_cluster_resource.go @@ -197,6 +197,16 @@ func resourceKustoCluster() *pluginsdk.Resource { Computed: true, }, + "public_ip_type": { + Type: pluginsdk.TypeString, + Optional: true, + Default: string(kusto.PublicIPTypeIPv4), + ValidateFunc: validation.StringInSlice([]string{ + string(kusto.PublicIPTypeIPv4), + string(kusto.PublicIPTypeDualStack), + }, false), + }, + "public_network_access_enabled": { Type: pluginsdk.TypeBool, Optional: true, @@ -315,6 +325,7 @@ func resourceKustoClusterCreateUpdate(d *pluginsdk.ResourceData, meta interface{ EnablePurge: utils.Bool(d.Get("purge_enabled").(bool)), EngineType: engine, PublicNetworkAccess: publicNetworkAccess, + PublicIPType: kusto.PublicIPType(d.Get("public_ip_type").(string)), TrustedExternalTenants: expandTrustedExternalTenants(d.Get("trusted_external_tenants").([]interface{})), } @@ -451,6 +462,7 @@ func resourceKustoClusterRead(d *pluginsdk.ResourceData, meta interface{}) error d.Set("uri", props.URI) d.Set("data_ingestion_uri", props.DataIngestionURI) d.Set("engine", props.EngineType) + d.Set("public_ip_type", props.PublicIPType) } return tags.FlattenAndSet(d, resp.Tags) diff --git a/internal/services/kusto/kusto_cluster_resource_test.go b/internal/services/kusto/kusto_cluster_resource_test.go index 62510795f6d8..f42cde28238c 100644 --- a/internal/services/kusto/kusto_cluster_resource_test.go +++ b/internal/services/kusto/kusto_cluster_resource_test.go @@ -57,6 +57,7 @@ func TestAccKustoCluster_update(t *testing.T) { check.That(data.ResourceName).Key("disk_encryption_enabled").HasValue("false"), check.That(data.ResourceName).Key("streaming_ingestion_enabled").HasValue("false"), check.That(data.ResourceName).Key("purge_enabled").HasValue("false"), + check.That(data.ResourceName).Key("public_ip_type").HasValue("IPv4"), ), }, data.ImportStep(), @@ -67,6 +68,7 @@ func TestAccKustoCluster_update(t *testing.T) { check.That(data.ResourceName).Key("disk_encryption_enabled").HasValue("true"), check.That(data.ResourceName).Key("streaming_ingestion_enabled").HasValue("true"), check.That(data.ResourceName).Key("purge_enabled").HasValue("true"), + check.That(data.ResourceName).Key("public_ip_type").HasValue("DualStack"), ), }, data.ImportStep(), @@ -77,6 +79,7 @@ func TestAccKustoCluster_update(t *testing.T) { check.That(data.ResourceName).Key("disk_encryption_enabled").HasValue("false"), check.That(data.ResourceName).Key("streaming_ingestion_enabled").HasValue("false"), check.That(data.ResourceName).Key("purge_enabled").HasValue("false"), + check.That(data.ResourceName).Key("public_ip_type").HasValue("IPv4"), ), }, data.ImportStep(), @@ -400,9 +403,10 @@ resource "azurerm_kusto_cluster" "test" { location = azurerm_resource_group.test.location resource_group_name = azurerm_resource_group.test.name public_network_access_enabled = false + public_ip_type = "DualStack" sku { - name = "Dev(No SLA)_Standard_D11_v2" - capacity = 1 + name = "Standard_D13_v2" + capacity = 2 } } `, data.RandomInteger, data.Locations.Primary, data.RandomString) @@ -588,6 +592,7 @@ resource "azurerm_kusto_cluster" "test" { disk_encryption_enabled = true streaming_ingestion_enabled = true purge_enabled = true + public_ip_type = "DualStack" sku { name = "Dev(No SLA)_Standard_D11_v2" diff --git a/website/docs/r/kusto_cluster.html.markdown b/website/docs/r/kusto_cluster.html.markdown index 5a988a4a9501..a9de1e98fd0a 100644 --- a/website/docs/r/kusto_cluster.html.markdown +++ b/website/docs/r/kusto_cluster.html.markdown @@ -56,6 +56,8 @@ The following arguments are supported: * `streaming_ingestion_enabled` - (Optional) Specifies if the streaming ingest is enabled. +* `public_ip_type` - (Optional) Indicates what public IP type to create - IPv4 (default), or DualStack (both IPv4 and IPv6). + * `public_network_access_enabled` - (Optional) Is the public network access enabled? Defaults to `true`. * `purge_enabled` - (Optional) Specifies if the purge operations are enabled. From 4b2401157051a4256e24bdcc5bec6ca2acceceb5 Mon Sep 17 00:00:00 2001 From: Yun Liu Date: Mon, 11 Jul 2022 10:40:53 +0800 Subject: [PATCH 2/8] Update kusto_cluster_resource.go with added azure skus. --- .../services/kusto/kusto_cluster_resource.go | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/internal/services/kusto/kusto_cluster_resource.go b/internal/services/kusto/kusto_cluster_resource.go index d0fff67f8fd0..af4e461dc989 100644 --- a/internal/services/kusto/kusto_cluster_resource.go +++ b/internal/services/kusto/kusto_cluster_resource.go @@ -77,23 +77,43 @@ func resourceKustoCluster() *pluginsdk.Resource { string(kusto.AzureSkuNameStandardD12V2), string(kusto.AzureSkuNameStandardD13V2), string(kusto.AzureSkuNameStandardD14V2), + string(kusto.AzureSkuNameStandardD16dV5), + string(kusto.AzureSkuNameStandardD32dV4), + string(kusto.AzureSkuNameStandardD32dV5), string(kusto.AzureSkuNameStandardDS13V21TBPS), string(kusto.AzureSkuNameStandardDS13V22TBPS), string(kusto.AzureSkuNameStandardDS14V23TBPS), string(kusto.AzureSkuNameStandardDS14V24TBPS), + string(kusto.AzureSkuNameStandardE16aV4), + string(kusto.AzureSkuNameStandardE16adsV5), string(kusto.AzureSkuNameStandardE16asV43TBPS), string(kusto.AzureSkuNameStandardE16asV44TBPS), - string(kusto.AzureSkuNameStandardE16aV4), + string(kusto.AzureSkuNameStandardE16asV53TBPS), + string(kusto.AzureSkuNameStandardE16asV54TBPS), + string(kusto.AzureSkuNameStandardE16sV43TBPS), + string(kusto.AzureSkuNameStandardE16sV44TBPS), + string(kusto.AzureSkuNameStandardE16sV53TBPS), + string(kusto.AzureSkuNameStandardE16sV54TBPS), string(kusto.AzureSkuNameStandardE2aV4), + string(kusto.AzureSkuNameStandardE2adsV5), string(kusto.AzureSkuNameStandardE4aV4), + string(kusto.AzureSkuNameStandardE4adsV5), string(kusto.AzureSkuNameStandardE64iV3), + string(kusto.AzureSkuNameStandardE80idsV4), + string(kusto.AzureSkuNameStandardE8aV4), + string(kusto.AzureSkuNameStandardE8adsV5), string(kusto.AzureSkuNameStandardE8asV41TBPS), string(kusto.AzureSkuNameStandardE8asV42TBPS), - string(kusto.AzureSkuNameStandardE8aV4), + string(kusto.AzureSkuNameStandardE8asV51TBPS), + string(kusto.AzureSkuNameStandardE8asV52TBPS), + string(kusto.AzureSkuNameStandardE8sV41TBPS), + string(kusto.AzureSkuNameStandardE8sV42TBPS), + string(kusto.AzureSkuNameStandardE8sV51TBPS), + string(kusto.AzureSkuNameStandardE8sV52TBPS), string(kusto.AzureSkuNameStandardL16s), + string(kusto.AzureSkuNameStandardL16sV2), string(kusto.AzureSkuNameStandardL4s), string(kusto.AzureSkuNameStandardL8s), - string(kusto.AzureSkuNameStandardL16sV2), string(kusto.AzureSkuNameStandardL8sV2), }, false), }, From 8a51aa502397abc835470be59cf918c2feab5227 Mon Sep 17 00:00:00 2001 From: Yun Liu Date: Mon, 11 Jul 2022 12:31:27 +0800 Subject: [PATCH 3/8] Update kusto_cluster_resource.go with added props. --- .../services/kusto/kusto_cluster_resource.go | 42 +++++++++++++++++++ .../kusto/kusto_cluster_resource_test.go | 2 + 2 files changed, 44 insertions(+) diff --git a/internal/services/kusto/kusto_cluster_resource.go b/internal/services/kusto/kusto_cluster_resource.go index af4e461dc989..e1301b91a2fe 100644 --- a/internal/services/kusto/kusto_cluster_resource.go +++ b/internal/services/kusto/kusto_cluster_resource.go @@ -128,6 +128,24 @@ func resourceKustoCluster() *pluginsdk.Resource { }, }, + "allowed_fqdn_list": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + + "allowed_ip_range_list": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + "trusted_external_tenants": { Type: pluginsdk.TypeList, Optional: true, @@ -354,6 +372,14 @@ func resourceKustoClusterCreateUpdate(d *pluginsdk.ResourceData, meta interface{ clusterProperties.VirtualNetworkConfiguration = vnet } + if v, ok := d.GetOk("allowed_fqdn_list"); ok { + clusterProperties.AllowedFqdnList, _ = expandKustoListString(v.([]interface{})) + } + + if v, ok := d.GetOk("allowed_fqdn_list"); ok { + clusterProperties.AllowedIPRangeList, _ = expandKustoListString(v.([]interface{})) + } + expandedIdentity, err := expandClusterIdentity(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) @@ -471,6 +497,8 @@ func resourceKustoClusterRead(d *pluginsdk.ResourceData, meta interface{}) error } if props := resp.ClusterProperties; props != nil { + d.Set("allowed_fqdn_list", props.AllowedFqdnList) + d.Set("allowed_ip_range_list", props.AllowedIPRangeList) d.Set("double_encryption_enabled", props.EnableDoubleEncryption) d.Set("trusted_external_tenants", flattenTrustedExternalTenants(props.TrustedExternalTenants)) d.Set("auto_stop_enabled", props.EnableAutoStop) @@ -549,6 +577,20 @@ func flattenOptimizedAutoScale(optimizedAutoScale *kusto.OptimizedAutoscale) []i } } +func expandKustoListString(input []interface{}) (*[]string, error) { + if input == nil || len(input) == 0 { + return nil, fmt.Errorf("list of string is empty") + } + + result := make([]string, 0) + + for _, v := range input { + result = append(result, v.(string)) + } + + return &result, nil +} + func expandKustoClusterSku(input []interface{}) (*kusto.AzureSku, error) { sku := input[0].(map[string]interface{}) name := sku["name"].(string) diff --git a/internal/services/kusto/kusto_cluster_resource_test.go b/internal/services/kusto/kusto_cluster_resource_test.go index f42cde28238c..f2efc4386d62 100644 --- a/internal/services/kusto/kusto_cluster_resource_test.go +++ b/internal/services/kusto/kusto_cluster_resource_test.go @@ -402,6 +402,8 @@ resource "azurerm_kusto_cluster" "test" { name = "acctestkc%s" location = azurerm_resource_group.test.location resource_group_name = azurerm_resource_group.test.name + allowed_fqdn_list = [] + allowed_ip_range_list = ["0.0.0.0/0"] public_network_access_enabled = false public_ip_type = "DualStack" sku { From c6e099543576221d237454bd859613d60d0ea146 Mon Sep 17 00:00:00 2001 From: Yun Liu Date: Mon, 11 Jul 2022 15:22:09 +0800 Subject: [PATCH 4/8] Update kusto_cluster_resource.go with added props. --- .../services/kusto/kusto_cluster_resource.go | 17 +++++++++++++++- .../kusto/kusto_cluster_resource_test.go | 20 ++++++++++++------- website/docs/r/kusto_cluster.html.markdown | 6 ++++++ 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/internal/services/kusto/kusto_cluster_resource.go b/internal/services/kusto/kusto_cluster_resource.go index e1301b91a2fe..e6d3a79c39bc 100644 --- a/internal/services/kusto/kusto_cluster_resource.go +++ b/internal/services/kusto/kusto_cluster_resource.go @@ -251,6 +251,16 @@ func resourceKustoCluster() *pluginsdk.Resource { Default: true, }, + "restrict_outbound_network_access": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice( + []string{ + string(kusto.ClusterNetworkAccessFlagEnabled), + string(kusto.ClusterNetworkAccessFlagDisabled), + }, false), + }, + "double_encryption_enabled": { Type: pluginsdk.TypeBool, Optional: true, @@ -376,10 +386,14 @@ func resourceKustoClusterCreateUpdate(d *pluginsdk.ResourceData, meta interface{ clusterProperties.AllowedFqdnList, _ = expandKustoListString(v.([]interface{})) } - if v, ok := d.GetOk("allowed_fqdn_list"); ok { + if v, ok := d.GetOk("allowed_ip_range_list"); ok { clusterProperties.AllowedIPRangeList, _ = expandKustoListString(v.([]interface{})) } + if v, ok := d.GetOk("restrict_outbound_network_access"); ok { + clusterProperties.RestrictOutboundNetworkAccess = kusto.ClusterNetworkAccessFlag(v.(string)) + } + expandedIdentity, err := expandClusterIdentity(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) @@ -511,6 +525,7 @@ func resourceKustoClusterRead(d *pluginsdk.ResourceData, meta interface{}) error d.Set("data_ingestion_uri", props.DataIngestionURI) d.Set("engine", props.EngineType) d.Set("public_ip_type", props.PublicIPType) + d.Set("restrict_outbound_network_access", props.RestrictOutboundNetworkAccess) } return tags.FlattenAndSet(d, resp.Tags) diff --git a/internal/services/kusto/kusto_cluster_resource_test.go b/internal/services/kusto/kusto_cluster_resource_test.go index f2efc4386d62..ed5978aba5e2 100644 --- a/internal/services/kusto/kusto_cluster_resource_test.go +++ b/internal/services/kusto/kusto_cluster_resource_test.go @@ -39,6 +39,11 @@ func TestAccKustoCluster_complete(t *testing.T) { Config: r.complete(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("allowed_fqdn_list.#").HasValue("1"), + check.That(data.ResourceName).Key("allowed_fqdn_list.0").HasValue("255.255.255.0/24"), + check.That(data.ResourceName).Key("allowed_ip_range_list.#").HasValue("1"), + check.That(data.ResourceName).Key("allowed_ip_range_list.0").HasValue("0.0.0.0/0"), + check.That(data.ResourceName).Key("restrict_outbound_network_access").HasValue("Enabled"), ), }, data.ImportStep(), @@ -399,13 +404,14 @@ resource "azurerm_resource_group" "test" { } resource "azurerm_kusto_cluster" "test" { - name = "acctestkc%s" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - allowed_fqdn_list = [] - allowed_ip_range_list = ["0.0.0.0/0"] - public_network_access_enabled = false - public_ip_type = "DualStack" + name = "acctestkc%s" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + allowed_fqdn_list = ["255.255.255.0/24"] + allowed_ip_range_list = ["0.0.0.0/0"] + public_network_access_enabled = false + public_ip_type = "DualStack" + restrict_outbound_network_access = "Enabled" sku { name = "Standard_D13_v2" capacity = 2 diff --git a/website/docs/r/kusto_cluster.html.markdown b/website/docs/r/kusto_cluster.html.markdown index a9de1e98fd0a..e4e0b0414ea1 100644 --- a/website/docs/r/kusto_cluster.html.markdown +++ b/website/docs/r/kusto_cluster.html.markdown @@ -46,6 +46,10 @@ The following arguments are supported: * `sku` - (Required) A `sku` block as defined below. +* `allowed_fqdn_list` - (Optional) List of allowed FQDNs(Fully Qualified Domain Name) for egress from Cluster. + +* `allowed_ip_rangelist` - (Optional) The list of ips in the format of CIDR allowed to connect to the cluster. + * `double_encryption_enabled` - (Optional) Is the cluster's double encryption enabled? Defaults to `false`. Changing this forces a new resource to be created. * `identity` - (Optional) An `identity` block as defined below. @@ -60,6 +64,8 @@ The following arguments are supported: * `public_network_access_enabled` - (Optional) Is the public network access enabled? Defaults to `true`. +* `restrict_outbound_network_access` - (Optional) Whether to restrict outbound network access. Value is optional but if passed in, must be "Enabled" or "Disabled". + * `purge_enabled` - (Optional) Specifies if the purge operations are enabled. * `virtual_network_configuration`- (Optional) A `virtual_network_configuration` block as defined below. Changing this forces a new resource to be created. From ac44c948c41851b2cce2450a785bec616ef01eef Mon Sep 17 00:00:00 2001 From: Yun Liu Date: Mon, 11 Jul 2022 16:13:47 +0800 Subject: [PATCH 5/8] Update kusto_cluster_resource.go with default value. --- internal/services/kusto/kusto_cluster_resource.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/services/kusto/kusto_cluster_resource.go b/internal/services/kusto/kusto_cluster_resource.go index e6d3a79c39bc..627c27101610 100644 --- a/internal/services/kusto/kusto_cluster_resource.go +++ b/internal/services/kusto/kusto_cluster_resource.go @@ -254,6 +254,7 @@ func resourceKustoCluster() *pluginsdk.Resource { "restrict_outbound_network_access": { Type: pluginsdk.TypeString, Optional: true, + Default: string(kusto.ClusterNetworkAccessFlagDisabled), ValidateFunc: validation.StringInSlice( []string{ string(kusto.ClusterNetworkAccessFlagEnabled), From eba5b92144819064ca0b3bba2deb153a695b5cb2 Mon Sep 17 00:00:00 2001 From: Yun Liu Date: Tue, 12 Jul 2022 09:35:21 +0800 Subject: [PATCH 6/8] fix a typo in kusto_cluster.html.markdown --- website/docs/r/kusto_cluster.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/kusto_cluster.html.markdown b/website/docs/r/kusto_cluster.html.markdown index e4e0b0414ea1..ca74d438926c 100644 --- a/website/docs/r/kusto_cluster.html.markdown +++ b/website/docs/r/kusto_cluster.html.markdown @@ -48,7 +48,7 @@ The following arguments are supported: * `allowed_fqdn_list` - (Optional) List of allowed FQDNs(Fully Qualified Domain Name) for egress from Cluster. -* `allowed_ip_rangelist` - (Optional) The list of ips in the format of CIDR allowed to connect to the cluster. +* `allowed_ip_range_list` - (Optional) The list of ips in the format of CIDR allowed to connect to the cluster. * `double_encryption_enabled` - (Optional) Is the cluster's double encryption enabled? Defaults to `false`. Changing this forces a new resource to be created. From 991a449396ae738506fba5190e78a0a49ccee2f8 Mon Sep 17 00:00:00 2001 From: Yun Liu Date: Mon, 18 Jul 2022 10:46:27 +0800 Subject: [PATCH 7/8] update naming and outbound_network_access_restricted properties according to kt's review --- .../services/kusto/kusto_cluster_resource.go | 32 +++++++++---------- .../kusto/kusto_cluster_resource_test.go | 14 ++++---- website/docs/r/kusto_cluster.html.markdown | 6 ++-- 3 files changed, 25 insertions(+), 27 deletions(-) diff --git a/internal/services/kusto/kusto_cluster_resource.go b/internal/services/kusto/kusto_cluster_resource.go index 627c27101610..6101a0c696cf 100644 --- a/internal/services/kusto/kusto_cluster_resource.go +++ b/internal/services/kusto/kusto_cluster_resource.go @@ -128,7 +128,7 @@ func resourceKustoCluster() *pluginsdk.Resource { }, }, - "allowed_fqdn_list": { + "allowed_fqdns": { Type: pluginsdk.TypeList, Optional: true, Elem: &pluginsdk.Schema{ @@ -137,7 +137,7 @@ func resourceKustoCluster() *pluginsdk.Resource { }, }, - "allowed_ip_range_list": { + "allowed_ip_ranges": { Type: pluginsdk.TypeList, Optional: true, Elem: &pluginsdk.Schema{ @@ -251,15 +251,10 @@ func resourceKustoCluster() *pluginsdk.Resource { Default: true, }, - "restrict_outbound_network_access": { - Type: pluginsdk.TypeString, + "outbound_network_access_restricted": { + Type: pluginsdk.TypeBool, Optional: true, - Default: string(kusto.ClusterNetworkAccessFlagDisabled), - ValidateFunc: validation.StringInSlice( - []string{ - string(kusto.ClusterNetworkAccessFlagEnabled), - string(kusto.ClusterNetworkAccessFlagDisabled), - }, false), + Default: false, }, "double_encryption_enabled": { @@ -383,16 +378,19 @@ func resourceKustoClusterCreateUpdate(d *pluginsdk.ResourceData, meta interface{ clusterProperties.VirtualNetworkConfiguration = vnet } - if v, ok := d.GetOk("allowed_fqdn_list"); ok { + if v, ok := d.GetOk("allowed_fqdns"); ok { clusterProperties.AllowedFqdnList, _ = expandKustoListString(v.([]interface{})) } - if v, ok := d.GetOk("allowed_ip_range_list"); ok { + if v, ok := d.GetOk("allowed_ip_ranges"); ok { clusterProperties.AllowedIPRangeList, _ = expandKustoListString(v.([]interface{})) } - if v, ok := d.GetOk("restrict_outbound_network_access"); ok { - clusterProperties.RestrictOutboundNetworkAccess = kusto.ClusterNetworkAccessFlag(v.(string)) + clusterProperties.RestrictOutboundNetworkAccess = kusto.ClusterNetworkAccessFlagDisabled + if v, ok := d.GetOk("outbound_network_access_restricted"); ok { + if v.(bool) { + clusterProperties.RestrictOutboundNetworkAccess = kusto.ClusterNetworkAccessFlagEnabled + } } expandedIdentity, err := expandClusterIdentity(d.Get("identity").([]interface{})) @@ -512,8 +510,8 @@ func resourceKustoClusterRead(d *pluginsdk.ResourceData, meta interface{}) error } if props := resp.ClusterProperties; props != nil { - d.Set("allowed_fqdn_list", props.AllowedFqdnList) - d.Set("allowed_ip_range_list", props.AllowedIPRangeList) + d.Set("allowed_fqdns", props.AllowedFqdnList) + d.Set("allowed_ip_ranges", props.AllowedIPRangeList) d.Set("double_encryption_enabled", props.EnableDoubleEncryption) d.Set("trusted_external_tenants", flattenTrustedExternalTenants(props.TrustedExternalTenants)) d.Set("auto_stop_enabled", props.EnableAutoStop) @@ -526,7 +524,7 @@ func resourceKustoClusterRead(d *pluginsdk.ResourceData, meta interface{}) error d.Set("data_ingestion_uri", props.DataIngestionURI) d.Set("engine", props.EngineType) d.Set("public_ip_type", props.PublicIPType) - d.Set("restrict_outbound_network_access", props.RestrictOutboundNetworkAccess) + d.Set("outbound_network_access_restricted", props.RestrictOutboundNetworkAccess == kusto.ClusterNetworkAccessFlagEnabled) } return tags.FlattenAndSet(d, resp.Tags) diff --git a/internal/services/kusto/kusto_cluster_resource_test.go b/internal/services/kusto/kusto_cluster_resource_test.go index ed5978aba5e2..1906de2696db 100644 --- a/internal/services/kusto/kusto_cluster_resource_test.go +++ b/internal/services/kusto/kusto_cluster_resource_test.go @@ -39,10 +39,10 @@ func TestAccKustoCluster_complete(t *testing.T) { Config: r.complete(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("allowed_fqdn_list.#").HasValue("1"), - check.That(data.ResourceName).Key("allowed_fqdn_list.0").HasValue("255.255.255.0/24"), - check.That(data.ResourceName).Key("allowed_ip_range_list.#").HasValue("1"), - check.That(data.ResourceName).Key("allowed_ip_range_list.0").HasValue("0.0.0.0/0"), + check.That(data.ResourceName).Key("allowed_fqdns.#").HasValue("1"), + check.That(data.ResourceName).Key("allowed_fqdns.0").HasValue("255.255.255.0/24"), + check.That(data.ResourceName).Key("allowed_ip_ranges.#").HasValue("1"), + check.That(data.ResourceName).Key("allowed_ip_ranges.0").HasValue("0.0.0.0/0"), check.That(data.ResourceName).Key("restrict_outbound_network_access").HasValue("Enabled"), ), }, @@ -407,11 +407,11 @@ resource "azurerm_kusto_cluster" "test" { name = "acctestkc%s" location = azurerm_resource_group.test.location resource_group_name = azurerm_resource_group.test.name - allowed_fqdn_list = ["255.255.255.0/24"] - allowed_ip_range_list = ["0.0.0.0/0"] + allowed_fqdns = ["255.255.255.0/24"] + allowed_ip_ranges = ["0.0.0.0/0"] public_network_access_enabled = false public_ip_type = "DualStack" - restrict_outbound_network_access = "Enabled" + restrict_outbound_network_access = true sku { name = "Standard_D13_v2" capacity = 2 diff --git a/website/docs/r/kusto_cluster.html.markdown b/website/docs/r/kusto_cluster.html.markdown index ca74d438926c..8b51d802ffa0 100644 --- a/website/docs/r/kusto_cluster.html.markdown +++ b/website/docs/r/kusto_cluster.html.markdown @@ -46,9 +46,9 @@ The following arguments are supported: * `sku` - (Required) A `sku` block as defined below. -* `allowed_fqdn_list` - (Optional) List of allowed FQDNs(Fully Qualified Domain Name) for egress from Cluster. +* `allowed_fqdns` - (Optional) List of allowed FQDNs(Fully Qualified Domain Name) for egress from Cluster. -* `allowed_ip_range_list` - (Optional) The list of ips in the format of CIDR allowed to connect to the cluster. +* `allowed_ip_ranges` - (Optional) The list of ips in the format of CIDR allowed to connect to the cluster. * `double_encryption_enabled` - (Optional) Is the cluster's double encryption enabled? Defaults to `false`. Changing this forces a new resource to be created. @@ -64,7 +64,7 @@ The following arguments are supported: * `public_network_access_enabled` - (Optional) Is the public network access enabled? Defaults to `true`. -* `restrict_outbound_network_access` - (Optional) Whether to restrict outbound network access. Value is optional but if passed in, must be "Enabled" or "Disabled". +* `outbound_network_access_restricted` - (Optional) Whether to restrict outbound network access. Value is optional but if passed in, must be `true` or `false`, default is `false`. * `purge_enabled` - (Optional) Specifies if the purge operations are enabled. From b1694ee252f7d571355ac4659d8ddf8357fe147b Mon Sep 17 00:00:00 2001 From: Yun Liu Date: Mon, 18 Jul 2022 11:06:29 +0800 Subject: [PATCH 8/8] update naming and outbound_network_access_restricted properties according to kt's review --- .../kusto/kusto_cluster_resource_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/services/kusto/kusto_cluster_resource_test.go b/internal/services/kusto/kusto_cluster_resource_test.go index 1906de2696db..62c8093281e1 100644 --- a/internal/services/kusto/kusto_cluster_resource_test.go +++ b/internal/services/kusto/kusto_cluster_resource_test.go @@ -43,7 +43,7 @@ func TestAccKustoCluster_complete(t *testing.T) { check.That(data.ResourceName).Key("allowed_fqdns.0").HasValue("255.255.255.0/24"), check.That(data.ResourceName).Key("allowed_ip_ranges.#").HasValue("1"), check.That(data.ResourceName).Key("allowed_ip_ranges.0").HasValue("0.0.0.0/0"), - check.That(data.ResourceName).Key("restrict_outbound_network_access").HasValue("Enabled"), + check.That(data.ResourceName).Key("outbound_network_access_restricted").HasValue("true"), ), }, data.ImportStep(), @@ -404,14 +404,14 @@ resource "azurerm_resource_group" "test" { } resource "azurerm_kusto_cluster" "test" { - name = "acctestkc%s" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - allowed_fqdns = ["255.255.255.0/24"] - allowed_ip_ranges = ["0.0.0.0/0"] - public_network_access_enabled = false - public_ip_type = "DualStack" - restrict_outbound_network_access = true + name = "acctestkc%s" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + allowed_fqdns = ["255.255.255.0/24"] + allowed_ip_ranges = ["0.0.0.0/0"] + public_network_access_enabled = false + public_ip_type = "DualStack" + outbound_network_access_restricted = true sku { name = "Standard_D13_v2" capacity = 2