From 0160f99ce6e0bb51f350ce5d2770e5b05a399c40 Mon Sep 17 00:00:00 2001 From: Alexandros Afentoulis Date: Mon, 26 Aug 2024 22:29:43 +0300 Subject: [PATCH 1/2] internal/kibana: fix datasourceConnectorRead error Make sure that datasourceConnectorRead() returns the appropriate error when no connectors are found. --- internal/kibana/connector_data_source.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/kibana/connector_data_source.go b/internal/kibana/connector_data_source.go index e901c8bf3..03aff8a25 100644 --- a/internal/kibana/connector_data_source.go +++ b/internal/kibana/connector_data_source.go @@ -76,7 +76,7 @@ func datasourceConnectorRead(ctx context.Context, d *schema.ResourceData, meta i } if len(foundConnectors) == 0 { - diag.Errorf("error while creating elasticstack_kibana_action_connector datasource: connector with name [%s/%s] and type [%s] not found", spaceId, connectorName, connectorType) + return diag.Errorf("error while creating elasticstack_kibana_action_connector datasource: connector with name [%s/%s] and type [%s] not found", spaceId, connectorName, connectorType) } if len(foundConnectors) > 1 { From cd5d615d179f8fc9fb7bccf71a8376cab4c95a7e Mon Sep 17 00:00:00 2001 From: Toby Brain Date: Tue, 27 Aug 2024 09:17:12 +1000 Subject: [PATCH 2/2] Changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a02e2a61..811060fb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ - Add the `alert_delay` field to the Create Rule API ([#715](https://github.com/elastic/terraform-provider-elasticstack/pull/715)) - Add support for data_stream `lifecycle` template settings ([#724](https://github.com/elastic/terraform-provider-elasticstack/pull/724)) +- Fix a provider panic when `elasticstack_kibana_action_connector` reads a non-existant connector ([#729](https://github.com/elastic/terraform-provider-elasticstack/pull/729)) ## [0.11.6] - 2024-08-20