0

Such a simple thing, yet it seems impossible to do or search for... I just need to simply read file contents into a variable and create a list to for loop through.

file A

[
  "0.0.0.0/0",
  "8.8.8.8/32"
]

file B

[
  "10.0.0.0/8",
  "172.0.0.0/16"
]

terragrunt.hcl

locals {
  priv_subnets = find_in_parent_folders("fileB")
  pub_subnets  = find_in_parent_folders("fileA")

  all_subnets  = concat(priv_subnets, pub_subnets)
}

...

for cidrs in local.all_subnets: ...

Seems to not be consuming the list correctly... what am I missing?

Thanks
Nick Hatfield
  • 315
  • 2
  • 11
  • 1
    What does "Seems to not be consuming the list correctly" mean? Are there any errors? Is only the for loop not working or the `local.all_subnets` is not showing all the subnets? – Marko E Oct 14 '22 at 07:58
  • I think I'm starting to understand more... `find_in_parent_folders("fileB")` only locates the file, it does not "consume" the content of the file! What I truly need is a solution that will allow me to save a list of IPs (so we can peer review just that list), and have others reference mulitple lists of subnets (based on their desired source/destination reqs) – Nick Hatfield Oct 14 '22 at 12:35
  • 1
    You probably want this: https://terragrunt.gruntwork.io/docs/reference/built-in-functions/#terraform-built-in-functions? – Marko E Oct 14 '22 at 13:08

0 Answers0