Hi,
I’m trying to use output value of one child module as input variable of another child module using some of the examples provided by Hashicorp. But I keep getting following error:
Code snippets:
root main.tf
module “shared_vpc_subnets” {
source = “./modules/subnets”
module “shared_vpc_ram_shares” {
source = “./modules/ram”
resource_arn_id = module.shared_vpc_subnets.subnet_arn_id
root variables.tf
variable “subnet_arn_id” {
type = string
description = “”
}
/modules/subnets/main.tf
resource “aws_subnet” “vpc_subnet” {
}
/modules/subnets/outputs.tf
output “subnet_arn_id” {
value = “${aws_subnet.vpc_subnet.arn}”
}
I alternatively tried using value = aws_subnet.vpc_subnet.arn to no luck.
/modules/ram/main.tf
resource “aws_ram_resource_association” “ram_shares” {
resource_arn = var.resource_arn_id
resource_share_arn = aws_ram_resource_share.ram_shares.arn
}
/modules/ram/variables.tf
variable “resource_arn_id” {
type = string
description = “”
}
Looks like there is some conversion of variable happening/required but I can’t figure why. Please let me know if I should provide further data.