Skip to content

Commit

Permalink
Fix for panic when attempting to read resource identifier after creat…
Browse files Browse the repository at this point in the history
…ing resource has failed.
  • Loading branch information
thisdougb committed Sep 19, 2024
1 parent ef97dde commit bff6480
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/generic/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,11 @@ func (r *genericResource) Create(ctx context.Context, request resource.CreateReq

err = waiter.Wait(ctx, &cloudcontrol.GetResourceRequestStatusInput{RequestToken: output.ProgressEvent.RequestToken}, r.createTimeout)

id := aws.ToString(progressEvent.Identifier)
// If the resource failed to create, then Identifier may be a nil ptr
var id string
if progressEvent.Identifier != nil {
id = aws.ToString(progressEvent.Identifier)
}

if err != nil {
response.Diagnostics.Append(ServiceOperationWaiterErrorDiag("Cloud Control API", "CreateResource", err))
Expand Down

0 comments on commit bff6480

Please sign in to comment.