I’m trying to create a Datadog synthetics resource using terraform. The resource is created by invoking a module.
module "app_synthetics" {
source = "path/to/module/"
.....
}
The output is defined in the module as follows.
resource "datadog_synthetics_test" "default" {
....resource definition....
}
output "monitor_id" {
value = datadog_synthetics_test.default.monitor_id
}
I want to take this output and use it in another resource. I have defined the output as follows and passed the output as a variable to the other module from which a new resource is created.
output "app_monitor_id" {
value = module.app_synthetics.monitor_id
}
module "other_module" {
source = "./other/module/path"
app_monitor_id = var.app_monitor_id
}
I have also defined the variable for this output. But I get the following error.
`╷
│ Error: Unsupported attribute
│
│ on outputs.tf line 3, in output "app_monitor_id":
│ 3: value = module.app_synthetics.monitor_id
│ ├────────────────
│ │ module.app_synthetics is object with 4 attributes
│
│ This object does not have an attribute named "monitor_id".`
What could be the reason for this error. Any help is appreciated. Thanks!