-
-
Save KyMidd/632b0c483008ed04501c4a7cff2e7bc5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| locals { | |
| # Iterate through all the country IP-lists and create a list of maps for each one | |
| country_attribute_list = [ | |
| for country in fileset("${path.module}/ip_lists_by_country", "*") : { | |
| # Read the 2/3-character short code at the beginning of each name | |
| country_short_code = split("_", country)[0] | |
| # Read the whole file-name in case we'll use it in future | |
| country_name = replace(country, ".txt", "") | |
| # Read the entire list of IPs for each country, then split into list using \n as delimiter | |
| # Then use compact to remove any empty strings from the list | |
| country_ips = compact( | |
| split("\n", file("${path.module}/ip_lists_by_country/${country}")) | |
| ) | |
| } | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment