Terraform: Invalid resource attributes in outputs ignored

Created on 27 Sep 2016  ยท  5Comments  ยท  Source: hashicorp/terraform

Terraform Version

Terraform v0.7.5-dev (e12f42a8b5c91e7ae17eef5dcd0629491d74b59a)

Affected Resource(s)

  • core

    Terraform Configuration Files

variable "aws_access_key" {}
variable "aws_secret_key" {}
variable "aws_region" {}

provider "aws" {
  access_key = "${var.aws_access_key}"
  secret_key = "${var.aws_secret_key}"
  region     = "${var.aws_region}"
}

resource "aws_vpc" "repro" {
  cidr_block = "10.1.0.0/16"
}

output "vpc" {
  value = "${aws_vpc.repro.not-a-real-attribute}"
}

Debug Output

Debug output

Expected Behavior

Terraform should error that "not-a-real-attribute" is not a real attribute.

Actual Behavior

Terraform ignores the attribute; it is missing from the output at the end.

Steps to Reproduce

  1. terraform apply or terraform refresh

    Important Factoids

Running master, but reproed on 0.7.4 too.

bug core

Most helpful comment

This is fixed by #16204, and now enabled in master

All 5 comments

Probably related to #8077

There is definitely another bug tracking this, this has been a longstanding issue for probably years. The issue has to do with apply vs plan time validation and interpolation. This is likely fixable with new graphs but I'm unsure...

I confirm this is still happening in Terraform 0.9.5. It also happens for any interpolation error:

Here is a simpler test case (no relying on AWS):

resource "null_resource" "some_resource" {
  triggers {
    foo = "1"
  }
}

output "an_ouput" {
  value = "1"
}

output "invalid_interpolation" {
  value = "${upper(map())}"
}

output "invalid attribute_in_resource" {
  value = "${null_resource.some_resource.non_existent}"
}

The 2 latest outputs should fail.

This is fixed by #16204, and now enabled in master

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.

Was this page helpful?
0 / 5 - 0 ratings