Skip to content

Commit

Permalink
LAWS-3533: removed addresses from resource aws_waf_ipset and replaced…
Browse files Browse the repository at this point in the history
… with ip_set_descriptors
  • Loading branch information
tmahmood72 committed Nov 17, 2023
1 parent 9665041 commit ac470b5
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions terraform/environments/apex/waf.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
# resource "aws_waf_ipset" "wafmanualallowset" {
# name = "${upper(local.application_name)} Manual Allow Set"
# # description = ""
# # scope = "CLOUDFRONT"
# provider = aws.us-east-1
# # ip_address_version = "IPV4"
# addresses = [for ip in split("\n", chomp(file("${path}/aws_waf_ipset.txt"))) : ip]
# }

locals {
ip_set_list = [for ip in split("\n", chomp(file("${path.module}/aws_waf_ipset.txt"))) : ip]
}

resource "aws_waf_ipset" "wafmanualallowset" {
name = "${upper(local.application_name)} Manual Allow Set"
# description = ""
# scope = "CLOUDFRONT"
provider = aws.us-east-1
# ip_address_version = "IPV4"
addresses = [for ip in split("\n", chomp(file("${path}/aws_waf_ipset.txt"))) : ip]

# Ranges from https://github.com/ministryofjustice/laa-apex/blob/master/aws/application/application_stack.template
# removed redundant ip addresses such as RedCentric access and AWS Holborn offices

dynamic "ip_set_descriptors" {
for_each = local.ip_set_list
content {
type = "IPV4"
value = ip_set_descriptors.value
}
}
}

resource "aws_waf_ipset" "wafmanualblockset" {
Expand Down

0 comments on commit ac470b5

Please sign in to comment.