feat: implement image optimizer in cdn service (#895)

* implement image optimizer in cdn service

* add documentation

* add optimizer in cdn acc test

* add example

---------

Co-authored-by: Matheus Politano <matheus.correia_politano@mail.schwarz>
Co-authored-by: Marcel Jacek <72880145+marceljk@users.noreply.github.com>
This commit is contained in:
Politano 2025-07-15 09:05:19 +02:00 committed by GitHub
parent 126b7a2803
commit 6f33262e8c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 231 additions and 34 deletions

View file

@ -46,6 +46,7 @@ data "stackit_cdn_distribution" "example" {
Read-Only:
- `backend` (Attributes) The configured backend for the distribution (see [below for nested schema](#nestedatt--config--backend))
- `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))
- `regions` (List of String) The configured regions where content will be hosted
<a id="nestedatt--config--backend"></a>
@ -58,6 +59,14 @@ Read-Only:
- `type` (String) The configured backend type. Supported values are: `http`.
<a id="nestedatt--config--optimizer"></a>
### Nested Schema for `config.optimizer`
Read-Only:
- `enabled` (Boolean)
<a id="nestedatt--domains"></a>
### Nested Schema for `domains`

View file

@ -24,6 +24,9 @@ resource "stackit_cdn_distribution" "example_distribution" {
origin_url = "mybackend.onstackit.cloud"
}
regions = ["EU", "US", "ASIA", "AF", "SA"]
optimizer = {
enabled = true
}
}
}
```
@ -54,6 +57,10 @@ Required:
- `backend` (Attributes) The configured backend for the distribution (see [below for nested schema](#nestedatt--config--backend))
- `regions` (List of String) The configured regions where content will be hosted
Optional:
- `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))
<a id="nestedatt--config--backend"></a>
### Nested Schema for `config.backend`
@ -67,6 +74,14 @@ Optional:
- `origin_request_headers` (Map of String) The configured origin request headers for the backend
<a id="nestedatt--config--optimizer"></a>
### Nested Schema for `config.optimizer`
Optional:
- `enabled` (Boolean)
<a id="nestedatt--domains"></a>
### Nested Schema for `domains`