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

azurerm_hdinsight_kafka_cluster add support for network block #17259

Merged
merged 2 commits into from
Jul 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions internal/services/hdinsight/hdinsight_kafka_cluster_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ func resourceHDInsightKafkaCluster() *pluginsdk.Resource {

"metastores": SchemaHDInsightsExternalMetastores(),

"network": SchemaHDInsightsNetwork(),

"component_version": {
Type: pluginsdk.TypeList,
Required: true,
Expand Down Expand Up @@ -212,6 +214,9 @@ func resourceHDInsightKafkaClusterCreate(d *pluginsdk.ResourceData, meta interfa
return fmt.Errorf("failure expanding `storage_account`: %s", err)
}

networkPropertiesRaw := d.Get("network").([]interface{})
networkProperties := ExpandHDInsightsNetwork(networkPropertiesRaw)

kafkaRoles := hdInsightRoleDefinition{
HeadNodeDef: hdInsightKafkaClusterHeadNodeDefinition,
WorkerNodeDef: hdInsightKafkaClusterWorkerNodeDefinition,
Expand Down Expand Up @@ -244,6 +249,7 @@ func resourceHDInsightKafkaClusterCreate(d *pluginsdk.ResourceData, meta interfa
OsType: hdinsight.OSTypeLinux,
ClusterVersion: utils.String(clusterVersion),
MinSupportedTLSVersion: utils.String(tls),
NetworkProperties: networkProperties,
ClusterDefinition: &hdinsight.ClusterDefinition{
Kind: utils.String("Kafka"),
ComponentVersion: componentVersions,
Expand Down Expand Up @@ -401,6 +407,12 @@ func resourceHDInsightKafkaClusterRead(d *pluginsdk.ResourceData, meta interface
d.Set("encryption_in_transit_enabled", props.EncryptionInTransitProperties.IsEncryptionInTransitEnabled)
}

if props.NetworkProperties != nil {
if err := d.Set("network", FlattenHDInsightsNetwork(props.NetworkProperties)); err != nil {
return fmt.Errorf("flatten `network`: %+v", err)
}
}

monitor, err := extensionsClient.GetMonitoringStatus(ctx, resourceGroup, name)
if err != nil {
return fmt.Errorf("failed reading monitor configuration for HDInsight Hadoop Cluster %q (Resource Group %q): %+v", name, resourceGroup, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -863,11 +863,16 @@ resource "azurerm_hdinsight_kafka_cluster" "test" {
}

storage_account {
storage_resource_id = azurerm_storage_account.test.id
storage_container_id = azurerm_storage_container.test.id
storage_account_key = azurerm_storage_account.test.primary_access_key
is_default = true
}

network {
connection_direction = "Outbound"
}

roles {
head_node {
vm_size = "Standard_D3_V2"
Expand Down
12 changes: 12 additions & 0 deletions website/docs/r/hdinsight_kafka_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ The following arguments are supported:

* `roles` - (Required) A `roles` block as defined below.

* `network` - (Optional) A `network` block as defined below.

* `storage_account` - (Required) One or more `storage_account` block as defined below.

* `storage_account_gen2` - (Required) A `storage_account_gen2` block as defined below.
Expand Down Expand Up @@ -170,6 +172,16 @@ A `roles` block supports the following:

---

A `network` block supports the following:

* `connection_direction` - (Optional) The direction of the resource provider connection. Possible values include `Inbound` or `Outbound`. Defaults to `Inbound`. Changing this forces a new resource to be created.

-> **NOTE:** To enabled the private link the `connection_direction` must be set to `Outbound`.

* `private_link_enabled` - (Optional) Is the private link enabled? Possible values include `True` or `False`. Defaults to `False`. Changing this forces a new resource to be created.

---

A `storage_account` block supports the following:

* `is_default` - (Required) Is this the Default Storage Account for the HDInsight Hadoop Cluster? Changing this forces a new resource to be created.
Expand Down