NPA Terraform - failing to loop over multiple maps

  • 27 October 2023
  • 1 reply
  • 16 views

Badge +4

I'm trying to build a module (currently just playing with locals directly in main.tf) which will build an instance of a private app. for each DC and tie it to the local publishers in that DC.

 

That part is working, but I am failing to also tie the protocols fields correctly in and iterate over those as well, as the attached code will fail if either of the protocol ports fields are empty (in the case where an app only has tcp or udp ports defined).

 

@sshiflett ?


1 reply

Userlevel 6
Badge +16

Hello @elawaetz

It's been some time since I tested this but I believe if you pass the protocol type as part of the call (TCP or UDP) then it expects a valid entry.  You may need to build logic that if there is no entry for the TCP or UDP protocol to not pass it at all. I will do a bit of digging but have not tested with our newer provider versions. 

Reply