Skip to content

A Terraform module that populates a security group with cloudflare ip ranges and keeps it updated daily.

License

Notifications You must be signed in to change notification settings

cardboardboxb/terraform-aws-cloudflare-security-group

 
 

Repository files navigation

AWS CloudFlare security group Terraform module

Terraform module that populates a security group with cloudflare ip ranges and keeps it updated daily.

The following resources are created:

  • A lambda function that keeps your security group's ingress rules updated with published cloudflare ip ranges.
  • A cloudwatch event rule with a schedule to trigger the lambda daily

Prerequisites

Ways to provide the lambda layer

Usage

module "cloudflare-ips" {
  source = "github.com/orzarchi/terraform-aws-cloudflare-security-group"

  security_group_id = aws_security_group.cloudflare.id
  enabled= var.use_cloudflare
}

Variables

Name Type Description Default Required
security_group_id string An existing security group to populate with cloudflare ips as ingress rules. - Yes
layers list(string) List of Lambda Layer Version ARNs (maximum of 5) to attach to your Lambda Function. This layer must have requests installed. (pip install --target . requests) - Yes
enabled bool Whether to do anything at all, useful if cloudflare is not needed on all environments. true No
enabled_egress_http bool Whether to assign egress on port 80 tcp. true No
enabled_egress_https bool Whether to assign egress on port 443 tcp. true No
schedule_expression string The cloudwatch schedule expression used to run the updater lambda. cron(0 20 * * ? *) No

About

A Terraform module that populates a security group with cloudflare ip ranges and keeps it updated daily.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HCL 70.8%
  • Python 29.2%