Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(image_optimizer_default_settings): add Image Optimizer default settings API #832

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
65 changes: 65 additions & 0 deletions docs/guides/image_optimizer_default_settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
page_title: image_optimizer_default_settings
subcategory: "Guides"
---

## Image Optimizer Default Settings

[Fastly Image Optimizer](https://docs.fastly.com/products/image-optimizer) (Fastly IO) is an [image optimization](https://www.fastly.com/learning/what-is-image-optimization) service that manipulates and transforms your images in real time and caches optimized versions of them.

Fastly Image Optimizer supports a variety of image formats and applies specific settings to all images by default. These can be controlled with this API or the [web interface](https://docs.fastly.com/en/guides/about-fastly-image-optimizer#configuring-default-image-settings). Changes to other image settings, including most image transformations, require using query string parameters on individual requests.

The [Image Optimizer default settings](https://developer.fastly.com/reference/api/services/image-optimizer-default-settings/) API allows customers to configure
default settings for Image Optimizer requests, configuring the way images are optimized when not overridden by URL parameters on specific requests.

The service must have the Image Optimizer product enabled using the Product Enablement API, UI, or Terraform block to use the `image_optimizer` block.

## Example Usage

Basic usage:

```terraform
resource "fastly_service_vcl" "demo" {
name = "demofastly"

domain {
name = "demo.notexample.com"
comment = "demo"
}

backend {
address = "127.0.0.1"
name = "localhost"
port = 80
}

product_enablement {
image_optimizer = true
}

image_optimizer_default_settings {
resize_filter = "lanczos3"
webp = false
webp_quality = 85
jpeg_type = "auto"
jpeg_quality = 85
upscale = false
allow_video = false
}

force_destroy = true
}
```

All fields in `image_optimizer_default_settings` are optional.

NOTE: When added, `image_optimizer_default_settings` will always set all default settings. This will replace any settings previously changed in the UI or API.

## Delete

Deleting the resource will reset all Image Optimizer default settings to their default values.

If deleting the resource errors due to Image Optimizer no longer being enabled on the service, then this error will be ignored.

When Image Optimizer is next re-enabled on a service, that service's Image Optimizer default settings will be reset - so a disabled service effectively already
has deleted/default Image Optimizer default settings.
24 changes: 24 additions & 0 deletions docs/resources/service_compute.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ $ terraform import fastly_service_compute.demo xxxxxxxxxxxxxxxxxxxx@2
- `comment` (String) Description field for the service. Default `Managed by Terraform`
- `dictionary` (Block Set) (see [below for nested schema](#nestedblock--dictionary))
- `force_destroy` (Boolean) Services that are active cannot be destroyed. In order to destroy the Service, set `force_destroy` to `true`. Default `false`
- `image_optimizer_default_settings` (Block Set, Max: 1) (see [below for nested schema](#nestedblock--image_optimizer_default_settings))
- `logging_bigquery` (Block Set) (see [below for nested schema](#nestedblock--logging_bigquery))
- `logging_blobstorage` (Block Set) (see [below for nested schema](#nestedblock--logging_blobstorage))
- `logging_cloudfiles` (Block Set) (see [below for nested schema](#nestedblock--logging_cloudfiles))
Expand Down Expand Up @@ -187,6 +188,29 @@ Read-Only:
- `dictionary_id` (String) The ID of the dictionary


<a id="nestedblock--image_optimizer_default_settings"></a>
### Nested Schema for `image_optimizer_default_settings`

Optional:

- `allow_video` (Boolean) Enables GIF to MP4 transformations on this service.
- `jpeg_quality` (Number) The default quality to use with JPEG output. This can be overridden with the "quality" parameter on specific image optimizer requests.
- `jpeg_type` (String) The default type of JPEG output to use. This can be overridden with "format=bjpeg" and "format=pjpeg" on specific image optimizer requests. Valid values are `auto`, `baseline` and `progressive`.
- auto: Match the input JPEG type, or baseline if transforming from a non-JPEG input.
- baseline: Output baseline JPEG images
- progressive: Output progressive JPEG images
- `name` (String) Used by the provider to identify modified settings. Changing this value will force the entire block to be deleted, then recreated.
- `resize_filter` (String) The type of filter to use while resizing an image. Valid values are `lanczos3`, `lanczos2`, `bicubic`, `bilinear` and `nearest`.
- lanczos3: A Lanczos filter with a kernel size of 3. Lanczos filters can detect edges and linear features within an image, providing the best possible reconstruction.
- lanczos2: A Lanczos filter with a kernel size of 2.
- bicubic: A filter using an average of a 4x4 environment of pixels, weighing the innermost pixels higher.
- bilinear: A filter using an average of a 2x2 environment of pixels.
- nearest: A filter using the value of nearby translated pixel values. Preserves hard edges.
- `upscale` (Boolean) Whether or not we should allow output images to render at sizes larger than input.
- `webp` (Boolean) Controls whether or not to default to WebP output when the client supports it. This is equivalent to adding "auto=webp" to all image optimizer requests.
- `webp_quality` (Number) The default quality to use with WebP output. This can be overridden with the second option in the "quality" URL parameter on specific image optimizer requests.


<a id="nestedblock--logging_bigquery"></a>
### Nested Schema for `logging_bigquery`

Expand Down
24 changes: 24 additions & 0 deletions docs/resources/service_vcl.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ $ terraform import fastly_service_vcl.demo xxxxxxxxxxxxxxxxxxxx@2
- `header` (Block Set) (see [below for nested schema](#nestedblock--header))
- `healthcheck` (Block Set) (see [below for nested schema](#nestedblock--healthcheck))
- `http3` (Boolean) Enables support for the HTTP/3 (QUIC) protocol
- `image_optimizer_default_settings` (Block Set, Max: 1) (see [below for nested schema](#nestedblock--image_optimizer_default_settings))
- `logging_bigquery` (Block Set) (see [below for nested schema](#nestedblock--logging_bigquery))
- `logging_blobstorage` (Block Set) (see [below for nested schema](#nestedblock--logging_blobstorage))
- `logging_cloudfiles` (Block Set) (see [below for nested schema](#nestedblock--logging_cloudfiles))
Expand Down Expand Up @@ -510,6 +511,29 @@ Optional:
- `window` (Number) The number of most recent Healthcheck queries to keep for this Healthcheck. Default `5`


<a id="nestedblock--image_optimizer_default_settings"></a>
### Nested Schema for `image_optimizer_default_settings`

Optional:

- `allow_video` (Boolean) Enables GIF to MP4 transformations on this service.
- `jpeg_quality` (Number) The default quality to use with JPEG output. This can be overridden with the "quality" parameter on specific image optimizer requests.
- `jpeg_type` (String) The default type of JPEG output to use. This can be overridden with "format=bjpeg" and "format=pjpeg" on specific image optimizer requests. Valid values are `auto`, `baseline` and `progressive`.
- auto: Match the input JPEG type, or baseline if transforming from a non-JPEG input.
- baseline: Output baseline JPEG images
- progressive: Output progressive JPEG images
- `name` (String) Used by the provider to identify modified settings. Changing this value will force the entire block to be deleted, then recreated.
- `resize_filter` (String) The type of filter to use while resizing an image. Valid values are `lanczos3`, `lanczos2`, `bicubic`, `bilinear` and `nearest`.
- lanczos3: A Lanczos filter with a kernel size of 3. Lanczos filters can detect edges and linear features within an image, providing the best possible reconstruction.
- lanczos2: A Lanczos filter with a kernel size of 2.
- bicubic: A filter using an average of a 4x4 environment of pixels, weighing the innermost pixels higher.
- bilinear: A filter using an average of a 2x2 environment of pixels.
- nearest: A filter using the value of nearby translated pixel values. Preserves hard edges.
- `upscale` (Boolean) Whether or not we should allow output images to render at sizes larger than input.
- `webp` (Boolean) Controls whether or not to default to WebP output when the client supports it. This is equivalent to adding "auto=webp" to all image optimizer requests.
- `webp_quality` (Number) The default quality to use with WebP output. This can be overridden with the second option in the "quality" URL parameter on specific image optimizer requests.


<a id="nestedblock--logging_bigquery"></a>
### Nested Schema for `logging_bigquery`

Expand Down
Loading
Loading