Skip to content

Error in Terraform 0.12.0: This object has no argument, nested block, or exported attribute #21442

@ameyaptk

Description

@ameyaptk

Terraform Version

0.12.0

Issue

Hi, when I run terraform plan on one of the config files, I get the following error

Error: Unsupported attribute

  on main.tf line 16, in module "project_01":
  16:   folder_id = "${data.terraform_remote_state.folders.folder_shared_id}"

This object has no argument, nested block, or exported attribute named
"folder_shared_id".

make: *** [plan] Error 1

Here is the main.tf file

data "terraform_remote_state" "folders" {
  backend = "local"
  config = {
    path = "../../folders/terraform.tfstate"
  }
}
...
<extraneous-code>
...
module "project_01" {
  source = "<path-to-module>"

  project_name = "network"
  folder_id = "${data.terraform_remote_state.folders.folder_shared_id}"
}

However, that attribute is present in the terraform.tfstate file


$ cat terraform.tfstate
{
  "version": 4,
  "terraform_version": "0.12.0",
  "serial": 9,
  "lineage": "76c68f13-3a49-4db0-2a95-84ef9610cefa",
  "outputs": {
    "folder_test1_id": {
      "value": "folders/***",
      "type": "string"
    },
    "folder_test2_id": {
      "value": "folders/****",
      "type": "string"
    },
    "folder_shared_id": {
      "value": "folders/****",
      "type": "string"
    }

This used to work in Terraform 0.11.13 but broke in Terraform 0.12.0. Any ideas why this is happening?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions