Skip to content

This module helps you set up Adblocking for your devices (PC/Mac Android/Apple) using Cloudflare - similar to a PiHole

License

Notifications You must be signed in to change notification settings

JamesWoolfenden/terraform-cloudflare-adblock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

terraform-cloudflare-adblock

Build Status Latest Release GitHub tag (latest SemVer) Terraform Version Infrastructure Tests pre-commit checkov Infrastructure Tests

Terraform module -

This module helps you set up a Cloudflare team for use with the Warp client, enabling Malware protection and Adblocking.

You need to register for an account first and then install the Cloudflare Warp client on the devices you want to protect.

https://developers.cloudflare.com/cloudflare-one/setup/

This module does everything else, sets up the block lists and has 2 GHA that keep the list updated and deploy it.


It's 100% Open Source and licensed under the APACHE2.

Usage

module "adblock" {
  source        = "JamesWoolfenden/adblock/cloudflare"
  version       = "0.0.1"
  team_name     = "<yourteamnamefromcloudflare>"
}

To run a copy of the Github action (Deploy and Bump), you need to add the env vars to your repository secrets:

CLOUDFLARE_API_KEY

CLOUDFLARE_EMAIL

I'm also using an AWS state file, if you use the same then you'll also need to provide adequate AWS creds and env vars.

Adapted from https://blog.marcolancini.it/2022/blog-serverless-ad-blocking-with-cloudflare-gateway/.

Requirements

Name Version
cloudflare 3.33.1

Providers

Name Version
cloudflare 3.33.1

Modules

No modules.

Resources

Name Type
cloudflare_teams_account.woolfenden resource
cloudflare_teams_list.pihole_domain_lists resource
cloudflare_teams_rule.block_ads resource
cloudflare_teams_rule.block_malware resource
cloudflare_accounts.woolfenden data source

Inputs

Name Description Type Default Required
logo_path n/a string "https://pbs.twimg.com/profile_images/1408927094315393028/WkL6f1Qf_400x400.jpg" no
team_name Your cloudflare team name string n/a yes

Outputs

Name Description
account n/a
accounts n/a
malware_rule n/a
team n/a

Policy

This is the policy required to build this project:

and Using https://github.com/marco-lancini/utils/tree/main/terraform/cloudflare-gateway-adblocking

Keeping the domain list up to date

The action-update-list.yml provides a sample GitHub Actions workflow that periodically (monthly) fetches the list upstream and commits it to the repo if it has changed.

workflow

Related Projects

Check out these related projects.

Help

Got a question?

File a GitHub issue.

Contributing

Bug Reports & Feature Requests

Please use the issue tracker to report any bugs or file feature requests.

Copyrights

Copyright � 2023 James Woolfenden

License

License

See LICENSE for full details.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Contributors

James Woolfenden
James Woolfenden

About

This module helps you set up Adblocking for your devices (PC/Mac Android/Apple) using Cloudflare - similar to a PiHole

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published