3

We have created some terraform stacks for different domains, like network stack for vpc, rds stack for rds stuff, etc.

And, for instance, the rds stack depends on the network stack to get values from the outputs:

Output from network stack:

output "public_subnets" {
  value = aws_subnet.public.*.id
}

output "private_subnets" {
  value = aws_subnet.private.*.id
}

output "data_subnets" {
  value = aws_subnet.data.*.id
}

... an so on

And the rds stack will tap on the outputs

data "tfe_outputs" "networking" {
  organization = "my-tf-cloud-org"
  workspace    = "network-production-eucentral1"
}

But when I try to use the output:

│
│   on main.tf line 20, in module "db":
│   20:   base_domain = data.tfe_outputs.dns.values.fqdn
│     ├────────────────
│     │ data.tfe_outputs.dns.values has a sensitive value
│
│ This object does not have an attribute named "fqdn".
╵
╷
│ Error: Unsupported attribute
│
│   on main.tf line 22, in module "db":
│   22:   subnets     = data.tfe_outputs.networking.values.data_subnets
│     ├────────────────
│     │ data.tfe_outputs.networking.values has a sensitive value
│
│ This object does not have an attribute named "data_subnets".
╵
╷
│ Error: Unsupported attribute
│
│   on main.tf line 23, in module "db":
│   23:   vpc_id      = data.tfe_outputs.networking.values.vpc_id
│     ├────────────────
│     │ data.tfe_outputs.networking.values has a sensitive value
│
│ This object does not have an attribute named "vpc_id".

This was working before; it started all of a sudden.

I tried adding the nonsensitive cast, but it does not work.

Any idea?

Stargazer
  • 1,442
  • 12
  • 19
  • This sounds like an issue with the latest `apply` on that root module config. Can you confirm the current state version file contains those outputs for that root? – Matthew Schuchard Jul 07 '22 at 13:15
  • I found the `terraform console` to be helpful in diagnosing. In my case the `nonsensitive` cast did work. https://www.terraform.io/cli/commands/console – groksrc Jul 07 '22 at 19:45
  • Same problem, no sensitive values in the output whatsoever, not sure if terraform or terraform cloud versions are to be blamed. I see health is impacted for Terraform Registry / Releases. – nighter Jul 07 '22 at 19:48
  • For what it's worth, the values being sensitive is not relevant to this error report. Terraform is just telling you that because normally it would show you what the value actually is, but it cannot show you the real value because that would involve showing the sensitive value in the UI. When thinking about this problem you should ignore the line that says it has a sensitive value. – Martin Atkins Jul 08 '22 at 00:35

1 Answers1

4

Update:

I manage to fix the issue. I'm using terraform cloud with a remote state. If you go to your workspace_with_the_output general settings in tf cloud you will find an option called "Remote state sharing".

I added my workspace_which_consume_state on that list and now it's working. Hopefully, this helps

  • 1
    It worked, I selected the option to share with the organization... Interesting, I wonder if this was a feature rollout, if so, definitely it is a huge impact in the bad way... – nighter Jul 07 '22 at 20:44
  • That didn't fix it for me. I had to drop the tfe output provider altogether and use the old remote data source. – Stargazer Jul 08 '22 at 14:42
  • This fixed it for me as well. Very unintuitive: a) without the extra cloud security setting, `terraform console` on my local machine could see the value from that provider even when running within the cloud couldn't, b) error message said that attribute was not present, instead of that the entire source wasn't accessible, c) I also had to read the variable as `something = nonsensitive(data.tfe_outputs.provider_name.values.some_output_value)`. Lots of hoops to jump through. – abought Feb 27 '23 at 21:07