DEV Community

loading...

Discussion on: Automate AWS security group with CloudFlare IPs

Collapse
yebowhatsay profile image
yebowhatsay • Edited

Dean

There is an error in the code at github.com/johnmccuk/cloudflare-ip...

Code

  ## IPv4
    # add new addresses
    for ipv4_cidr in ip_addresses['ipv4_cidrs']:
        for port in ports:
            if not check_ipv4_rule_exists(current_rules, ipv4_cidr, port):
                add_ipv4_rule(security_group, ipv4_cidr, port)

needs changing to

     ## IPv4
    # add new addresses
    for port in ports:
        for ipv4_cidr in ip_addresses['ipv4_cidrs']:
            if not check_ipv4_rule_exists(current_rules, ipv4_cidr, port):
                add_ipv4_rule(security_group, ipv4_cidr, port)

That is, swap line 188 with 189.