SDK version
github.com/hashicorp/terraform-plugin-sdk/v2 v2.38.1
Expected Behavior
Create operation fails with expected error.
Actual Behavior
Create operation fails with expected error and Missing Resource Identity After Create: The Terraform provider unexpectedly returned no resource identity after having no errors in the resource error.
Steps to Reproduce
In resource code, set id in create that fails. (This allows a tainted resource to be saved in state to allow cleanup in a future apply)
If there is no state, the conditional at
|
if destroy || newInstanceState == nil || newInstanceState.Attributes == nil || newInstanceState.ID == "" { |
exits without checking for Resource Identity.
However, if id is set, the return is skipped and it continues on the the Resource Identity checks at
.
See, for example: hashicorp/terraform-provider-aws#45351