Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
7c989aa
feat: add redirects in convertConfig
Mar 26, 2026
7cca33f
feat: add redirect in toCreatePayload
Mar 26, 2026
e850a14
feat: add redirect in the update function
Mar 26, 2026
cf6f255
feat: add in the map field mapfield
Mar 26, 2026
72d079c
small fix and add datasource
Mar 27, 2026
cafad57
chore: update doc
Mar 27, 2026
f2bcc1b
chore: add resource example
Mar 27, 2026
a5f9f48
Merge branch 'main' into mp/cdn/feat/implement-redirects
Mar 31, 2026
9addaea
chore: add redirect in acc test and address linter issues
Mar 31, 2026
618c3a2
chore: address linter issue
Mar 31, 2026
9a22cef
chore: add doc
Mar 31, 2026
83c4b94
Merge branch 'main' into mp/cdn/feat/implement-redirects
matheuspolitano Mar 31, 2026
6d30d9b
Merge branch 'main' into mp/cdn/feat/implement-redirects
Apr 1, 2026
cf12967
chore: adjust for the new sdk version
Apr 1, 2026
45905c6
chore: implement new sdk in cdn_acc_test
Apr 1, 2026
92dfd6f
Merge branch 'main' into mp/cdn/feat/implement-redirects
matheuspolitano Apr 7, 2026
9ccd292
Merge branch 'main' into mp/cdn/feat/implement-redirects
matheuspolitano Apr 8, 2026
56f3e9c
Merge branch 'main' into mp/cdn/feat/implement-redirects
matheuspolitano Apr 13, 2026
23d6bd9
feat: add waf in resource
Apr 12, 2026
731fb3f
feat: add waf in datasource
Apr 12, 2026
162d0d8
fix acc test
Apr 13, 2026
bd94faa
feat: improve waf to avoid state drift
Apr 13, 2026
312cca0
fyi: run fmt and fix linter issues
Apr 13, 2026
a15c7f7
feat: add doc and improve descriptions
Apr 13, 2026
d3929ad
fyi: improve some validations and description
Apr 13, 2026
100d9f6
fyi: add checks in acc_test
Apr 13, 2026
7f5e08d
FYI: add all field in acc_test
Apr 13, 2026
a41657a
feat: DRY creatian redirect Config up
Apr 23, 2026
06c4b5c
chore: use SDK match condition
Apr 23, 2026
b756791
chore: some small tweaks to avoid redundancy
Apr 23, 2026
0fd82a0
chore: some small tweaks in test
Apr 23, 2026
535a8d8
chore: simplify the redirect set up in test
matheuspolitano Apr 23, 2026
a1eda91
fix: use the right variable instead the new one, get rif of some redu…
Apr 23, 2026
633ac4f
chore: remove redundant string in acc_test
Apr 23, 2026
ec7f0d5
Merge branch 'stackitcloud:main' into mp/cdn/feat/implement-redirects
matheuspolitano Apr 23, 2026
4cc4b60
chore: remove empty line at the end of the function and order acc imp…
Apr 23, 2026
43ad030
feat: remove the case insensitive
matheuspolitano Apr 24, 2026
e1ee94f
feat: add validation to no null values
matheuspolitano Apr 24, 2026
be8a32e
chore: remove redundant code
Apr 24, 2026
0d3507a
fix: add redirecttype
Apr 24, 2026
6c1b069
chore: change the all matcho dondition to all
Apr 24, 2026
e93dcb2
feat: make match condition sensitive
Apr 24, 2026
c308a6c
Merge branch 'main' into mp/cdn/feat/implement-redirects
matheuspolitano Apr 24, 2026
e8d4324
chore: remove portuguese comment
Apr 24, 2026
d8448a1
chore: switch to all ALL
Apr 24, 2026
4657841
Merge branch 'mp/cdn/feat/implement-redirects' into mp/cdn/feat/imple…
Apr 29, 2026
100fa6e
Merge branch 'main' into mp/cdn/feat/implement-configuring-waf
Apr 29, 2026
7d99d21
chore: create SortedStringToListVale in conversion
Apr 29, 2026
3c4cf95
chore: improve the documentations
Apr 29, 2026
c3c37c9
chore: improve cdn waf documentation
Apr 30, 2026
72ddf6c
chore: cdn remove the default value
Apr 30, 2026
1fdf69f
chore: improve waf
May 4, 2026
9dc726c
chore: update docs
May 4, 2026
a6f9afe
Merge branch 'main' into mp/cdn/feat/implement-configuring-waf
matheuspolitano May 4, 2026
4b3a312
chore: update doc
May 4, 2026
578a3a5
chore: small changes to improve the code quality
May 5, 2026
e2a5cad
Merge branch 'main' into mp/cdn/feat/implement-configuring-waf
matheuspolitano May 5, 2026
4a6c09a
chore: add optinal field as computed to waf
May 5, 2026
9525700
Merge branch 'mp/cdn/feat/implement-configuring-waf' of https://githu…
May 5, 2026
84bd06c
chore: add http method as computed
May 5, 2026
f74f399
chore: swich the list in wat to set
May 5, 2026
fa27007
chore: improve update
May 5, 2026
fddccee
chore: swich to set in datasource
May 5, 2026
1cd6633
chore: adjsut the resouce and datasource cdn test to the new set type
May 5, 2026
dd710f0
Merge branch 'main' into mp/cdn/feat/implement-configuring-waf
matheuspolitano May 5, 2026
7f734dc
chore: update doc
May 5, 2026
7db83f2
Update stackit/internal/services/cdn/distribution/resource.go
matheuspolitano May 6, 2026
49ddaeb
chore: remove conversion
May 6, 2026
7860ee6
chore: remove the sort
May 6, 2026
20dfad7
Merge branch 'mp/cdn/feat/implement-configuring-waf' of https://githu…
May 6, 2026
bb0e58d
chore: get rid of never true statement
May 6, 2026
fd0a5c6
chore: simplify code
matheuspolitano May 6, 2026
b3b0955
Merge branch 'mp/cdn/feat/implement-configuring-waf' of https://githu…
May 6, 2026
9225a1e
chore: fix suggestion
May 6, 2026
34ba969
chore: add small improvement
May 6, 2026
37ee74c
chore: small adjust
May 6, 2026
1adc1c8
chore: create function to share between resource and datasource
May 6, 2026
c4b3b72
chore: remove ignore state
May 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion docs/data-sources/cdn_distribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ data "stackit_cdn_distribution" "example" {

### Required

- `distribution_id` (String) STACKIT project ID associated with the distribution
- `distribution_id` (String) CDN distribution ID
- `project_id` (String) STACKIT project ID associated with the distribution

### Read-Only
Expand All @@ -53,6 +53,7 @@ Read-Only:
- `optimizer` (Attributes) Configuration for the Image Optimizer. This is a paid feature that automatically optimizes images to reduce their file size for faster delivery, leading to improved website performance and a better user experience. (see [below for nested schema](#nestedatt--config--optimizer))
- `redirects` (Attributes) A wrapper for a list of redirect rules that allows for redirect settings on a distribution (see [below for nested schema](#nestedatt--config--redirects))
- `regions` (List of String) The configured regions where content will be hosted
- `waf` (Attributes) Configuration of the Web Application Firewall (WAF) for the distribution. Removing this block from your configuration will completely disable the WAF. (see [below for nested schema](#nestedatt--config--waf))

<a id="nestedatt--config--backend"></a>
### Nested Schema for `config.backend`
Expand Down Expand Up @@ -105,6 +106,28 @@ Read-Only:



<a id="nestedatt--config--waf"></a>
### Nested Schema for `config.waf`

Read-Only:

- `allowed_http_methods` (Set of String) Restricts which HTTP methods the distribution accepts. If provided, the set must contain at least one item. If omitted, the API applies the following defaults: `GET`, `HEAD`, `POST`, `PUT`, `DELETE`, `CONNECT`, `OPTIONS`, `TRACE`, `PATCH`.
- `allowed_http_versions` (Set of String) Restricts which HTTP protocol versions are accepted. If provided, the set must contain at least one item. If omitted, the API applies the following defaults: `HTTP/1.0`, `HTTP/1.1`, `HTTP/2`, `HTTP/2.0`.
- `allowed_request_content_types` (Set of String) Restricts which Content-Type headers are accepted in request bodies. If provided, the set must contain at least one item. If omitted, the API applies the following defaults: `application/x-www-form-urlencoded`, `multipart/form-data`, `multipart/related`, `text/xml`, `application/xml`, `application/soap+xml`, `application/x-amf`, `application/json`, `application/octet-stream`, `application/csp-report`, `application/xss-auditor-report`, `text/plain`.
- `disabled_rule_collection_ids` (Set of String) Set of WAF Collection IDs explicitly disabled. Can be set to an empty set to clear previously set rules. To view available rule collections, please consult the API documentation: https://docs.api.eu01.stackit.cloud/documentation/cdn/version/v1#tag/WAF/operation/ListWafCollections
- `disabled_rule_group_ids` (Set of String) Set of WAF Rule Group IDs explicitly disabled. Can be set to an empty set to clear previously set rules. Precedence hierarchy: Groups override Collections. To view available rule groups, please consult the API documentation: https://docs.api.eu01.stackit.cloud/documentation/cdn/version/v1#tag/WAF/operation/ListWafCollections
- `disabled_rule_ids` (Set of String) Set of WAF rule IDs explicitly disabled. Can be set to an empty set to clear previously set rules. Precedence hierarchy: Specific Rules override Groups. For example, an explicitly disabled Rule ID takes precedence over an enabled Group ID. To view available rules, please consult the API documentation: https://docs.api.eu01.stackit.cloud/documentation/cdn/version/v1#tag/WAF/operation/ListWafCollections
- `enabled_rule_collection_ids` (Set of String) Set of WAF Collection IDs explicitly enabled. Can be set to an empty set to clear previously set rules. To view available rule collections, please consult the API documentation: https://docs.api.eu01.stackit.cloud/documentation/cdn/version/v1#tag/WAF/operation/ListWafCollections
- `enabled_rule_group_ids` (Set of String) Set of WAF Rule Group IDs explicitly enabled. Can be set to an empty set to clear previously set rules. Precedence hierarchy: Groups override Collections. To view available rule groups, please consult the API documentation: https://docs.api.eu01.stackit.cloud/documentation/cdn/version/v1#tag/WAF/operation/ListWafCollections
- `enabled_rule_ids` (Set of String) Set of WAF rule IDs explicitly enabled. Can be set to an empty set to clear previously set rules. Precedence hierarchy: Specific Rules override Groups. For example, an explicitly enabled Rule ID takes precedence over a disabled Group ID. To view available rules, please consult the API documentation: https://docs.api.eu01.stackit.cloud/documentation/cdn/version/v1#tag/WAF/operation/ListWafCollections
- `log_only_rule_collection_ids` (Set of String) Set of WAF Collection IDs explicitly marked as Log Only. Can be set to an empty set to clear previously set rules. To view available rule collections, please consult the API documentation: https://docs.api.eu01.stackit.cloud/documentation/cdn/version/v1#tag/WAF/operation/ListWafCollections
- `log_only_rule_group_ids` (Set of String) Set of WAF Rule Group IDs explicitly marked as Log Only. Can be set to an empty set to clear previously set rules. Precedence hierarchy: Groups override Collections. To view available rule groups, please consult the API documentation: https://docs.api.eu01.stackit.cloud/documentation/cdn/version/v1#tag/WAF/operation/ListWafCollections
- `log_only_rule_ids` (Set of String) Set of WAF rule IDs explicitly marked as Log Only. Can be set to an empty set to clear previously set rules. Precedence hierarchy: Specific Rules override Groups. To view available rules, please consult the API documentation: https://docs.api.eu01.stackit.cloud/documentation/cdn/version/v1#tag/WAF/operation/ListWafCollections
- `mode` (String) The operating mode of the WAF. 'ENABLED' actively blocks threats, 'LOG_ONLY' logs matches without blocking, and 'DISABLED' completely turns off inspection. Defaults to 'DISABLED'.
- `paranoia_level` (String) Defines how aggressively the WAF should act on requests. Valid values are 'L1' to 'L4'. Defaults to 'L1'.
- `type` (String) The tier of the WAF. Valid values are 'FREE' or 'PREMIUM'. Defaults to 'FREE'.



<a id="nestedatt--domains"></a>
### Nested Schema for `domains`
Expand Down
59 changes: 59 additions & 0 deletions docs/resources/cdn_distribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,39 @@ resource "stackit_cdn_distribution" "example_bucket_distribution" {
}
]
}

# WAF Configuration
#
# Precedence Hierarchy: Specific Rules > Groups > Collections
# In this example, the entire "@builtin/crs/request" collection is ENABLED.
# However, because specific Rule IDs have a higher precedence, the rule
# "@builtin/crs/request/942151" is explicitly DISABLED, overriding the collection setting.
#
# To view all available collections, groups, and rules, consult the API documentation:
# https://docs.api.eu01.stackit.cloud/documentation/cdn/version/v1#tag/WAF/operation/ListWafCollections
waf = {
mode = "ENABLED"
type = "PREMIUM"
paranoia_level = "L1"
allowed_http_versions = ["HTTP/1.0", "HTTP/1.1"]
allowed_http_methods = ["GET"]
allowed_request_content_types = ["text/plain"]

# Collections
enabled_rule_collection_ids = ["@builtin/crs/request"]
disabled_rule_collection_ids = []
log_only_rule_collection_ids = ["@builtin/crs/response"]

# Groups
enabled_rule_group_ids = []
disabled_rule_group_ids = []
log_only_rule_group_ids = []

# Specific Rules (Highest Precedence)
enabled_rule_ids = ["@builtin/crs/request/913100"]
disabled_rule_ids = ["@builtin/crs/request/942151"]
log_only_rule_ids = ["@builtin/crs/response/954120"]
}
}
}

Expand Down Expand Up @@ -115,6 +148,7 @@ Optional:
- `blocked_countries` (List of String) The configured countries where distribution of content is blocked
- `optimizer` (Attributes) Configuration for the Image Optimizer. This is a paid feature that automatically optimizes images to reduce their file size for faster delivery, leading to improved website performance and a better user experience. (see [below for nested schema](#nestedatt--config--optimizer))
- `redirects` (Attributes) A wrapper for a list of redirect rules that allows for redirect settings on a distribution (see [below for nested schema](#nestedatt--config--redirects))
- `waf` (Attributes) Configuration of the Web Application Firewall (WAF) for the distribution. Removing this block from your configuration will completely disable the WAF. (see [below for nested schema](#nestedatt--config--waf))

<a id="nestedatt--config--backend"></a>
### Nested Schema for `config.backend`
Expand Down Expand Up @@ -186,6 +220,31 @@ Optional:



<a id="nestedatt--config--waf"></a>
### Nested Schema for `config.waf`

Required:

- `mode` (String) The operating mode of the WAF. 'ENABLED' actively blocks threats, 'LOG_ONLY' logs matches without blocking, and 'DISABLED' completely turns off inspection. Defaults to 'DISABLED'.
- `type` (String) The tier of the WAF. Valid values are 'FREE' or 'PREMIUM'. Defaults to 'FREE'.

Optional:

- `allowed_http_methods` (Set of String) Restricts which HTTP methods the distribution accepts. If provided, the set must contain at least one item. If omitted, the API applies the following defaults: `GET`, `HEAD`, `POST`, `PUT`, `DELETE`, `CONNECT`, `OPTIONS`, `TRACE`, `PATCH`.
- `allowed_http_versions` (Set of String) Restricts which HTTP protocol versions are accepted. If provided, the set must contain at least one item. If omitted, the API applies the following defaults: `HTTP/1.0`, `HTTP/1.1`, `HTTP/2`, `HTTP/2.0`.
- `allowed_request_content_types` (Set of String) Restricts which Content-Type headers are accepted in request bodies. If provided, the set must contain at least one item. If omitted, the API applies the following defaults: `application/x-www-form-urlencoded`, `multipart/form-data`, `multipart/related`, `text/xml`, `application/xml`, `application/soap+xml`, `application/x-amf`, `application/json`, `application/octet-stream`, `application/csp-report`, `application/xss-auditor-report`, `text/plain`.
- `disabled_rule_collection_ids` (Set of String) Set of WAF Collection IDs explicitly disabled. Can be set to an empty set to clear previously set rules. To view available rule collections, please consult the API documentation: https://docs.api.eu01.stackit.cloud/documentation/cdn/version/v1#tag/WAF/operation/ListWafCollections
- `disabled_rule_group_ids` (Set of String) Set of WAF Rule Group IDs explicitly disabled. Can be set to an empty set to clear previously set rules. Precedence hierarchy: Groups override Collections. To view available rule groups, please consult the API documentation: https://docs.api.eu01.stackit.cloud/documentation/cdn/version/v1#tag/WAF/operation/ListWafCollections
- `disabled_rule_ids` (Set of String) Set of WAF rule IDs explicitly disabled. Can be set to an empty set to clear previously set rules. Precedence hierarchy: Specific Rules override Groups. For example, an explicitly disabled Rule ID takes precedence over an enabled Group ID. To view available rules, please consult the API documentation: https://docs.api.eu01.stackit.cloud/documentation/cdn/version/v1#tag/WAF/operation/ListWafCollections
- `enabled_rule_collection_ids` (Set of String) Set of WAF Collection IDs explicitly enabled. Can be set to an empty set to clear previously set rules. To view available rule collections, please consult the API documentation: https://docs.api.eu01.stackit.cloud/documentation/cdn/version/v1#tag/WAF/operation/ListWafCollections
- `enabled_rule_group_ids` (Set of String) Set of WAF Rule Group IDs explicitly enabled. Can be set to an empty set to clear previously set rules. Precedence hierarchy: Groups override Collections. To view available rule groups, please consult the API documentation: https://docs.api.eu01.stackit.cloud/documentation/cdn/version/v1#tag/WAF/operation/ListWafCollections
- `enabled_rule_ids` (Set of String) Set of WAF rule IDs explicitly enabled. Can be set to an empty set to clear previously set rules. Precedence hierarchy: Specific Rules override Groups. For example, an explicitly enabled Rule ID takes precedence over a disabled Group ID. To view available rules, please consult the API documentation: https://docs.api.eu01.stackit.cloud/documentation/cdn/version/v1#tag/WAF/operation/ListWafCollections
- `log_only_rule_collection_ids` (Set of String) Set of WAF Collection IDs explicitly marked as Log Only. Can be set to an empty set to clear previously set rules. To view available rule collections, please consult the API documentation: https://docs.api.eu01.stackit.cloud/documentation/cdn/version/v1#tag/WAF/operation/ListWafCollections
- `log_only_rule_group_ids` (Set of String) Set of WAF Rule Group IDs explicitly marked as Log Only. Can be set to an empty set to clear previously set rules. Precedence hierarchy: Groups override Collections. To view available rule groups, please consult the API documentation: https://docs.api.eu01.stackit.cloud/documentation/cdn/version/v1#tag/WAF/operation/ListWafCollections
- `log_only_rule_ids` (Set of String) Set of WAF rule IDs explicitly marked as Log Only. Can be set to an empty set to clear previously set rules. Precedence hierarchy: Specific Rules override Groups. To view available rules, please consult the API documentation: https://docs.api.eu01.stackit.cloud/documentation/cdn/version/v1#tag/WAF/operation/ListWafCollections
- `paranoia_level` (String) Defines how aggressively the WAF should act on requests. Valid values are 'L1' to 'L4'. Defaults to 'L1'.



<a id="nestedatt--domains"></a>
### Nested Schema for `domains`
Expand Down
33 changes: 33 additions & 0 deletions examples/resources/stackit_cdn_distribution/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,39 @@ resource "stackit_cdn_distribution" "example_bucket_distribution" {
}
]
}

# WAF Configuration
#
# Precedence Hierarchy: Specific Rules > Groups > Collections
# In this example, the entire "@builtin/crs/request" collection is ENABLED.
# However, because specific Rule IDs have a higher precedence, the rule
# "@builtin/crs/request/942151" is explicitly DISABLED, overriding the collection setting.
#
# To view all available collections, groups, and rules, consult the API documentation:
# https://docs.api.eu01.stackit.cloud/documentation/cdn/version/v1#tag/WAF/operation/ListWafCollections
waf = {
mode = "ENABLED"
type = "PREMIUM"
paranoia_level = "L1"
allowed_http_versions = ["HTTP/1.0", "HTTP/1.1"]
allowed_http_methods = ["GET"]
allowed_request_content_types = ["text/plain"]

# Collections
enabled_rule_collection_ids = ["@builtin/crs/request"]
disabled_rule_collection_ids = []
log_only_rule_collection_ids = ["@builtin/crs/response"]

# Groups
enabled_rule_group_ids = []
disabled_rule_group_ids = []
log_only_rule_group_ids = []

# Specific Rules (Highest Precedence)
enabled_rule_ids = ["@builtin/crs/request/913100"]
disabled_rule_ids = ["@builtin/crs/request/942151"]
log_only_rule_ids = ["@builtin/crs/response/954120"]
}
}
}

Expand Down
Loading
Loading