From b1631a4fc3717984770831d61d0d807291ee4ef6 Mon Sep 17 00:00:00 2001 From: Alexey Seleznev Date: Wed, 19 Jun 2024 18:50:06 +0200 Subject: [PATCH 1/3] filter out non broker nodes --- .../service/kafka/broker_nodes_data_source.go | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/internal/service/kafka/broker_nodes_data_source.go b/internal/service/kafka/broker_nodes_data_source.go index e6961b2cc4e..b0fa5902d59 100644 --- a/internal/service/kafka/broker_nodes_data_source.go +++ b/internal/service/kafka/broker_nodes_data_source.go @@ -84,7 +84,11 @@ func dataSourceBrokerNodesRead(ctx context.Context, d *schema.ResourceData, meta return sdkdiag.AppendErrorf(diags, "listing MSK Cluster (%s) Broker Nodes: %s", clusterARN, err) } - nodeInfos = append(nodeInfos, page.NodeInfoList...) + for _, nodeInfo := range page.NodeInfoList { + if nodeInfo.BrokerNodeInfo != nil { + nodeInfos = append(nodeInfos, nodeInfo) + } + } } // node list is returned unsorted sort on broker id @@ -96,17 +100,16 @@ func dataSourceBrokerNodesRead(ctx context.Context, d *schema.ResourceData, meta tfList := []interface{}{} for _, apiObject := range nodeInfos { - if brokerNodeInfo := apiObject.BrokerNodeInfo; brokerNodeInfo != nil { - tfMap := map[string]interface{}{ - "attached_eni_id": aws.ToString(brokerNodeInfo.AttachedENIId), - "broker_id": aws.ToFloat64(brokerNodeInfo.BrokerId), - "client_subnet": aws.ToString(brokerNodeInfo.ClientSubnet), - "client_vpc_ip_address": aws.ToString(brokerNodeInfo.ClientVpcIpAddress), - names.AttrEndpoints: brokerNodeInfo.Endpoints, - "node_arn": aws.ToString(apiObject.NodeARN), - } - tfList = append(tfList, tfMap) + brokerNodeInfo := apiObject.BrokerNodeInfo + tfMap := map[string]interface{}{ + "attached_eni_id": aws.ToString(brokerNodeInfo.AttachedENIId), + "broker_id": aws.ToFloat64(brokerNodeInfo.BrokerId), + "client_subnet": aws.ToString(brokerNodeInfo.ClientSubnet), + "client_vpc_ip_address": aws.ToString(brokerNodeInfo.ClientVpcIpAddress), + names.AttrEndpoints: brokerNodeInfo.Endpoints, + "node_arn": aws.ToString(apiObject.NodeARN), } + tfList = append(tfList, tfMap) } d.SetId(clusterARN) From 214bf9d4f1baf3c75a119f48a36d014abdbbe84c Mon Sep 17 00:00:00 2001 From: Alexey Seleznev Date: Wed, 19 Jun 2024 19:05:40 +0200 Subject: [PATCH 2/3] filter out non broker nodes; update changelog --- .changelog/38042.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/38042.txt diff --git a/.changelog/38042.txt b/.changelog/38042.txt new file mode 100644 index 00000000000..c3ee138cc71 --- /dev/null +++ b/.changelog/38042.txt @@ -0,0 +1,3 @@ +```release-note:bug +data-source/aws_msk_broker_nodes: Filter out nodes other than BrokerNodes +``` \ No newline at end of file From 8aa806f288fb384d208cef7313aa168738e47987 Mon Sep 17 00:00:00 2001 From: Jared Baker Date: Wed, 7 Aug 2024 11:30:27 -0400 Subject: [PATCH 3/3] chore: tweak changelog --- .changelog/38042.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.changelog/38042.txt b/.changelog/38042.txt index c3ee138cc71..02b29dcd007 100644 --- a/.changelog/38042.txt +++ b/.changelog/38042.txt @@ -1,3 +1,3 @@ ```release-note:bug -data-source/aws_msk_broker_nodes: Filter out nodes other than BrokerNodes -``` \ No newline at end of file +data-source/aws_msk_broker_nodes: Filter out nodes with no broker info +```