Terraform list loop

hi all i am trying to loop through a list of email addresses for an azure budget notification

variable "contact_emails" {
  description = "Distribution Groups"
  type        = list(string)

so i can populate here

    contact_emails = [

when i do count or for loop its complaining as below - i am creating a budget module

│ Error: Reference to "count" in non-counted context
│   on budget-module\main.tf line 56, in resource "azurerm_consumption_budget_subscription" "budget":
│   56:     contact_emails  = var.contact_emails[count.index]
│ The "count" object can only be used in "module", "resource", and "data" blocks, and only when the "count" argument is set.

Hi @DevOpsCat,

This error message suggests that your resource "azurerm_consumption_budget_subscription" "budget" block doesn’t have the count argument, and so count.index isn’t applicable there.

If you can share the source code of that resource block I may be able to offer more specific advice on how to achieve your goal.