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

Terraform prints dependency error instead of actual error if reference misconfigured resource #15053

Closed
Noah-Huppert opened this issue Jun 4, 2017 · 1 comment

Comments

@Noah-Huppert
Copy link

Terraform Version

$ terraform -v
Terraform v0.9.6

Affected Resource(s)

All? Found bug with:

  • digitalocean_floating_ip
  • digitalocean_record

I believe this is a Terraform core issue.

Terraform Configuration Files

resource "digitalocean_floating_ip" "auto_chess" {
    droplet_id = "${digitalocean_droplet.auto_chess.region}" # <-- Important: This field is intentionally wrong, should cause validation error
    region = "${digitalocean_droplet.auto_chess.region}"
}

resource "digitalocean_domain" "noahhuppert_com" {
    name = "noahhuppert.com"
    ip_address = "${digitalocean_droplet.auto_chess.ipv4_address}" # Not important to issue, defined in other file
}

resource "digitalocean_record" "auto_chess" {
    domain = "${digitalocean_domain.noahhuppert_com.name}"
    name = "auto_chess"
    type = "A"
    value = "${digitalocean_floating_ip.auto_chess.ip_address}"
}

Debug Output

Gist

Panic Output

None

Expected Behavior

Terraform should inform the user that the value they provided for digitalocean_floating_ip.auto_chess.droplet_id is incorrect like so:

* module.auto-chess.digitalocean_floating_ip.auto_chess: droplet_id: cannot parse '' as int: strconv.ParseInt: parsing "nyc3": invalid syntax

Actual Behavior

Terraform claims that digitalocean_floating_ip.auto_chess.ip_address is not found. This causes one to start debugging their code for a link/dependency error (Calling terraform graph, adding depends_on to everything, etc...). Instead of debugging their code for an incorrect digitalocean_floating_ip.auto_chess.droplet_id value.

Steps to Reproduce

  1. Create a resource that is misconfigured
    • In the example above this is the digitalocean_floating_ip.auto_chess
    • The droplet_id parameter is intentionally set to be a digitalocean_droplet's region when it is supposed to be an id.
  2. Create another resource that relies on a parameter of that resource
    • In the example above this is the digitialocean_record.auto_chess
    • It relies on digitalocean_floating_ip.auto_chess.ip_address
  3. terraform plan
  4. Receive a incorrect / not-really-showing-root-problem dependency error
  5. Comment out the resource which is using the misconfigured resource
    • In the example above this would mean commenting out the digitalocean_record
  6. Receive the correct validation error about your misconfigured resource

Important Factoids

Error messages and example code are in a module named auto-chess. Not included in the example code is a digitalocean_droplet named auto_chess, this is not important to the issue.

References

None

@ghost
Copy link

ghost commented Apr 9, 2020

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.

@ghost ghost locked and limited conversation to collaborators Apr 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants