Adds support for CIDR addressing

This commit is contained in:
Nemo 2019-10-25 12:00:45 +05:30
parent 50fb3010c6
commit 4620fe42c2
3 changed files with 101 additions and 49 deletions

View File

@ -10,7 +10,7 @@ as per [their documentation](https://docs.looker.com/setup-and-management/enabli
``` ```
module "looker-ips" { module "looker-ips" {
source = "captn3m0/looker-ips/data" source = "captn3m0/looker-ips/data"
version = "1.0.0" version = "1.1.0"
} }
resource "aws_security_group_rule" "allow_all_from_looker_us" { resource "aws_security_group_rule" "allow_all_from_looker_us" {
@ -18,22 +18,31 @@ resource "aws_security_group_rule" "allow_all_from_looker_us" {
from_port = 0 from_port = 0
to_port = 443 to_port = 443
protocol = "tcp" protocol = "tcp"
cidr_blocks = ["${module.looker-ips.us}"] cidr_blocks = ["${module.looker-ips.us_cidr}"]
security_group_id = "sg-123456" security_group_id = "sg-123456"
} }
``` ```
## Outputs ## Outputs
| Name | Description | All output variables are lists.
| ---- | ------------------------------------ |
| as | Looker IP Addresses in Asia | | Name | Description |
| au | Looker IP Addresses in Australia | | --------- | -------------------------------------------- |
| ca | Looker IP Addresses in Canada | | `as` | Looker IP Addresses in Asia |
| de | Looker IP Addresses in Germany | | `as_cidr` | Looker IP Addresses in Asia in CIDR |
| ie | Looker IP Addresses in Ireland | | `au` | Looker IP Addresses in Australia |
| sa | Looker IP Addresses in South America | | `au_cidr` | Looker IP Addresses in Australia in CIDR |
| us | Looker IP Addresses in United States | | `ca` | Looker IP Addresses in Canada |
| `ca_cidr` | Looker IP Addresses in Canada in CIDR |
| `de` | Looker IP Addresses in Germany |
| `de_cidr` | Looker IP Addresses in Germany in CIDR |
| `ie` | Looker IP Addresses in Ireland |
| `ie_cidr` | Looker IP Addresses in Ireland in CIDR |
| `sa` | Looker IP Addresses in South America |
| `sa_cidr` | Looker IP Addresses in South America in CIDR |
| `us` | Looker IP Addresses in United States |
| `us_cidr` | Looker IP Addresses in United States in CIDR |
# LICENSE # LICENSE

39
locals.tf Normal file
View File

@ -0,0 +1,39 @@
locals {
us = [
"54.208.10.167",
"54.209.116.191",
"52.1.5.228",
"52.1.157.156",
"54.83.113.5",
]
ca = [
"99.79.117.127",
"35.182.216.56",
]
as = [
"52.68.85.40",
"52.68.108.109",
]
ie = [
"52.16.163.151",
"52.16.174.170",
]
de = [
"18.196.243.94",
"18.184.246.171",
]
au = [
"52.65.128.170",
"52.65.124.87",
]
sa = [
"52.67.8.103",
"54.233.74.59",
]
}

View File

@ -1,65 +1,69 @@
output "us" { output "us" {
description = "Looker IP Addresses in United States" description = "Looker IP Addresses in United States"
value = "${local.us}"
value = [
"54.208.10.167",
"54.209.116.191",
"52.1.5.228",
"52.1.157.156",
"54.83.113.5",
]
} }
output "ca" { output "ca" {
description = "Looker IP Addresses in Canada" description = "Looker IP Addresses in Canada"
value = "${local.ca}"
value = [
"99.79.117.127",
"35.182.216.56",
]
} }
output "as" { output "as" {
description = "Looker IP Addresses in Asia" description = "Looker IP Addresses in Asia"
value = "${local.as}"
value = [
"52.68.85.40",
"52.68.108.109",
]
} }
output "ie" { output "ie" {
description = "Looker IP Addresses in Ireland" description = "Looker IP Addresses in Ireland"
value = "${local.ie}"
value = [
"52.16.163.151",
"52.16.174.170",
]
} }
output "de" { output "de" {
description = "Looker IP Addresses in Germany" description = "Looker IP Addresses in Germany"
value = "${local.de}"
value = [
"18.196.243.94",
"18.184.246.171",
]
} }
output "au" { output "au" {
description = "Looker IP Addresses in Australia" description = "Looker IP Addresses in Australia"
value = "${local.au}"
value = [
"52.65.128.170",
"52.65.124.87",
]
} }
output "sa" { output "sa" {
description = "Looker IP Addresses in South America" description = "Looker IP Addresses in South America"
value = "${local.sa}"
value = [ }
"52.67.8.103",
"54.233.74.59", output "us_cidr" {
] description = "Looker IP Addresses in United States in CIDR"
value = ["${formatlist("%s/32", local.us)}"]
}
output "ca_cidr" {
description = "Looker IP Addresses in Canada in CIDR"
value = ["${formatlist("%s/32", local.ca)}"]
}
output "as_cidr" {
description = "Looker IP Addresses in Asia in CIDR"
value = ["${formatlist("%s/32", local.as)}"]
}
output "ie_cidr" {
description = "Looker IP Addresses in Ireland in CIDR"
value = ["${formatlist("%s/32", local.ie)}"]
}
output "de_cidr" {
description = "Looker IP Addresses in Germany in CIDR"
value = ["${formatlist("%s/32", local.de)}"]
}
output "au_cidr" {
description = "Looker IP Addresses in Australia in CIDR"
value = ["${formatlist("%s/32", local.au)}"]
}
output "sa_cidr" {
description = "Looker IP Addresses in South America in CIDR"
value = ["${formatlist("%s/32", local.sa)}"]
} }