Skip to content

Commit 17345e4

Browse files
committed
(waf) init document for waf
1 parent 7ee5e26 commit 17345e4

File tree

2 files changed

+77
-1
lines changed

2 files changed

+77
-1
lines changed

README.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# AWS WAF Terraform Module
2+
3+
Terraform module with create vpc and subnet resources on AWS.
4+
5+
## Usage
6+
7+
```terraform
8+
module "waf" {
9+
source = "git::ssh://git@github.com:oozou/terraform-aws-waf.git"
10+
name = "test-waf"
11+
prefix = "oozou"
12+
scope = "CLOUDFRONT"
13+
environment = "dev"
14+
ip_sets_rule = [
15+
{
16+
name = "count-ip-set"
17+
priority = 5
18+
action = "count"
19+
ip_address_version = "IPV4"
20+
ip_set = ["1.2.3.4/32", "5.6.7.8/32"]
21+
},
22+
{
23+
name = "block-ip-set"
24+
priority = 6
25+
action = "block"
26+
ip_address_version = "IPV4"
27+
ip_set = ["10.0.1.1/32"]
28+
}
29+
]
30+
tags = {
31+
"Custom-Tag" = "1"
32+
}
33+
}
34+
```
35+
36+
## Requirements
37+
38+
No requirements.
39+
40+
## Providers
41+
42+
| Name | Version |
43+
|------|---------|
44+
| <a name="provider_aws"></a> [aws](#provider\_aws) | n/a |
45+
46+
## Modules
47+
48+
No modules.
49+
50+
## Resources
51+
52+
| Name | Type |
53+
|------|------|
54+
| [aws_wafv2_ip_set.ipset](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/wafv2_ip_set) | resource |
55+
| [aws_wafv2_web_acl.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/wafv2_web_acl) | resource |
56+
| [aws_wafv2_web_acl_association.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/wafv2_web_acl_association) | resource |
57+
58+
## Inputs
59+
60+
| Name | Description | Type | Default | Required |
61+
|------|-------------|------|---------|:--------:|
62+
| <a name="input_association_resources"></a> [association\_resources](#input\_association\_resources) | ARN of the ALB, CloudFront, Etc to be associated with the WAFv2 ACL. | `list(string)` | `[]` | no |
63+
| <a name="input_default_action"></a> [default\_action](#input\_default\_action) | The action to perform if none of the rules contained in the WebACL match. | `string` | `"allow"` | no |
64+
| <a name="input_environment"></a> [environment](#input\_environment) | Environment Variable used as a prefix | `string` | n/a | yes |
65+
| <a name="input_ip_sets_rule"></a> [ip\_sets\_rule](#input\_ip\_sets\_rule) | A rule to detect web requests coming from particular IP addresses or address ranges. | <pre>list(object({<br> name = string<br> priority = number<br> ip_set = list(string)<br> action = string<br> ip_address_version = string<br> }))</pre> | `[]` | no |
66+
| <a name="input_managed_rules"></a> [managed\_rules](#input\_managed\_rules) | List of Managed WAF rules. | <pre>list(object({<br> name = string<br> priority = number<br> override_action = string<br> excluded_rules = list(string)<br> }))</pre> | <pre>[<br> {<br> "excluded_rules": [],<br> "name": "AWSManagedRulesCommonRuleSet",<br> "override_action": "none",<br> "priority": 10<br> },<br> {<br> "excluded_rules": [],<br> "name": "AWSManagedRulesAmazonIpReputationList",<br> "override_action": "none",<br> "priority": 20<br> },<br> {<br> "excluded_rules": [],<br> "name": "AWSManagedRulesKnownBadInputsRuleSet",<br> "override_action": "none",<br> "priority": 30<br> },<br> {<br> "excluded_rules": [],<br> "name": "AWSManagedRulesSQLiRuleSet",<br> "override_action": "none",<br> "priority": 40<br> },<br> {<br> "excluded_rules": [],<br> "name": "AWSManagedRulesLinuxRuleSet",<br> "override_action": "none",<br> "priority": 50<br> },<br> {<br> "excluded_rules": [],<br> "name": "AWSManagedRulesUnixRuleSet",<br> "override_action": "none",<br> "priority": 60<br> }<br>]</pre> | no |
67+
| <a name="input_name"></a> [name](#input\_name) | A friendly name of the WebACL. | `string` | n/a | yes |
68+
| <a name="input_prefix"></a> [prefix](#input\_prefix) | The prefix name of customer to be displayed in AWS console and resource | `string` | n/a | yes |
69+
| <a name="input_scope"></a> [scope](#input\_scope) | The scope of this Web ACL. Valid options: CLOUDFRONT, REGIONAL. | `string` | n/a | yes |
70+
| <a name="input_tags"></a> [tags](#input\_tags) | A mapping of tags to assign to the WAFv2 ACL. | `map(string)` | `{}` | no |
71+
72+
## Outputs
73+
74+
| Name | Description |
75+
|------|-------------|
76+
| <a name="output_web_acl_id"></a> [web\_acl\_id](#output\_web\_acl\_id) | The ARN of the WAF WebACL. |

waf.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
resource "aws_wafv2_web_acl" "this" {
2-
name = format("%s-%s", local.prefix, var.name)
2+
name = format("%s-%s-waf", local.prefix, var.name)
33
description = "WAFv2 ACL for ${var.name}"
44

55
scope = var.scope

0 commit comments

Comments
 (0)