How to reference output values from another directory


I have 2 different directories (a, b).
in dir a I have the following data block:

data “vault_aws_access_credentials” “creds” {
backend = “dynamic-aws-creds-vault-admin-path”
role = “dynamic-aws-creds-vault-admin-role”

For “backend” and “role” I’d prefer to use values from the dir b which has the following relevant blocks:

resource “vault_aws_secret_backend” “aws” {
access_key = var.aws_access_key
secret_key = var.aws_secret_key
path = “${}-path”

default_lease_ttl_seconds = “120”
max_lease_ttl_seconds = “240”

resource “vault_aws_secret_backend_role” “admin” {
backend =
name = “${}-role”
credential_type = “iam_user”

policy_document = <<EOF
“Version”: “2012-10-17”,
“Statement”: [
“Effect”: “Allow”,
“Action”: [
“iam:", "ec2:
“Resource”: “*”

output “backend” {
value =

output “role” {
value =

Is there anyway to not hardcode “dynamic-aws-creds-vault-admin-path” and “dynamic-aws-creds-vault-admin-role” in directory a and instead use the output values of dir b?

Thank you.

There are some options, but you would need to explain more about your setup.

Are directories a and b both modules, referenced from one root Terraform configuration that combines them both?

Or are they two directories in which you run Terraform separately? If that, where is the Terraform state stored?