Compare commits
2 Commits
69a2790123
...
5f11260c53
Author | SHA1 | Date | |
---|---|---|---|
|
5f11260c53 | ||
|
60be67bc64 |
@ -1 +0,0 @@
|
||||
{"result":{"ipv4_cidrs":["173.245.48.0/20","103.21.244.0/22","103.22.200.0/22","103.31.4.0/22","141.101.64.0/18","108.162.192.0/18","190.93.240.0/20","188.114.96.0/20","197.234.240.0/22","198.41.128.0/17","162.158.0.0/15","104.16.0.0/13","104.24.0.0/14","172.64.0.0/13","131.0.72.0/22"],"ipv6_cidrs":["2400:cb00::/32","2606:4700::/32","2803:f800::/32","2405:b500::/32","2405:8100::/32","2a06:98c0::/29","2c0f:f248::/32"],"etag":"38f79d050aa027e3be3865e495dcc9bc"},"success":true,"errors":[],"messages":[]}
|
@ -11,7 +11,7 @@
|
||||
| Name | Version |
|
||||
|------|---------|
|
||||
| aws | 5.51.1 |
|
||||
| null | 3.2.2 |
|
||||
| http | 3.4.2 |
|
||||
|
||||
## Modules
|
||||
|
||||
@ -26,10 +26,10 @@
|
||||
| Name | Type |
|
||||
|------|------|
|
||||
| [aws_ec2_managed_prefix_list.pl1](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ec2_managed_prefix_list) | resource |
|
||||
| [null_resource.CloudflareIps](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
|
||||
| [aws_availability_zones.available](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/availability_zones) | data source |
|
||||
| [aws_iam_policy_document.dynamodb_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
|
||||
| [aws_iam_policy_document.s3_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
|
||||
| [http_http.CloudflareIps](https://registry.terraform.io/providers/hashicorp/http/latest/docs/data-sources/http) | data source |
|
||||
|
||||
## Inputs
|
||||
|
||||
|
@ -89,14 +89,12 @@ data "aws_iam_policy_document" "dynamodb_endpoint_policy" {
|
||||
}
|
||||
}
|
||||
|
||||
resource "null_resource" "CloudflareIps" {
|
||||
provisioner "local-exec" {
|
||||
command = "wget -qO CfIps.json https://api.cloudflare.com/client/v4/ips"
|
||||
}
|
||||
}
|
||||
|
||||
locals {
|
||||
CfIpJson = jsondecode(file("${path.module}/CfIps.json"))
|
||||
data "http" "CloudflareIps" {
|
||||
url = "https://api.cloudflare.com/client/v4/ips"
|
||||
request_headers = {
|
||||
Accept = "application/json"
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_ec2_managed_prefix_list" "pl1" {
|
||||
@ -104,7 +102,7 @@ resource "aws_ec2_managed_prefix_list" "pl1" {
|
||||
address_family = "IPv4"
|
||||
max_entries = 20
|
||||
dynamic "entry" {
|
||||
for_each = local.CfIpJson.result.ipv4_cidrs
|
||||
for_each = jsondecode(data.http.CloudflareIps.response_body)["result"]["ipv4_cidrs"]
|
||||
content {
|
||||
cidr = entry.value
|
||||
description = "Cloudflare IP"
|
||||
|
Loading…
Reference in New Issue
Block a user