The given key does not identify an element in this collection value: the collection has no elements

on outputs.tf line 3, in output “alarm_ID”:
│ 3: value = length(aws_cloudwatch_metric_alarm.main_alarm[0].id) > 0 ? aws_cloudwatch_metric_alarm.main_alarm[0].id : null
│ ├────────────────
│ │ aws_cloudwatch_metric_alarm.main_alarm is empty tuple

│ The given key does not identify an element in this collection value: the collection has no elements.