Hi,
Thx for your answers/solutions, they both work !
Here are the config files for each method if anyone else needs it.
1st Method : terraform_remote_state
Directory structure :
- Folder_AAA
— AAA.tf
— outputs.tf- Folder_BBB
— BBB.tf
Folder_AAA/AAA.tf =
locals {
mylocals = {
AAA_test = "AAA"
AAA2_test = "AAA2"
AAA3_test = ["1.1.1.1", "8.8.8.8"]
}
}
Folder_AAA/outputs.tf =
output "AAA_locals" {
value = local.mylocals
}
Folder_BBB/BBB.tf =
data "terraform_remote_state" "AAA_Project" {
backend = "local"
config = {
path = "../Folder_AAA/terraform.tfstate"
}
}
output "AAA" {
value = data.terraform_remote_state.AAA_Project.outputs.AAA_locals.AAA_test
}
2nd Method : yamldecode
Directory structure :
- Folder_AAA
— AAA.tf- Folder_BBB
— BBB.tf- shared_locals.yml
shared_locals.yml =
AAA_test: "AAA"
AAA2_test: "AAA2"
AAA3_test:
- "1.1.1.1"
- "8.8.8.8"
Folder_BBB/BBB.tf =
locals {
shared_locals = yamldecode(file("../shared_locals.yml"))
}
output "AAA" {
value = local.shared_locals.AAA_test
}