-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* OPS-5899 Update Makefile * OPS-5899 add optional parameters * OPS-5899 fix output * OPS-5899 Add examples * OPS-5899 Fix lint
- Loading branch information
Showing
9 changed files
with
209 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Example | ||
|
||
This example will create multiple rulesets for `http_request_firewall_custom` phase. | ||
|
||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
## Requirements | ||
|
||
No requirements. | ||
|
||
## Providers | ||
|
||
No providers. | ||
|
||
## Modules | ||
|
||
| Name | Source | Version | | ||
|------|--------|---------| | ||
| <a name="module_rulesets"></a> [rulesets](#module\_rulesets) | ./../../ | n/a | | ||
|
||
## Resources | ||
|
||
No resources. | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_api_token"></a> [api\_token](#input\_api\_token) | The Cloudflare API token. | `string` | n/a | yes | | ||
| <a name="input_domain"></a> [domain](#input\_domain) | Cloudflare domain name to create | `string` | `"example.com"` | no | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| <a name="output_records"></a> [records](#output\_records) | Cloudflare Zone DNS Records | | ||
|
||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
|
||
Copyright (c) 2024 **[Flaconi GmbH](https://github.com/flaconi)** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
module "rulesets" { | ||
source = "./../../" | ||
api_token = var.api_token | ||
domain = var.domain | ||
name = "default" | ||
kind = "zone" | ||
phase = "http_request_firewall_custom" | ||
rules = [ | ||
{ | ||
description = "User-Agent: skip" | ||
enabled = true | ||
action = "skip" | ||
expression = <<-EOT | ||
(http.user_agent contains "Bot/" and http.request.uri.path eq "/api/v1") | ||
EOT | ||
products = ["waf"] | ||
}, | ||
{ | ||
description = "User-Agent: log" | ||
enabled = false | ||
action = "log" | ||
expression = <<-EOT | ||
(http.user_agent contains "Bot/" and http.request.uri.path eq "/api/v1") | ||
EOT | ||
products = [] | ||
}, | ||
{ | ||
description = "Bots: log" | ||
action = "log" | ||
expression = <<-EOT | ||
(cf.bot_management.score eq 2) | ||
EOT | ||
}, | ||
{ | ||
description = "Bots: challenge" | ||
enabled = false | ||
action = "managed_challenge" | ||
expression = <<-EOT | ||
(cf.bot_management.score eq 9) | ||
EOT | ||
}, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
output "records" { | ||
description = "Cloudflare Zone DNS Records" | ||
value = module.rulesets.rules | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
variable "api_token" { | ||
description = "The Cloudflare API token." | ||
type = string | ||
} | ||
|
||
variable "domain" { | ||
description = "Cloudflare domain name to create" | ||
type = string | ||
default = "example.com" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters