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

Interpolating nested Removed fields silently fails #144

Closed
rileykarson opened this issue Mar 19, 2019 · 3 comments
Closed

Interpolating nested Removed fields silently fails #144

rileykarson opened this issue Mar 19, 2019 · 3 comments
Labels
bug Something isn't working upstream-protocol Requires change of protocol specification, i.e. can't be done under the current protocol upstream-terraform

Comments

@rileykarson
Copy link
Contributor

Terraform Version

Terraform 0.11.11

`google` provider `2.1.0`, `2.2.0`

Terraform Configuration Files

resource "google_compute_instance" "default" {
  name         = "test2"
  machine_type = "n1-standard-2"
  zone         = "us-central1-b"

  boot_disk {
    initialize_params {
      image = "debian-cloud/debian-9"
    }
  }

  network_interface {
    network = "default"

    access_config {
      // Ephemeral IP
    }
  }
  service_account {
    scopes = ["userinfo-email", "compute-ro", "storage-ro"]
  }
}

output "should_fail" {
  value = "${google_compute_instance.default.network_interface.0.address}"
}

Expected Behavior

google_compute_instance.default: Refreshing state... (ID: test2)

Error: Error running plan: 1 error(s) occurred:

* output.should_fail: Resource 'google_compute_instance.default' does not have attribute 'network_interface.0.address' for variable 'google_compute_instance.default.network_interface.0.address'

Actual Behavior

google_compute_instance.default: Refreshing state... (ID: test2)

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

should_fail =

Steps to Reproduce

terraform apply
@apparentlymart
Copy link
Contributor

Thanks for reporting this, @rileykarson.

This one is a little tricky right now because the idea of "Removed" only exists in the SDK today: Terraform Core just sees these as normal attributes that happen to have a validation rule that returns an error if they are set.

To fix this properly we'll probably need to extend the schema model returned to Terraform Core to allow core itself to handle the "removed" concept. Probably we'd want to represent it at the provider protocol and core level as an entirely-separate list of names that are removed -- not part of the main schema -- and then that would allow core to produce specialized errors for uses of them without considering those names to be part of the object type derived from the schema as we do today.

I've labelled this with both "core" and "provider-sdk" because it kinda sits on the cusp between the two and will require changes on both sides.

@hashibot hashibot transferred this issue from hashicorp/terraform Sep 26, 2019
@hashibot hashibot added the bug Something isn't working label Oct 2, 2019
@radeksimko radeksimko added upstream-protocol Requires change of protocol specification, i.e. can't be done under the current protocol upstream-terraform labels Dec 13, 2019
@paultyng
Copy link
Contributor

We are planning to drop support for Removed in v2, so this issue will no longer be relevant I believe.

See #320 for tracking the removal.

@ghost
Copy link

ghost commented May 28, 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 May 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working upstream-protocol Requires change of protocol specification, i.e. can't be done under the current protocol upstream-terraform
Projects
None yet
Development

No branches or pull requests

5 participants