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

Upon destroy of eks component "depends on resource attributes that cannot be determined" #54

Closed
nitrocode opened this issue Oct 14, 2022 · 3 comments · Fixed by #56
Closed
Labels
bug 🐛 An issue with the system

Comments

@nitrocode
Copy link
Member

nitrocode commented Oct 14, 2022

Found a bug? Maybe our Slack Community can help.

Slack Community

Describe the Bug

When I destroy the eks component, I see this error

│ Error: Invalid count argument
│
│   on .terraform/modules/iam_roles.account_map/modules/remote-state/remote.tf line 6, in data "terraform_remote_state" "remote":6:   count = local.remote_state_enabled && local.backend_type == "remote" ? 1 : 0
│
│ The "count" value depends on resource attributes that cannot be determined until apply, so Terraform cannot predict how many instances will be created. To work around this, use the -target
│ argument to first apply only the resources that the count depends on.
╵
╷
│ Error: Invalid count argument
│
│   on .terraform/modules/iam_roles.account_map/modules/remote-state/s3.tf line 6, in data "terraform_remote_state" "s3":6:   count = local.remote_state_enabled && local.backend_type == "s3" ? 1 : 0
│
│ The "count" value depends on resource attributes that cannot be determined until apply, so Terraform cannot predict how many instances will be created. To work around this, use the -target
│ argument to first apply only the resources that the count depends on.

Expected Behavior

Allow destruction

Steps to Reproduce

Steps to reproduce the behavior:

  1. atmos terraform destroy eks --stack uw2-dev

Additional Context

data "terraform_remote_state" "remote" {
count = local.remote_state_enabled && local.backend_type == "remote" ? 1 : 0

data "terraform_remote_state" "s3" {
count = local.remote_state_enabled && local.backend_type == "s3" ? 1 : 0

variable "bypass" {
type = bool
description = "Set to true to skip looking up the remote state and just return the defaults"
default = false
}

remote_state_enabled = ! var.bypass

backend_type = try(coalesce(local.remote_state_backend_type, local.config.backend_type), "")

workarounds

I tried setting bypass = ! var.enabled which resulted in the same above error.

The workaround was to destroy the eks component using enabled=false which got around this error.

@nitrocode nitrocode added the bug 🐛 An issue with the system label Oct 14, 2022
@Nuru
Copy link
Contributor

Nuru commented Oct 15, 2022

Closing as duplicate of hashicorp/terraform#27849 which was resolved in Terraform 1.0. Note that even using Terraform 1.3, this issue will arise if the last terraform apply was from a broken version.

@Nuru Nuru closed this as completed Oct 15, 2022
@Nuru
Copy link
Contributor

Nuru commented Oct 15, 2022

Looks like this is also due to a new Terraform bug: hashicorp/terraform#32023

@Nuru
Copy link
Contributor

Nuru commented Oct 17, 2022

Closing as "fixed" in #56 because there is not much else we can do until hashicorp/terraform#32023 is fixed.

@Nuru Nuru closed this as completed Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An issue with the system
Projects
None yet
2 participants