-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(image_optimizer_default_settings): add Image Optimizer default s…
…ettings API (#832) * Temporarily vendor go-fastly from Image Optimizer default settings API PR * Add Image Optimizer default settings API * Generate docs. * Handle case where reading image optimizer settings on a service without IO enabled. * Fix "invalid key for element" error caused by missing "name" key * PR cleanup suggestion. * Include default values. I was initially trying to get Terraform to ignore settings that wern't set in the configuration, leaving them at their previously configured value. This seems to be counter to Terraform's design, though, so I've relented & included the current default values for each setting here. It seems like maybe we could have done that for the string values, and non-0 integers, but it seems like a nonstarter for booleans (hashicorp/terraform-plugin-sdk#817), and I didn't want to go against Terraform's design too much. * Update go-fastly vendored from PR * Fix lints + add debug message. * One more vendor update. * Update jpeg_type, and with that, finally have a passing test! * Update vendored code again. * Update field documentation. Part of this is updating field with descriptions from the final api-documentation PR. The other part is just my messing with stuff to try to make it look better. * Update generated docs (also, move image_optimizer_default_settings guide from docs to templates) * Change Delete so it resets all settings to default. * Overhaul Image Optimizer default settings test. * Update vendored go-fastly to 9.4.0. * Add debug message for ignoring image-optimizer-disabled error on deletion. This is working well! Just wanted to add this to double-confirm it's doing what I expect. * Remove toolchain directive. * Undo go version bump. Not sure why updating had caused this, but this should still work.
- Loading branch information
Showing
16 changed files
with
864 additions
and
9 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,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. |
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.