JamesWoolfenden/terraform-aws-waf-global

GitHub: JamesWoolfenden/terraform-aws-waf-global

一个用于在 AWS 上快速创建全局 WAF IP 白名单规则的 Terraform 模块,将 Web 访问控制策略以基础设施即代码的方式管理。

Stars: 1 | Forks: 2

# terraform-aws-waf-global [![Build Status](https://github.com/JamesWoolfenden/terraform-aws-waf-global/workflows/Verify%20and%20Bump/badge.svg?branch=master)](https://github.com/JamesWoolfenden/terraform-aws-waf-global) [![Latest Release](https://img.shields.io/github/release/JamesWoolfenden/terraform-aws-waf-global.svg)](https://github.com/JamesWoolfenden/terraform-aws-waf-global/releases/latest) [![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/JamesWoolfenden/terraform-aws-waf-global.svg?label=latest)](https://github.com/JamesWoolfenden/terraform-aws-waf-global/releases/latest) ![Terraform Version](https://img.shields.io/badge/tf-%3E%3D0.14.0-blue.svg) [![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/JamesWoolfenden/terraform-aws-waf-global/cis_aws)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=JamesWoolfenden%2Fterraform-aws-waf-global&benchmark=CIS+AWS+V1.2) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit) [![checkov](https://img.shields.io/badge/checkov-verified-brightgreen)](https://www.checkov.io/) [![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/jameswoolfenden/terraform-aws-waf-global/general)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=JamesWoolfenden%2Fterraform-aws-waf-global&benchmark=INFRASTRUCTURE+SECURITY) Terraform 模块 - 创建全局 WAF。 它是 100% 开源的,并根据 [APACHE2](LICENSE) 授权。 ## 使用说明 这里只是一个基本的示例。 ![waf-global](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/f76f7648cf074340.png) 将此仓库作为模块包含在您现有的 Terraform 代码中: ``` module "waf-global" { source = "JamesWoolfenden/waf-global/aws" version = "0.0.2" ip_set = var.ip_set common_tags = var.common_tags } ``` ## 要求 无要求。 ## 提供者 | Name | Version | |------|---------| | [aws](#provider\_aws) | n/a | ## 模块 无模块。 ## 资源 | Name | Type | |------|------| | [aws_cloudwatch_log_group.wafexample](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group) | resource | | [aws_waf_ipset.ips](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/waf_ipset) | resource | | [aws_waf_rule.ip_match](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/waf_rule) | resource | | [aws_waf_web_acl.ip_whitelist](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/waf_web_acl) | resource | ## 输入 | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | [acl\_name](#input\_acl\_name) | acl 的名称 | `string` | `"IPWhiteListWebACL"` | no | | [common\_tags](#input\_common\_tags) | 定义资源的通用标签方案 | `map(any)` | n/a | yes | | [ipset](#input\_ipset) | 用于描述和填充 aws\_waf\_ipset 的复杂对象 | `any` | n/a | yes | | [kms\_key\_id](#input\_kms\_key\_id) | n/a | `any` | n/a | yes | | [metric\_name](#input\_metric\_name) | n/a | `string` | `"IPWhiteListWebACL"` | no | ## 输出 | Name | Description | |------|-------------| | [ip\_match](#output\_ip\_match) | n/a | | [ip\_whitelist](#output\_ip\_whitelist) | n/a | | [ips](#output\_ips) | n/a | | [web\_acl\_id](#output\_web\_acl\_id) | n/a | ## 策略 构建此项目所需的策略如下: 所需的 Terraform 资源为: ``` resource "aws_iam_policy" "terraformXVlBzgba" { name = "terraformXVlBzgba" path = "/" description = "Add Description" policy = jsonencode({ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "logs:AssociateKmsKey", "logs:CreateLogGroup", "logs:DeleteLogGroup", "logs:DeleteRetentionPolicy", "logs:DescribeLogGroups", "logs:DisassociateKmsKey", "logs:ListTagsLogGroup", "logs:PutRetentionPolicy" ], "Resource": "*" } ] }) } ``` ## 相关项目 查看这些相关项目。 - [terraform-aws-s3](https://github.com/jameswoolfenden/terraform-aws-s3) - S3 buckets ## 帮助 **有疑问?** 提交一个 GitHub [issue](https://github.com/JamesWoolfenden/terraform-aws-waf-global/issues)。 ### Bug 报告与功能请求 请使用 [issue tracker](https://github.com/JamesWoolfenden/terraform-aws-waf-global/issues) 报告任何 bug 或提交功能请求。 ## 版权 Copyright © 2019-2022 James Woolfenden ## 许可证 [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) 详见 [LICENSE](LICENSE)。 根据一个或多个贡献者许可协议授权给 Apache Software Foundation (ASF)。有关版权所有权的更多信息,请参阅随本工作分发的 NOTICE 文件。ASF 根据 Apache License 2.0 版(“许可证”)向您授予此文件的许可;除非遵守许可证,否则您不得使用此文件。您可以在以下网址获取许可证副本: 除非适用法律要求或书面同意,否则根据许可证分发的软件均按“原样”基础提供,不附带任何明示或暗示的担保或条件。请参阅许可证以了解管理权限和限制的具体语言。 ### 贡献者 [![James Woolfenden](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/ef48d12bcf074342.jpg)][jameswoolfenden_homepage]
[James Woolfenden][jameswoolfenden_homepage]
标签:AppImage, AWS, AWS WAF, BridgeCrew, DevSecOps, DNS解析, DPI, EC2, ECS, IaC, IP白名单, IP黑名单, Terraform, Terraform模块, WAF, Web应用防火墙, 上游代理, 安全防护, 开源项目, 网络安全, 规则配置, 隐私保护