Hi all. I am using the meta arguments to create the
this is my child module main.tf
variable "project" {
type = map(any)
default = {
relay = {
instance_type = "t2.medium",
instance_name = "new_server",
instance_count = 2
}
}
}
module "game" {
source = "./module/cvm"
for_each = var.project
instance_count = each.value.instance_count
instance_data_disk_size = each.value.instance_data_disk_size
#### Other config
}
Output.tf in child module
output "instance_id" {
value = module.game.instance_id
}
this is my root module mnain.tf
resource "tencentcloud_instance" "default" {
instance_type = var.instance_type
count = var.instance_count
#### some other config
}
Output.tf in child module
output "instance_id" {
value = [for b in tencentcloud_instance.default : b.id ]
}
Here i ma trying create multiple instance with diff type. as of now now i am using only one.
In the above snippet i am getting error like
his object does not have an attribute named “instance_id”. while displaying instance id. can somebody help in this…