To reference the resources created by this stack in other stacks you need to define a data resource pointing to the S3 bucket and key defined in `remote-state.tf.
Your data definition should look something like this:
data "terraform_remote_state" "vpc" {
backend = "s3"
config {
bucket = "terraform-state.example.com"
key = "eu-west-1/vpc-1"
region = "eu-west-1"
}
}In your code, if you wanted (for example) to reference the vpc_id created by this stack you would do something like this:
vpc_id = "${data.terraform_remote_state.vpc.vpc_id}"- The
.vpc.section in the variable name must match the name of thedataresource you define. - The
.vpc_idis the name of the variable from this (the source stack). Must be one of those listed inoutputs.tf.