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

HDInsight clusters: add support for private_link_configuration #25629

Merged
merged 2 commits into from
Apr 17, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ func resourceHDInsightHadoopCluster() *pluginsdk.Resource {

"storage_account_gen2": SchemaHDInsightsGen2StorageAccounts(),

"private_link_configuration": SchemaHDInsightPrivateLinkConfigurations(),

"roles": {
Type: pluginsdk.TypeList,
Required: true,
Expand Down Expand Up @@ -233,6 +235,9 @@ func resourceHDInsightHadoopClusterCreate(d *pluginsdk.ResourceData, meta interf
networkPropertiesRaw := d.Get("network").([]interface{})
networkProperties := ExpandHDInsightsNetwork(networkPropertiesRaw)

privateLinkConfigurationsRaw := d.Get("private_link_configuration").([]interface{})
privateLinkConfigurations := ExpandHDInsightPrivateLinkConfigurations(privateLinkConfigurationsRaw)

computeIsolationProperties := ExpandHDInsightComputeIsolationProperties(d.Get("compute_isolation").([]interface{}))

storageAccountsRaw := d.Get("storage_account").([]interface{})
Expand Down Expand Up @@ -268,11 +273,12 @@ func resourceHDInsightHadoopClusterCreate(d *pluginsdk.ResourceData, meta interf
payload := clusters.ClusterCreateParametersExtended{
Location: utils.String(location),
Properties: &clusters.ClusterCreateProperties{
Tier: pointer.To(tier),
OsType: pointer.To(clusters.OSTypeLinux),
ClusterVersion: utils.String(clusterVersion),
MinSupportedTlsVersion: utils.String(tls),
NetworkProperties: networkProperties,
Tier: pointer.To(tier),
OsType: pointer.To(clusters.OSTypeLinux),
ClusterVersion: utils.String(clusterVersion),
MinSupportedTlsVersion: utils.String(tls),
NetworkProperties: networkProperties,
PrivateLinkConfigurations: privateLinkConfigurations,
ClusterDefinition: &clusters.ClusterDefinition{
Kind: pointer.To(clusters.ClusterKindHadoop),
ComponentVersion: pointer.To(componentVersions),
Expand Down Expand Up @@ -440,6 +446,10 @@ func resourceHDInsightHadoopClusterRead(d *pluginsdk.ResourceData, meta interfac
return fmt.Errorf("flattening `network`: %+v", err)
}

if err := d.Set("private_link_configuration", flattenHDInsightPrivateLinkConfigurations(props.PrivateLinkConfigurations)); err != nil {
return fmt.Errorf("flattening `private_link_configuration`: %+v", err)
}

hadoopRoles := hdInsightRoleDefinition{
HeadNodeDef: hdInsightHadoopClusterHeadNodeDefinition,
WorkerNodeDef: hdInsightHadoopClusterWorkerNodeDefinition,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1507,6 +1507,17 @@ resource "azurerm_hdinsight_hadoop_cluster" "test" {
is_default = true
}

private_link_configuration {
name = "testconfig"
group_id = "headnode"
ip_configuration {
name = "testipconfig"
primary = false
private_ip_allocation_method = "dynamic"
subnet_id = azurerm_subnet.test.id
}
}

roles {
head_node {
vm_size = "Standard_D3_V2"
Expand Down
20 changes: 15 additions & 5 deletions internal/services/hdinsight/hdinsight_hbase_cluster_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ func resourceHDInsightHBaseCluster() *pluginsdk.Resource {

"storage_account_gen2": SchemaHDInsightsGen2StorageAccounts(),

"private_link_configuration": SchemaHDInsightPrivateLinkConfigurations(),

"roles": {
Type: pluginsdk.TypeList,
Required: true,
Expand Down Expand Up @@ -181,6 +183,9 @@ func resourceHDInsightHBaseClusterCreate(d *pluginsdk.ResourceData, meta interfa
networkPropertiesRaw := d.Get("network").([]interface{})
networkProperties := ExpandHDInsightsNetwork(networkPropertiesRaw)

privateLinkConfigurationsRaw := d.Get("private_link_configuration").([]interface{})
privateLinkConfigurations := ExpandHDInsightPrivateLinkConfigurations(privateLinkConfigurationsRaw)

hbaseRoles := hdInsightRoleDefinition{
HeadNodeDef: hdInsightHBaseClusterHeadNodeDefinition,
WorkerNodeDef: hdInsightHBaseClusterWorkerNodeDefinition,
Expand Down Expand Up @@ -209,11 +214,12 @@ func resourceHDInsightHBaseClusterCreate(d *pluginsdk.ResourceData, meta interfa
params := clusters.ClusterCreateParametersExtended{
Location: utils.String(location),
Properties: &clusters.ClusterCreateProperties{
Tier: pointer.To(tier),
OsType: pointer.To(clusters.OSTypeLinux),
ClusterVersion: utils.String(clusterVersion),
MinSupportedTlsVersion: utils.String(tls),
NetworkProperties: networkProperties,
Tier: pointer.To(tier),
OsType: pointer.To(clusters.OSTypeLinux),
ClusterVersion: utils.String(clusterVersion),
MinSupportedTlsVersion: utils.String(tls),
NetworkProperties: networkProperties,
PrivateLinkConfigurations: privateLinkConfigurations,
ClusterDefinition: &clusters.ClusterDefinition{
Kind: pointer.To(clusters.ClusterKindHBase),
ComponentVersion: pointer.To(componentVersions),
Expand Down Expand Up @@ -352,6 +358,10 @@ func resourceHDInsightHBaseClusterRead(d *pluginsdk.ResourceData, meta interface
return fmt.Errorf("flattening `network`: %+v", err)
}

if err := d.Set("private_link_configuration", flattenHDInsightPrivateLinkConfigurations(props.PrivateLinkConfigurations)); err != nil {
return fmt.Errorf("flattening `private_link_configuration`: %+v", err)
}

diskEncryptionProps, err := flattenHDInsightsDiskEncryptionProperties(props.DiskEncryptionProperties)
if err != nil {
return err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,17 @@ resource "azurerm_hdinsight_hbase_cluster" "test" {
is_default = true
}

private_link_configuration {
name = "testconfig"
group_id = "headnode"
ip_configuration {
name = "testipconfig"
primary = false
private_ip_allocation_method = "dynamic"
subnet_id = azurerm_subnet.test.id
}
}

roles {
head_node {
vm_size = "Standard_D3_V2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ func resourceHDInsightInteractiveQueryCluster() *pluginsdk.Resource {

"storage_account_gen2": SchemaHDInsightsGen2StorageAccounts(),

"private_link_configuration": SchemaHDInsightPrivateLinkConfigurations(),

"tags": commonschema.Tags(),

"https_endpoint": {
Expand Down Expand Up @@ -205,6 +207,9 @@ func resourceHDInsightInteractiveQueryClusterCreate(d *pluginsdk.ResourceData, m
networkPropertiesRaw := d.Get("network").([]interface{})
networkProperties := ExpandHDInsightsNetwork(networkPropertiesRaw)

privateLinkConfigurationsRaw := d.Get("private_link_configuration").([]interface{})
privateLinkConfigurations := ExpandHDInsightPrivateLinkConfigurations(privateLinkConfigurationsRaw)

storageAccountsRaw := d.Get("storage_account").([]interface{})
storageAccountsGen2Raw := d.Get("storage_account_gen2").([]interface{})
storageAccounts, expandedIdentity, err := ExpandHDInsightsStorageAccounts(storageAccountsRaw, storageAccountsGen2Raw)
Expand Down Expand Up @@ -242,11 +247,12 @@ func resourceHDInsightInteractiveQueryClusterCreate(d *pluginsdk.ResourceData, m
params := clusters.ClusterCreateParametersExtended{
Location: utils.String(location),
Properties: &clusters.ClusterCreateProperties{
Tier: pointer.To(tier),
OsType: pointer.To(clusters.OSTypeLinux),
ClusterVersion: utils.String(clusterVersion),
MinSupportedTlsVersion: utils.String(tls),
NetworkProperties: networkProperties,
Tier: pointer.To(tier),
OsType: pointer.To(clusters.OSTypeLinux),
ClusterVersion: utils.String(clusterVersion),
MinSupportedTlsVersion: utils.String(tls),
NetworkProperties: networkProperties,
PrivateLinkConfigurations: privateLinkConfigurations,
EncryptionInTransitProperties: &clusters.EncryptionInTransitProperties{
IsEncryptionInTransitEnabled: &encryptionInTransit,
},
Expand Down Expand Up @@ -400,6 +406,10 @@ func resourceHDInsightInteractiveQueryClusterRead(d *pluginsdk.ResourceData, met
return fmt.Errorf("flattening `network`: %+v", err)
}

if err := d.Set("private_link_configuration", flattenHDInsightPrivateLinkConfigurations(props.PrivateLinkConfigurations)); err != nil {
return fmt.Errorf("flattening `private_link_configuration`: %+v", err)
}

interactiveQueryRoles := hdInsightRoleDefinition{
HeadNodeDef: hdInsightInteractiveQueryClusterHeadNodeDefinition,
WorkerNodeDef: hdInsightInteractiveQueryClusterWorkerNodeDefinition,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,17 @@ resource "azurerm_hdinsight_interactive_query_cluster" "test" {
is_default = true
}

private_link_configuration {
name = "testconfig"
group_id = "headnode"
ip_configuration {
name = "testipconfig"
primary = false
private_ip_allocation_method = "dynamic"
subnet_id = azurerm_subnet.test.id
}
}

roles {
head_node {
vm_size = "Standard_D13_V2"
Expand Down
19 changes: 14 additions & 5 deletions internal/services/hdinsight/hdinsight_kafka_cluster_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ func resourceHDInsightKafkaCluster() *pluginsdk.Resource {

"storage_account_gen2": SchemaHDInsightsGen2StorageAccounts(),

"private_link_configuration": SchemaHDInsightPrivateLinkConfigurations(),

"compute_isolation": SchemaHDInsightsComputeIsolation(),

"encryption_in_transit_enabled": {
Expand Down Expand Up @@ -270,6 +272,9 @@ func resourceHDInsightKafkaClusterCreate(d *pluginsdk.ResourceData, meta interfa
networkPropertiesRaw := d.Get("network").([]interface{})
networkProperties := ExpandHDInsightsNetwork(networkPropertiesRaw)

privateLinkConfigurationsRaw := d.Get("private_link_configuration").([]interface{})
privateLinkConfigurations := ExpandHDInsightPrivateLinkConfigurations(privateLinkConfigurationsRaw)

kafkaRoles := hdInsightRoleDefinition{
HeadNodeDef: hdInsightKafkaClusterHeadNodeDefinition,
WorkerNodeDef: hdInsightKafkaClusterWorkerNodeDefinition,
Expand Down Expand Up @@ -301,11 +306,12 @@ func resourceHDInsightKafkaClusterCreate(d *pluginsdk.ResourceData, meta interfa
payload := clusters.ClusterCreateParametersExtended{
Location: utils.String(location),
Properties: &clusters.ClusterCreateProperties{
Tier: pointer.To(tier),
OsType: pointer.To(clusters.OSTypeLinux),
ClusterVersion: utils.String(clusterVersion),
MinSupportedTlsVersion: utils.String(tls),
NetworkProperties: networkProperties,
Tier: pointer.To(tier),
OsType: pointer.To(clusters.OSTypeLinux),
ClusterVersion: utils.String(clusterVersion),
MinSupportedTlsVersion: utils.String(tls),
NetworkProperties: networkProperties,
PrivateLinkConfigurations: privateLinkConfigurations,
ClusterDefinition: &clusters.ClusterDefinition{
Kind: pointer.To(clusters.ClusterKindKafka),
ComponentVersion: pointer.To(componentVersions),
Expand Down Expand Up @@ -472,6 +478,9 @@ func resourceHDInsightKafkaClusterRead(d *pluginsdk.ResourceData, meta interface
if err := d.Set("network", flattenHDInsightsNetwork(props.NetworkProperties)); err != nil {
return fmt.Errorf("flatten `network`: %+v", err)
}
if err := d.Set("private_link_configuration", flattenHDInsightPrivateLinkConfigurations(props.PrivateLinkConfigurations)); err != nil {
return fmt.Errorf("flattening `private_link_configuration`: %+v", err)
}
if err := d.Set("compute_isolation", flattenHDInsightComputeIsolationProperties(props.ComputeIsolationProperties)); err != nil {
return fmt.Errorf("failed setting `compute_isolation`: %+v", err)
}
Expand Down
Loading
Loading