Skip to content

Commit

Permalink
refine deprecation notice and add to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobbednarz committed May 18, 2023
1 parent 886f443 commit 2d9be2d
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 19 deletions.
9 changes: 6 additions & 3 deletions .changelog/2442.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
```release-note:note
resource/cloudflare_filter: This resource is being deprecated in favor of the cloudflare_rulesets resource
resource/cloudflare_firewall_rule: This resource is being deprecated in favor of the cloudflare_rulesets resource
```
resource/cloudflare_filter: This resource is being deprecated in favor of the `cloudflare_rulesets` resource. See https://developers.cloudflare.com/waf/reference/migration-guides/firewall-rules-to-custom-rules/#relevant-changes-for-terraform-users for more details.
```

```release-note:note
resource/cloudflare_firewall_rule: This resource is being deprecated in favor of the `cloudflare_rulesets` resource. See https://developers.cloudflare.com/waf/reference/migration-guides/firewall-rules-to-custom-rules/#relevant-changes-for-terraform-users for more details.
```
7 changes: 7 additions & 0 deletions docs/resources/filter.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ Filter expressions that can be referenced across multiple features,
e.g. Firewall Rules. See [what is a filter](https://developers.cloudflare.com/firewall/api/cf-filters/what-is-a-filter/)
for more details and available fields and operators.

~> `cloudflare_filter` is in a deprecation phase that will last for one
year (May 1st, 2024). During this time period, this resource is still fully
supported but you are strongly advised to move to the
[`cloudflare_ruleset`](https://developers.cloudflare.com/waf/reference/migration-guides/firewall-rules-to-custom-rules/#relevant-changes-for-terraform-users) resource.


## Example Usage

```terraform
Expand All @@ -22,6 +28,7 @@ resource "cloudflare_filter" "wordpress" {
expression = "(http.request.uri.path ~ \".*wp-login.php\" or http.request.uri.path ~ \".*xmlrpc.php\") and ip.src ne 192.0.2.1"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

Expand Down
8 changes: 5 additions & 3 deletions docs/resources/firewall_rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ rule creation.
Filter expressions needs to be created first before using Firewall
Rule.

~> If you want to configure Custom Firewall rules, you need to use
`cloudflare_ruleset`, because Custom Rules are built upon the
[Cloudflare Ruleset Engine](https://developers.cloudflare.com/ruleset-engine/).
~> `cloudflare_firewall_rule` is in a deprecation phase that will last for one
year (May 1st, 2024). During this time period, this resource is still fully
supported but you are strongly advised to move to the
[`cloudflare_ruleset`](https://developers.cloudflare.com/waf/reference/migration-guides/firewall-rules-to-custom-rules/#relevant-changes-for-terraform-users) resource.


## Example Usage

Expand Down
12 changes: 7 additions & 5 deletions internal/sdkv2provider/resource_cloudflare_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ func resourceCloudflareFilter() *schema.Resource {
e.g. Firewall Rules. See [what is a filter](https://developers.cloudflare.com/firewall/api/cf-filters/what-is-a-filter/)
for more details and available fields and operators.
`),
DeprecationMessage: heredoc.Doc(`
The Filter resource is in a deprecation phase that will last for one year (May 1st, 2024).
During this time period, this resource is still fully supported but you are strongly advised
to move to the [rulesets resource](https://developers.cloudflare.com/waf/reference/migration-guides/firewall-rules-to-custom-rules/#relevant-changes-for-terraform-users)
`),
DeprecationMessage: heredoc.Doc(fmt.Sprintf(`
%s resource is in a deprecation phase that will
last for one year (May 1st, 2024). During this time period, this
resource is still fully supported but you are strongly advised
to move to the %s resource. For more information, see
https://developers.cloudflare.com/waf/reference/migration-guides/firewall-rules-to-custom-rules/#relevant-changes-for-terraform-users.
`, "`cloudflare_filter`", "`cloudflare_ruleset`")),
}
}

Expand Down
12 changes: 7 additions & 5 deletions internal/sdkv2provider/resource_cloudflare_firewall_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ func resourceCloudflareFirewallRule() *schema.Resource {
Filter expressions needs to be created first before using Firewall
Rule.
`),
DeprecationMessage: heredoc.Doc(`
The Firewall rule resource is in a deprecation phase that will last for one year (May 1st, 2024).
During this time period, this resource is still fully supported but you are strongly advised
to move to the [rulesets resource](https://developers.cloudflare.com/waf/reference/migration-guides/firewall-rules-to-custom-rules/#relevant-changes-for-terraform-users)
`),
DeprecationMessage: heredoc.Doc(fmt.Sprintf(`
%s resource is in a deprecation phase that will
last for one year (May 1st, 2024). During this time period, this
resource is still fully supported but you are strongly advised
to move to the %s resource. For more information, see
https://developers.cloudflare.com/waf/reference/migration-guides/firewall-rules-to-custom-rules/#relevant-changes-for-terraform-users.
`, "`cloudflare_firewall_rule`", "`cloudflare_ruleset`")),
}
}

Expand Down
28 changes: 28 additions & 0 deletions templates/resources/filter.md.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
page_title: "{{.Name}} {{.Type}} - {{.RenderedProviderName}}"
subcategory: ""
description: |-
{{ .Description | plainmarkdown | trimspace | prefixlines " " }}
---

# {{.Name}} ({{.Type}})

{{ .Description | trimspace }}

~> `cloudflare_filter` is in a deprecation phase that will last for one
year (May 1st, 2024). During this time period, this resource is still fully
supported but you are strongly advised to move to the
[`cloudflare_ruleset`](https://developers.cloudflare.com/waf/reference/migration-guides/firewall-rules-to-custom-rules/#relevant-changes-for-terraform-users) resource.


## Example Usage

{{ tffile (printf "%s%s%s" "examples/resources/" .Name "/resource.tf") }}

{{ .SchemaMarkdown | trimspace }}

## Import

Import is supported using the following syntax:

{{ codefile "shell" (printf "%s%s%s" "examples/resources/" .Name "/import.sh") }}
8 changes: 5 additions & 3 deletions templates/resources/firewall_rule.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ description: |-

{{ .Description | trimspace }}

~> If you want to configure Custom Firewall rules, you need to use
`cloudflare_ruleset`, because Custom Rules are built upon the
[Cloudflare Ruleset Engine](https://developers.cloudflare.com/ruleset-engine/).
~> `cloudflare_firewall_rule` is in a deprecation phase that will last for one
year (May 1st, 2024). During this time period, this resource is still fully
supported but you are strongly advised to move to the
[`cloudflare_ruleset`](https://developers.cloudflare.com/waf/reference/migration-guides/firewall-rules-to-custom-rules/#relevant-changes-for-terraform-users) resource.


## Example Usage

Expand Down

0 comments on commit 2d9be2d

Please sign in to comment.