Closed titus-chu-kmon closed 1 month ago
@titus-chu-kmon has this occurred again with the later versions of the provider ?
Hi,
I'm seeing this with v1.14.0_x5. I checked with the above tag, my panic at the statement on line 397 of resource.go
matches the statement in the older version of the file.
Resources being created:
aws_backup_region_settings.r1 Modifying
awscc_backup_restore_testing_plan.s1[0] Creating...
aws_backup_region_settings.r1 complete after 1s
aws_backup_region_settings.r2 Modifying
awscc_backup_restore_testing_plan.s2[0] Creating...
aws_backup_region_settings.r2 complete after 0s
Error: Plugin did not respond
I guess the progressEvent.Identifier
is invalid, and not checked before use. Both Go routines doing the Create panic'd.
My crash happens on line 397:
id := aws.ToString(progressEvent.Identifier)
Sorry this is for a client, so I can't share much. But happy to work on a fix.
Here's a possible fix, just a check that the string pointer isn't nil. In the error clause it's already checking for an empty string, as a not-created-resource is possible at this point.
var progressEvent *cctypes.ProgressEvent
waiter := cloudcontrol.NewResourceRequestSuccessWaiter(conn, func(o *cloudcontrol.ResourceRequestSuccessWaiterOptions) {
o.Retryable = tfcloudcontrol.RetryGetResourceRequestStatus(&progressEvent)
})
err = waiter.Wait(ctx, &cloudcontrol.GetResourceRequestStatusInput{RequestToken: output.ProgressEvent.RequestToken}, r.createTimeout)
Insert a check on the string pointer here:
// 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))
// Save any ID to state so that the resource will be marked as tainted.
if id != "" {
if err := r.setId(ctx, id, &response.State); err != nil {
response.Diagnostics.Append(ResourceIdentifierNotSetDiag(err))
}
}
return
}
The id
var is used later in the function, so needs to be initialised outside the error clause.
@quixoticmonk is there a way to raise attention on the PR for this, to maybe progress to a review?
Entirely selfishly we could do with a (this) bug fix. 😄
hi, i got this when trying to create a DMS data provider