Skip to content

Commit

Permalink
Merge pull request #13 from Flaconi/PLT-1108
Browse files Browse the repository at this point in the history
PLT-1108 added ref to the rules in order to prevent ruleset modificat…
  • Loading branch information
vselcuk authored Jan 24, 2025
2 parents b514955 + d743789 commit 3dd691f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ FL_IGNORE_PATHS = .git/,.github/,.terraform/,.idea/
# -------------------------------------------------------------------------------------------------
# Container versions
# -------------------------------------------------------------------------------------------------
TF_VERSION = 1.5.7
TF_VERSION = 1.8.5
TFDOCS_VERSION = 0.16.0-0.34
FL_VERSION = latest-0.8
JL_VERSION = 1.6.0-0.14
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This Terraform module manages Cloudflare Rulesets.

| Name | Version |
|------|---------|
| <a name="provider_cloudflare"></a> [cloudflare](#provider\_cloudflare) | ~> 4.48 |
| <a name="provider_cloudflare"></a> [cloudflare](#provider\_cloudflare) | ~> 4.51 |

<!-- TFDOCS_PROVIDER_END -->

Expand All @@ -27,8 +27,8 @@ This Terraform module manages Cloudflare Rulesets.

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.3 |
| <a name="requirement_cloudflare"></a> [cloudflare](#requirement\_cloudflare) | ~> 4.48 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.8 |
| <a name="requirement_cloudflare"></a> [cloudflare](#requirement\_cloudflare) | ~> 4.51 |

<!-- TFDOCS_REQUIREMENTS_END -->

Expand Down Expand Up @@ -160,6 +160,7 @@ list(object({
logging = optional(object({
enabled = bool
}), null)
ref = optional(string)
}))
```

Expand Down
22 changes: 12 additions & 10 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,17 @@ resource "cloudflare_ruleset" "this" {
}
}

description = rules.value.description
enabled = rules.value.enabled
expression = rules.value.expression

dynamic "logging" {
for_each = rules.value.logging[*]
content {
enabled = logging.value.enabled
}
}

# http_ratelimit
dynamic "ratelimit" {
for_each = rules.value.ratelimit[*]
Expand All @@ -123,16 +134,7 @@ resource "cloudflare_ruleset" "this" {
}
}

description = rules.value.description
enabled = rules.value.enabled
expression = rules.value.expression

dynamic "logging" {
for_each = rules.value.logging[*]
content {
enabled = logging.value.enabled
}
}
ref = coalesce(rules.value.ref, md5("${rules.value.description}-${rules.value.expression}"))
}
}
}
1 change: 1 addition & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ variable "rules" {
logging = optional(object({
enabled = bool
}), null)
ref = optional(string)
}))
default = []

Expand Down
4 changes: 2 additions & 2 deletions versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ terraform {
required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = "~> 4.48"
version = "~> 4.51"
}
}
required_version = "~> 1.3"
required_version = "~> 1.8"
}

0 comments on commit 3dd691f

Please sign in to comment.