From 97571f8b4908cbee5d9a2df7232d3146a0810e20 Mon Sep 17 00:00:00 2001 From: Tom Harvey Date: Fri, 3 Feb 2023 01:20:50 +0100 Subject: [PATCH] `data.azurerm_monitor_data_collection_rule` - raises an error when the specified data collection rule can't be found (#20282) --- .../monitor/monitor_data_collection_rule_data_source.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/internal/services/monitor/monitor_data_collection_rule_data_source.go b/internal/services/monitor/monitor_data_collection_rule_data_source.go index 9817692f563c..6d537c068b07 100644 --- a/internal/services/monitor/monitor_data_collection_rule_data_source.go +++ b/internal/services/monitor/monitor_data_collection_rule_data_source.go @@ -267,8 +267,7 @@ func (d DataCollectionRuleDataSource) Read() sdk.ResourceFunc { resp, err := client.Get(ctx, id) if err != nil { if response.WasNotFound(resp.HttpResponse) { - metadata.Logger.Infof("%s was not found - removing from state!", id) - return metadata.MarkAsGone(id) + return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) }