Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Error when trying to remove indexes and views in AWS Resource Explorer : "Unexpected Planned Resource State on Destroy │ │ The Terraform Provider unexpectedly returned resource state data when the │ resource was planned for destruction. This is always an issue in the │ Terraform Provider and should be reported to the provider developers." #29541

Closed
jga303 opened this issue Feb 21, 2023 · 3 comments · Fixed by #29550
Labels
bug Addresses a defect in current functionality. service/resourceexplorer2 Issues and PRs that pertain to the resourceexplorer2 service.

Comments

@jga303
Copy link

jga303 commented Feb 21, 2023

Terraform Core Version

1.3.9

AWS Provider Version

4.55.0

Affected Resource(s)

aws_resourceexplorer2_index
aws_resourceexplorer2_view

When I want to delete the resources by commenting the code (see example code below), I get a "Plan Error" message:
4x identical message for the 4x resources (2x for the index resources, 2x for the view resources (see code tf below)

Error:
│ Error: Unexpected Planned Resource State on Destroy
│ 
│ The Terraform Provider unexpectedly returned resource state data when the
│ resource was planned for destruction. This is always an issue in the
│ Terraform Provider and should be reported to the provider developers.
│ 
│ Ensure all resource plan modifiers do not attempt to change resource plan
│ data from being a null value if the request plan is a null value.
╵

Code example:

# Agregator index and default view
resource "aws_resourceexplorer2_index" "agr_dublin" {
  type = "AGGREGATOR"
}

resource "aws_resourceexplorer2_view" "default_dublin" {
  name = "defaultViewDUB"
  default_view = "true"
  
  depends_on = [aws_resourceexplorer2_index.agr_dublin]
}

# Other indexes (local) for each supported region

resource "aws_resourceexplorer2_index" "loc_francfort" {
  provider = aws.francfort
  type = "LOCAL"
}

resource "aws_resourceexplorer2_view" "default_francfort" {
  provider = aws.francfort
  name = "defaultViewFRA"
  default_view = "true"
    
  depends_on = [aws_resourceexplorer2_index.loc_francfort]
}

Expected Behavior

When I comment all the TF code for these four resources, the TF Plan should inform the resources are planned for deletion.

Actual Behavior

At Plan stage, there are four times the same mesage:

│ Error: Unexpected Planned Resource State on Destroy
│ 
│ The Terraform Provider unexpectedly returned resource state data when the
│ resource was planned for destruction. This is always an issue in the
│ Terraform Provider and should be reported to the provider developers.
│ 
│ Ensure all resource plan modifiers do not attempt to change resource plan
│ data from being a null value if the request plan is a null value.
╵ 

Relevant Error/Panic Output Snippet

2023-02-21T06:56:20.074Z [ERROR] provider.terraform-provider-aws_v4.55.0_x5: Response contains error diagnostic: @caller=github.com/hashicorp/terraform-plugin-go@v0.14.3/tfprotov5/internal/diag/diagnostics.go:55 diagnostic_severity=ERROR tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=c6bb7d08-82c3-de7f-9876-86d1f0f3ee8e tf_rpc=PlanResourceChange tf_resource_type=aws_resourceexplorer2_view @module=sdk.proto diagnostic_detail="The Terraform Provider unexpectedly returned resource state data when the resource was planned for destruction. This is always an issue in the Terraform Provider and should be reported to the provider developers.

Ensure all resource plan modifiers do not attempt to change resource plan data from being a null value if the request plan is a null value." diagnostic_summary="Unexpected Planned Resource State on Destroy" tf_proto_version=5.3 timestamp=2023-02-21T06:56:20.074Z
2023-02-21T06:56:20.074Z [TRACE] provider.terraform-provider-aws_v4.55.0_x5: Served request: tf_rpc=PlanResourceChange @module=sdk.proto tf_proto_version=5.3 tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=c6bb7d08-82c3-de7f-9876-86d1f0f3ee8e @caller=github.com/hashicorp/terraform-plugin-go@v0.14.3/tfprotov5/tf5server/server.go:796 tf_resource_type=aws_resourceexplorer2_view timestamp=2023-02-21T06:56:20.074Z
2023-02-21T06:56:20.074Z [ERROR] vertex "aws_resourceexplorer2_view.default_francfort (orphan)" error: Unexpected Planned Resource State on Destroy
2023-02-21T06:56:20.074Z [TRACE] vertex "aws_resourceexplorer2_view.default_francfort (orphan)": visit complete, with errors
2023-02-21T06:56:20.074Z [TRACE] dag/walk: upstream of "provider[\"registry.terraform.io/hashicorp/aws\"].francfort (close)" errored, so skipping
2023-02-21T06:56:20.074Z [TRACE] dag/walk: upstream of "root" errored, so skipping
2023-02-21T06:56:20.074Z [INFO]  backend/local: plan operation completed
╷
│ Error: Unexpected Planned Resource State on Destroy
│
│ The Terraform Provider unexpectedly returned resource state data when the resource was planned for destruction. This is always an issue in the Terraform Provider and should be reported to the provider developers.
│
│ Ensure all resource plan modifiers do not attempt to change resource plan data from being a null value if the request plan is a null value.
╵
╷
│ Error: Unexpected Planned Resource State on Destroy
│
│ The Terraform Provider unexpectedly returned resource state data when the resource was planned for destruction. This is always an issue in the Terraform Provider and should be reported to the provider developers.
│
│ Ensure all resource plan modifiers do not attempt to change resource plan data from being a null value if the request plan is a null value.
╵
╷
│ Error: Unexpected Planned Resource State on Destroy
│
│ The Terraform Provider unexpectedly returned resource state data when the resource was planned for destruction. This is always an issue in the Terraform Provider and should be reported to the provider developers.
│
│ Ensure all resource plan modifiers do not attempt to change resource plan data from being a null value if the request plan is a null value.
╵
╷
│ Error: Unexpected Planned Resource State on Destroy
│
│ The Terraform Provider unexpectedly returned resource state data when the resource was planned for destruction. This is always an issue in the Terraform Provider and should be reported to the provider developers.
│
│ Ensure all resource plan modifiers do not attempt to change resource plan data from being a null value if the request plan is a null value.
╵

Terraform Configuration Files

debug-trace-tf-rexpl.log

Steps to Reproduce

Create resources to deploy : example.tf:

# Agregator index and default view
resource "aws_resourceexplorer2_index" "agr_dublin" {
  type = "AGGREGATOR"
}

resource "aws_resourceexplorer2_view" "default_dublin" {
  name = "defaultViewDUB"
  default_view = "true"
  
  depends_on = [aws_resourceexplorer2_index.agr_dublin]
}

# Other indexes (local) for each supported region

resource "aws_resourceexplorer2_index" "loc_francfort" {
  provider = aws.francfort
  type = "LOCAL"
}

resource "aws_resourceexplorer2_view" "default_francfort" {
  provider = aws.francfort
  name = "defaultViewFRA"
  default_view = "true"
    
  depends_on = [aws_resourceexplorer2_index.loc_francfort]
}

check on the AWS console that all is created (takes minutes to have indexes working)

Then comment the code and try to run tf plan & apply (error happend already at Plan stage!)

Debug Output

see same file uploaded in section "Configuration and Logging"

Panic Output

see same file uploaded in section "Configuration and Logging"

Important Factoids

No response

References

No response

Would you like to implement a fix?

No

@jga303 jga303 added bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. labels Feb 21, 2023
@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the service/resourceexplorer2 Issues and PRs that pertain to the resourceexplorer2 service. label Feb 21, 2023
@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label Feb 21, 2023
@ewbankkit
Copy link
Contributor

I think this comes from changes introduced in #29313.

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/resourceexplorer2 Issues and PRs that pertain to the resourceexplorer2 service.
Projects
None yet
2 participants