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

Destroy with empty state: Invalid index #215

Closed
p24-max opened this issue Nov 28, 2022 · 2 comments
Closed

Destroy with empty state: Invalid index #215

p24-max opened this issue Nov 28, 2022 · 2 comments

Comments

@p24-max
Copy link

p24-max commented Nov 28, 2022

Description

terraform destroy fails when not all resources could be removed due to an error and the destroy command needs to be executed again. terraform destroy fails with this error:

╷
│ Error: Invalid index
│ 
│   on main.tf line 24, in locals:
│   24:   iam_instance_profile_arn  = var.create_iam_instance_profile ? aws_iam_instance_profile.this[0].arn : var.iam_instance_profile_arn
│     ├────────────────
│     │ aws_iam_instance_profile.this is empty tuple
│ 
│ The given key does not identify an element in this collection value: the
│ collection has no elements.
╵

Versions

  • Module version [Required]: 6.5.3

  • Terraform version:

Terraform v1.3.4
on darwin_arm64

  • Provider version(s):

provider registry.terraform.io/hashicorp/aws v4.40.0

@bryantbiggs
Copy link
Member

This is a provider related issue and not a module issue:

@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 Dec 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants