-
Notifications
You must be signed in to change notification settings - Fork 626
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1700 from orium/dsousa/FLPROD-397-redirect-list-s…
…upport Support redirect lists
- Loading branch information
Showing
11 changed files
with
876 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
```release-note:new-resource | ||
resource/cloudflare_list: Added support for generic list types, including redirect lists. | ||
``` | ||
|
||
```release-note:note | ||
resource/cloudflare_ip_list: Deprecated cloudflare_ip_list in favor of cloudflare_list. | ||
``` |
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,128 @@ | ||
--- | ||
page_title: "cloudflare_list Resource - Cloudflare" | ||
subcategory: "" | ||
description: |- | ||
Provides Lists (IPs, Redirects) to be used in Edge Rules Engine across all zones within the same account. | ||
--- | ||
|
||
# cloudflare_list (Resource) | ||
|
||
Provides Lists (IPs, Redirects) to be used in Edge Rules Engine across all zones within the same account. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
# IP list | ||
resource "cloudflare_list" "example" { | ||
account_id = "919f297a62fdfb28844177128ed4d331" | ||
name = "example list" | ||
description = "example IPs for a list" | ||
kind = "ip" | ||
item { | ||
value { | ||
ip = "192.0.2.0" | ||
} | ||
comment = "one" | ||
} | ||
item { | ||
value { | ||
ip = "192.0.2.1" | ||
} | ||
comment = "two" | ||
} | ||
} | ||
# Redirect list | ||
resource "cloudflare_list" "example" { | ||
account_id = "919f297a62fdfb28844177128ed4d331" | ||
name = "example list" | ||
description = "example redirects for a list" | ||
kind = "redirect" | ||
item { | ||
value { | ||
redirect { | ||
source_url = "example.com/blog" | ||
target_url = "https://blog.example.com" | ||
} | ||
} | ||
comment = "one" | ||
} | ||
item { | ||
value { | ||
redirect { | ||
source_url = "example.com/foo" | ||
target_url = "https://foo.example.com" | ||
include_subdomains = true | ||
subpath_matching = true | ||
status_code = 301 | ||
preserve_query_string = true | ||
preserve_path_suffix = false | ||
} | ||
} | ||
comment = "two" | ||
} | ||
} | ||
``` | ||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `account_id` (String) The account identifier to target for the resource. | ||
- `kind` (String) The type of items the list will contain. | ||
- `name` (String) The name of the list. | ||
|
||
### Optional | ||
|
||
- `description` (String) An optional description of the list. | ||
- `item` (Block List) (see [below for nested schema](#nestedblock--item)) | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The ID of this resource. | ||
|
||
<a id="nestedblock--item"></a> | ||
### Nested Schema for `item` | ||
|
||
Required: | ||
|
||
- `value` (Block List, Min: 1, Max: 1) (see [below for nested schema](#nestedblock--item--value)) | ||
|
||
Optional: | ||
|
||
- `comment` (String) An optional comment for the item. | ||
|
||
<a id="nestedblock--item--value"></a> | ||
### Nested Schema for `item.value` | ||
|
||
Optional: | ||
|
||
- `ip` (String) | ||
- `redirect` (Block List) (see [below for nested schema](#nestedblock--item--value--redirect)) | ||
|
||
<a id="nestedblock--item--value--redirect"></a> | ||
### Nested Schema for `item.value.redirect` | ||
|
||
Required: | ||
|
||
- `source_url` (String) The source url of the redirect. | ||
- `target_url` (String) The target url of the redirect. | ||
|
||
Optional: | ||
|
||
- `include_subdomains` (Boolean) Whether the redirect also matches subdomains of the source url. | ||
- `preserve_path_suffix` (Boolean) Whether to preserve the path suffix when doing subpath matching. | ||
- `preserve_query_string` (Boolean) Whether the redirect target url should keep the query string of the request's url. | ||
- `status_code` (Number) The status code to be used when redirecting a request. | ||
- `subpath_matching` (Boolean) Whether the redirect also matches subpaths of the source url. | ||
|
||
## Import | ||
|
||
Import is supported using the following syntax: | ||
```shell | ||
$ terraform import cloudflare_list.example <account_id>/<list_id> | ||
``` |
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 @@ | ||
$ terraform import cloudflare_list.example <account_id>/<list_id> |
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,54 @@ | ||
# IP list | ||
resource "cloudflare_list" "example" { | ||
account_id = "919f297a62fdfb28844177128ed4d331" | ||
name = "example list" | ||
description = "example IPs for a list" | ||
kind = "ip" | ||
|
||
item { | ||
value { | ||
ip = "192.0.2.0" | ||
} | ||
comment = "one" | ||
} | ||
|
||
item { | ||
value { | ||
ip = "192.0.2.1" | ||
} | ||
comment = "two" | ||
} | ||
} | ||
|
||
# Redirect list | ||
resource "cloudflare_list" "example" { | ||
account_id = "919f297a62fdfb28844177128ed4d331" | ||
name = "example list" | ||
description = "example redirects for a list" | ||
kind = "redirect" | ||
|
||
item { | ||
value { | ||
redirect { | ||
source_url = "example.com/blog" | ||
target_url = "https://blog.example.com" | ||
} | ||
} | ||
comment = "one" | ||
} | ||
|
||
item { | ||
value { | ||
redirect { | ||
source_url = "example.com/foo" | ||
target_url = "https://foo.example.com" | ||
include_subdomains = true | ||
subpath_matching = true | ||
status_code = 301 | ||
preserve_query_string = true | ||
preserve_path_suffix = false | ||
} | ||
} | ||
comment = "two" | ||
} | ||
} |
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
Oops, something went wrong.