skip to Main Content

I have this in my tf file
existing_alerting_sns_topic = "arn:aws:sns:${var.aws_region}:${module.account.id[“ab-cd”]}:cd-prod-${var.aws_region}-slack-notifier-infrastructure-alerts"

but I don’t have anything specified in my variable.tf yet. when I run the terraform plan I do see the below error. Do I need to specify anything like map(any) or map(list(string)) ??

│ 
│  existing_alerting_sns_topic        =  "arn:aws:sns:${var.aws_region}:${module.account.id[“ab-cd”]}:cd-prod-${var.aws_region}-slack-notifier-infrastructure-alerts"
│     ├────────────────
│     │ module.account.id is map of string with 105 elements
│ 
│ The given key does not identify an element in this collection value```

Thanks!

2

Answers


  1. Chosen as BEST ANSWER

    Thanks for looking into my question. I have figured out the error was about the case sensitive letters(ab-CD) I have mentioned for the account name in the line ${module.account.id[“ab-cd”]} Thanks!


  2. It simply says that:

    • the module account‘s output id is a huge map of strings (105) but
    • none of them is called ab-cd.

    Maybe a typo in the outputs of the account module?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search