Im having an issue where my remote_state from one root module is not reaching over to another root module using workspaces. Ive tried hardcoding the workspace name into the remote_state data block. I have verified that my vpc outputs are there and are also in the statefile for that module. Not sure where else to go with this.
I get the following error when i try and plan…
ERROR:
Error: Unsupported attribute
│
│ on eks.tf line 49, in module "eks":
│ 49: vpc_id = data.terraform_remote_state.vpc.outputs.vpc_id
│ ├────────────────
│ │ data.terraform_remote_state.vpc.outputs is object with no attributes
│
│ This object does not have an attribute named "vpc_id".
Version info
Terraform v1.1.4
on darwin_amd64
- provider Terraform Registry v4.0.0
- provider Terraform Registry v2.2.0
- provider Terraform Registry v2.13.1
- provider Terraform Registry v4.0.2
./service/aws_vpc/
Contains the following code:
module "vpc_main" {
source = "terraform-aws-modules/vpc/aws"
version = ">=3.14.0"
...
...
}
output "vpc_id" {
description = "The ID of the VPC"
value = module.vpc_main.vpc_id
}
./service/aws_eks/
Contains the following code:
data "terraform_remote_state" "vpc" {
backend = "s3"
workspace = terraform.workspace
config = {
bucket = "my_bucket_name"
dynamodb_table = "my_table_name"
key = "env:/${terraform.workspace}/aws_vpc"
region = "us-east-1"
}
}
module "eks" {
source = "terraform-aws-modules/eks/aws"
vpc_id = data.terraform_remote_state.vpc.outputs.vpc_id
...
...
}