Unsuported attribute


Would like to thank beforehand for the help provided.

Issue is below:

A project was manually deleted from GCP, now this error occurs when trying to add a new project to the project.tf file

Error: Unsupported attribute

│ on svpc_access.tf line 11, in module “net-shared-vpc-access”:
│ 11: data.terraform_remote_state.environment.outputs.project,
│ ├────────────────
│ │ data.terraform_remote_state.location_environment.folder.outputs is object with 4 attributes

│ This object does not have an attribute named “project”.

Its a shared vpc network, and any changes in the project.tf and vpc.tf affects the subnets.

Any suggested fix or workaround?


You need to update your configuration appropriately, to not reference things that no longer exist.

This is of course a rather basic and obvious thing to say … but since you haven’t shown this forum what your configuration looks like, it’s not possible for members of the public to predict what the appropriate change would be! Please remember that we cannot read your mind, nor see your screen.

If you want to share multiple files, I suggest committing them to a GitHub repository, and sharing the link here.

If you decide to share further snippets of code in-line, please take note of Welcome to the forum - please reformat your message - I think in what you shared above, you manually edited bits of the message, and as a result, parts of it ended up being interpreteted as italic formatting by the forum software.

As @maxb said, it’s hard to be specific here because there’s a lot left unsaid in your question, but I’m going to make a best attempt.

Since this error message is with a remote state lookup, it seems like you have more than one Terraform configuration and some other configuration is responsible for establishing the “environment”, and then this configuration just consumes the environment information from that other configuration’s state.

If that is true then you’ll need to determine whether the change to this other “environment” configuration to remove the project output was intentional or accidental.

If it was intentional then you’ll need to study the other configuration to learn what is the new intended way to get this project information, and then update your configuration to get that data in the new way.

If it was accidental then you should shift your focus to the other configuration and try to restore the project output there, which should then allow the configuration you were working with in this question to work as it did before.

I hope the above is a useful starting point. If you have further questions it would help to say some more about how your system is designed, especially if my assumption above about the relationship between these configurations seems incorrect (which would then make the rest of my answer questionable too).

When you mention “You need to update your configuration appropriately, to not reference things that no longer exist.” are you referring to the state file?

Sorry for the italic, was not aware of the final result.

Thanks again

Yes I believe that is the case. When deleting the projects through the portal instead of using terraform, the state must have gone messed up.

Would terraform init -migrate-state correct the error and update with the latest configurations?

Thanks for the help @apparentlymart

In the situation I was imagining in my previous comment I think I would start by learning which other configuration is responsible for the state that terraform_remote_state is reading from, and then run terraform apply for that other configuration to see what Terraform proposes to do.

Ideally Terraform should notice that the project has been deleted outside of Terraform and propose to recreate it, in which case accepting that plan would restore the output value that is currently missing to that configuration’s state.

The other possibility is that the project output value has been intentionally removed from that other configuration. If that’s true then you’ll need to talk with whoever removed it to understand what they intended as the replacement for that old interface, and then update your configuration (the original one you were asking about) to match the new expectations.

Unfortunately I can’t be more specific than that because I can’t see your system architecture. You may need to ask others inside your organization to understand how these two Terraform configurations are related to one another.

1 Like

The terraform init -migrate-state option tells terraform to copy state from one storage location to another, when you are changing where you will be storing your state on an ongoing basis.

This is entirely unrelated to a data.terraform_remote_state lookup referencing an output which no longer exists in another workspace’s state.

You apparently have in your configuration the reference data.terraform_remote_state.location_environment.folder.outputs but the referenced remote state no longer has project output defined.

You need to correct that, somehow.

Beyond that, you need to share your configuration if you want to enable further help to be given.

1 Like

Reached inside the organization, to get more information.
The projects were intentionally deleted as they were not of use anymore.
From what I could gather, there was one bucket with folders for projects, each with its statefile.

Sorry for not being able to share more information, as I am not sure, what can be shared.

Thanks again for your support, it was a big help.