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

Pop up panic: can't use ElementIterator on null value error #110

Open
showerlee opened this issue Jul 18, 2020 · 3 comments
Open

Pop up panic: can't use ElementIterator on null value error #110

showerlee opened this issue Jul 18, 2020 · 3 comments

Comments

@showerlee
Copy link

Hi @jckuester , recently I got the following error while cleanup ecs resource. the weird thing is current region doesn't have any ecs cluster, but it still happens each time.

	Type: aws_ecs_cluster
	Found: 1

		Id:		arn:aws:ecs:ap-southeast-2:xxxxxxxxxxxx:cluster/default

	---

   • TOTAL NUMBER OF RESOURCES THAT WOULD BE DELETED: 1
   • USER WILL NOT BE ASKED FOR CONFIRMATION (FORCE MODE)
   • STARTING TO DELETE RESOURCES
panic: can't use ElementIterator on null value

goroutine 194 [running]:
github.com/zclconf/go-cty/cty.Value.ElementIterator(0x5f98800, 0xc00048b450, 0x0, 0x0, 0x7, 0x0)
	/home/jan/go/pkg/mod/github.com/zclconf/[email protected]/cty/value_ops.go:1038 +0x11a
github.com/zclconf/go-cty/cty.Value.AsValueMap(0x5f98800, 0xc00048b450, 0x0, 0x0, 0x1)
	/home/jan/go/pkg/mod/github.com/zclconf/[email protected]/cty/value_ops.go:1243 +0xfe
github.com/jckuester/terradozer/pkg/provider.enableForceDestroyAttributes(0x5f98800, 0xc00048b450, 0x0, 0x0, 0x203000, 0x203000, 0x203000, 0xf4a6622f9a8800fb)
	/home/jan/go/pkg/mod/github.com/jckuester/[email protected]/pkg/provider/provider.go:236 +0xf7
github.com/jckuester/terradozer/pkg/provider.TerraformProvider.DestroyResource.func1(0x4c0da0)
	/home/jan/go/pkg/mod/github.com/jckuester/[email protected]/pkg/provider/provider.go:200 +0x86
github.com/hashicorp/terraform/helper/resource.Retry.func1(0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/home/jan/go/pkg/mod/github.com/hashicorp/[email protected]/helper/resource/wait.go:22 +0x5e
github.com/hashicorp/terraform/helper/resource.(*StateChangeConf).WaitForState.func1(0xc00926e720, 0xc0001d4540, 0xc000850600, 0xc007e240c0, 0xc0082242d0, 0xc0082242c8)
	/home/jan/go/pkg/mod/github.com/hashicorp/[email protected]/helper/resource/state.go:103 +0x298
created by github.com/hashicorp/terraform/helper/resource.(*StateChangeConf).WaitForState
	/home/jan/go/pkg/mod/github.com/hashicorp/[email protected]/helper/resource/state.go:80 +0x1bf

The awsweeper policy is following with latest version v.0.10.1

aws_ecs_cluster:
  - tags:
      NOT(Owner): .*

Could you help to take a look?

@jckuester
Copy link
Owner

jckuester commented Jul 25, 2020

Hi @showerlee again,

thanks for another bug report. I guess know what the issue is and will fix it:

I assume that your ECS cluster is in state INACTIVE (which means it has already been deleted). Can you please check? AWSweeper should not list INACTIVE ECS clusters, but it currently does - I will fix that. I also will fix the panic. What happen there is that I assume that we won't see already deleted resources in the deletion stage (with nil state) and don't check for nil there.

@jckuester
Copy link
Owner

jckuester commented Sep 4, 2020

Just letting you know that the error you encountered will be fixed in the following PR and is released soon: #116. Thanks for you patience.

@jckuester
Copy link
Owner

jckuester commented Sep 7, 2020

Fix is released in v0.10.2. Please let me know if that fixes the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants