From c746a2ffc5f8cc2e4426d67d9067ed31c8b9b9d7 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Thu, 12 Oct 2023 13:40:55 -0500 Subject: [PATCH 1/3] aws_opensearchserverless_collection: return error on read --- internal/service/opensearchserverless/collection.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/service/opensearchserverless/collection.go b/internal/service/opensearchserverless/collection.go index ea38cc69e65..e661616cd74 100644 --- a/internal/service/opensearchserverless/collection.go +++ b/internal/service/opensearchserverless/collection.go @@ -208,6 +208,14 @@ func (r *resourceCollection) Read(ctx context.Context, req resource.ReadRequest, return } + if err != nil { + resp.Diagnostics.AddError( + create.ProblemStandardMessage(names.OpenSearchServerless, create.ErrActionReading, ResNameCollection, state.ID.ValueString(), nil), + err.Error(), + ) + return + } + state.ARN = flex.StringToFramework(ctx, out.Arn) state.CollectionEndpoint = flex.StringToFramework(ctx, out.CollectionEndpoint) state.DashboardEndpoint = flex.StringToFramework(ctx, out.DashboardEndpoint) From e9e6cde8551859e3054fbb21ce4c25b6487e3fef Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Thu, 12 Oct 2023 13:57:49 -0500 Subject: [PATCH 2/3] add CHANGELOG entry --- .changelog/33918.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/33918.txt diff --git a/.changelog/33918.txt b/.changelog/33918.txt new file mode 100644 index 00000000000..dbb7999cf46 --- /dev/null +++ b/.changelog/33918.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/ws_opensearchserverless_collection: Fix crash when error is returned +``` \ No newline at end of file From d8e807391557c6d0d007e9d4f14ca13603dfbf9c Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Thu, 12 Oct 2023 14:20:22 -0500 Subject: [PATCH 3/3] tweak CHANGELOG entry --- .changelog/33918.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changelog/33918.txt b/.changelog/33918.txt index dbb7999cf46..8eae4ed8220 100644 --- a/.changelog/33918.txt +++ b/.changelog/33918.txt @@ -1,3 +1,3 @@ ```release-note:bug -resource/ws_opensearchserverless_collection: Fix crash when error is returned +resource/aws_opensearchserverless_collection: Fix crash when error is returned ``` \ No newline at end of file