> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gcore.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Manage CDN with Terraform v2

> Provider v2 manages Gcore CDN resources, covering delivery options, presets, and migration from provider v0.

Provider v2 manages Gcore CDN as separate Terraform resources. An origin group holds the source hostnames, and the CDN resource, certificates, rules, and rule templates sit beside it, with delivery behavior in an `options` map.

An [API token](/account-settings/api-tokens) and provider installation are in the [Terraform overview](/developer-tools/terraform/overview). A v0 configuration moves through the [migration guide](/developer-tools/terraform/migrate-v0-to-v2).

## Provider v0 and v2

Provider v2 keeps the same CDN objects and changes how Terraform names them and stores their settings.

| Area | Provider v0 | Provider v2 |
| - | - | - |
| Authentication | `permanent_api_token` | `api_key` |
| SSL certificate | `gcore_cdn_sslcert` | `gcore_cdn_certificate` |
| CA certificate | `gcore_cdn_cacert` | `gcore_cdn_trusted_ca_certificate` |
| Rule | `gcore_cdn_rule` | `gcore_cdn_resource_rule` |
| Origin group sources | Nested `origin` blocks | `sources` list |
| Delivery options | Nested `options` blocks | `options` map |
| S3 credentials | Stored in state | Write-only |
| SSL certificate body | `cert`, `private_key` | `ssl_certificate_wo`, `ssl_private_key_wo` |
| Origin shielding | `gcore_cdn_originshielding` | `gcore_cdn_origin_shielding` |
| Account CDN settings | `gcore_cdn_client_config` resource | `gcore_cdn_client_config` data source |

The account data source is read-only, and its `cname` attribute is the account CDN hostname. DNS for one resource uses that resource's id with `.gcdn.co` appended, which [CDN resource](/cdn/getting-started/create-a-cdn-resource/create-a-cdn-resource) prints after apply.

Provider 2.0.0-rc.2 adds `gcore_cdn_applied_preset` and data source `gcore_cdn_presets`, while provider 2.0.0-rc.1 includes the resources in the table above.

## Delivery options

Many option objects contain `enabled` and `value`. Setting `enabled` to false turns that setting off and leaves `value` in the configuration.

Leaving such a key out of `options` does not change the stored value, and assigning the key `null` does not clear it either. `image_stack` carries quality and format fields, `fastedge` names the apps for each request phase, and other keys add fields beside `enabled`.

`http3_enabled` uses `enabled` and `value`. The provider accepts it only when `ssl_enabled` is true on the same resource, which [HTTPS delivery](/cdn/ssl-certificates/add-an-ssl-certificate-to-deliver-content-over-https) sets.

## Presets

A preset is a read-only bundle of settings for a CDN resource or a rule. Data source `gcore_cdn_presets` returns each preset `id`, `name`, and `object_type`, which is `CDNResource` or `Rule`.

`gcore_cdn_applied_preset` binds `preset_id` to `object_id`. While that binding exists, an apply that changes an option the preset owns returns HTTP 400 and names the preset.

Removing the `gcore_cdn_applied_preset` block removes the binding. The next refresh records `preset_applied` as false and clears the options the preset had written.

LIVE STREAMING is the preset for live video, and it owns `stale`. [Video streaming](/cdn/getting-started/create-a-cdn-resource/create-a-cdn-resource-for-video-streaming) leaves that option unset while the preset is on.
