An open API service indexing awesome lists of open source software.

https://github.com/terraform-yacloud-modules/terraform-yandex-cdn

Terraform module to manage of Yandex.Cloud CDN resources.
https://github.com/terraform-yacloud-modules/terraform-yandex-cdn

hacktoberfest yandex yandex-cloud

Last synced: 8 months ago
JSON representation

Terraform module to manage of Yandex.Cloud CDN resources.

Awesome Lists containing this project

README

          

# Yandex Cloud CDN Terraform module

Terraform module which creates Yandex Cloud CDN resources. To get more information about Yandex Cloud CDN, use the following [docs](https://github.com/yandex-cloud/docs/tree/master/ru/cdn).

## Examples

Examples codified under
the [`examples`](https://github.com/terraform-yacloud-modules/terraform-yandex-cdn/tree/main/examples) are intended
to give users references for how to use the module(s) as well as testing/validating changes to the source code of the
module. If contributing to the project, please be sure to make any appropriate updates to the relevant examples to allow
maintainers to test your changes and to keep the examples up to date for users. Thank you!

## Requirements

| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.0 |
| [tls](#requirement\_tls) | >= 3.1.0 |
| [yandex](#requirement\_yandex) | >= 0.72.0 |

## Providers

| Name | Version |
|------|---------|
| [yandex](#provider\_yandex) | >= 0.72.0 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [yandex_cdn_origin_group.main](https://registry.terraform.io/providers/yandex-cloud/yandex/latest/docs/resources/cdn_origin_group) | resource |
| [yandex_cdn_resource.main](https://registry.terraform.io/providers/yandex-cloud/yandex/latest/docs/resources/cdn_resource) | resource |
| [yandex_cm_certificate.cdn](https://registry.terraform.io/providers/yandex-cloud/yandex/latest/docs/resources/cm_certificate) | resource |
| [yandex_dns_recordset.cdn_cm](https://registry.terraform.io/providers/yandex-cloud/yandex/latest/docs/resources/dns_recordset) | resource |
| [yandex_client_config.client](https://registry.terraform.io/providers/yandex-cloud/yandex/latest/docs/data-sources/client_config) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [active](#input\_active) | End user access to content is indicated by the following flag:
true - indicates that CDN content is available to clients;
false - indicates that content access is disabled. | `bool` | `true` | no |
| [allowed\_http\_methods](#input\_allowed\_http\_methods) | HTTP methods for your CDN content.
By default the following methods are allowed: GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS.
In case some methods are not allowed to the user, they will get the 405 (Method Not Allowed) response.
If the method is not supported, the user gets the 501 (Not Implemented) response. | `list(string)` |

[
"GET",
"HEAD",
"POST",
"PUT",
"PATCH",
"DELETE",
"OPTIONS"
]
| no |
| [browser\_cache\_settings](#input\_browser\_cache\_settings) | Set up a cache period for the end-users browser.
Content will be cached due to origin settings.
If there are no cache settings on your origin,
the content will not be cached.
The list of HTTP response codes that can be cached in browsers:
200, 201, 204, 206, 301, 302, 303, 304, 307, 308.
Other response codes will not be cached.
The default value is 0. | `string` | `"0"` | no |
| [cache\_http\_headers](#input\_cache\_http\_headers) | List of HTTP headers that must be included in responses to clients. | `list(string)` | `[]` | no |
| [cdn\_ssl\_certificate\_id](#input\_cdn\_ssl\_certificate\_id) | ID of user certificate in Yandex Certificate Manager. | `string` | `null` | no |
| [cm\_add\_challenge\_records](#input\_cm\_add\_challenge\_records) | If true, Certificate Manager challenge records will be created at dns\_zone\_id. | `bool` | `false` | no |
| [cm\_issue\_ssl\_certificate](#input\_cm\_issue\_ssl\_certificate) | If true, Let's Encrypt certificate will be issued for cname | `bool` | `false` | no |
| [cname](#input\_cname) | Primary domain name for content distribution. | `string` | n/a | yes |
| [cors](#input\_cors) | Parameter that lets browsers get access to selected resources
from a domain different to a domain from which the request is received. | `list(string)` |
[
"*"
]
| no |
| [custom\_host\_header](#input\_custom\_host\_header) | Custom value for the Host header.
Your server must be able to process requests with the chosen header.
E.g.: "ycprojektblue-storage.storage.yandexcloud.net" | `string` | `null` | no |
| [custom\_server\_name](#input\_custom\_server\_name) | Wildcard additional CNAME.
If a resource has a wildcard additional CNAME,
you can use your own certificate for content delivery via HTTPS.
Read-only. | `string` | `null` | no |
| [disable\_cache](#input\_disable\_cache) | Setup a cache status. | `bool` | `false` | no |
| [disable\_proxy\_force\_ranges](#input\_disable\_proxy\_force\_ranges) | Disabling proxy force ranges. | `bool` | `false` | no |
| [dns\_zone\_id](#input\_dns\_zone\_id) | ID of Yandex DNS zone, where certificate manager records will be created. | `string` | `null` | no |
| [edge\_cache\_settings](#input\_edge\_cache\_settings) | Content will be cached according to origin cache settings.
The value applies for a response with codes 200, 201, 204, 206, 301, 302, 303, 304, 307, 308
if an origin server does not have caching HTTP headers.
Responses with other codes will not be cached.
The default value is 345600. | `string` | `"345600"` | no |
| [enable\_ip\_url\_signing](#input\_enable\_ip\_url\_signing) | Optional parameter, `true` or `false`.
It restricts access to a CDN resource based on IP.
A trusted IP address is specified as a parameter outside a CDN resource when generating an [MD5](https://en.wikipedia.org/wiki/MD5) hash for a signed link.
If the parameter is not set, file access will be allowed from any IP. | `bool` | `false` | no |
| [fetched\_compressed](#input\_fetched\_compressed) | Option helps you to reduce the bandwidth between origin and CDN servers.
Also, content delivery speed becomes higher because of reducing the time
for compressing files in a CDN. | `bool` | `false` | no |
| [folder\_id](#input\_folder\_id) | (Optional) The ID of the Yandex Cloud Folder that the resources belongs to.

Allows to create bucket in different folder.
It will try to create bucket using IAM-token in provider config, not using access\_key.
If omitted, folder\_id specified in provider config and access\_key is used. | `string` | `null` | no |
| [forward\_host\_header](#input\_forward\_host\_header) | Choose the Forward Host header option if it is important
to send in the request to the Origin the same Host header
as was sent in the request to CDN server. | `bool` | `true` | no |
| [gzip\_on](#input\_gzip\_on) | GZip compression at CDN servers reduces file size by 70% and can be as high as 90%. | `bool` | `true` | no |
| [ignore\_cookie](#input\_ignore\_cookie) | Set for ignoring cookie. | `bool` | `true` | no |
| [ignore\_query\_params](#input\_ignore\_query\_params) | Files with different query parameters are cached as objects with the same key
regardless of the parameter value. Selected by default. | `bool` | `false` | no |
| [ip\_address\_acl\_excepted\_values](#input\_ip\_address\_acl\_excepted\_values) | The list of specified IP addresses to be allowed or denied
depending on acl policy type. | `list(string)` | `[]` | no |
| [ip\_address\_acl\_policy\_type](#input\_ip\_address\_acl\_policy\_type) | The policy type for ip\_address\_acl option,
one of "allow" or "deny" values. | `string` | `"allow"` | no |
| [ip\_address\_enabled](#input\_ip\_address\_enabled) | If true, IP Address ACL will be enabled | `bool` | `false` | no |
| [labels](#input\_labels) | A set of labels that will be applied to all resources in this module. | `map(string)` | `{}` | no |
| [origin\_group\_origins](#input\_origin\_group\_origins) | A map of objects representing the origins for the CDN origin group. Each object contains the following fields:
- enabled (optional, default: true): A boolean indicating whether the origin is enabled and used as a source for the CDN.
- source (required): The IP address or domain name of your origin and the port.
- backup (optional, default: false): A boolean specifying whether the origin is used in its origin group as a backup. A backup origin is used when one of the active origins becomes unavailable.

Example:
{
origin1 = {
source = "192.168.1.1:8080"
backup = false
}
origin2 = {
source = "example.com"
enabled = true
backup = true
}
} |
map(object({
enabled = optional(bool, true)
source = string
backup = optional(bool, false)
}))
| `{}` | no |
| [origin\_group\_use\_next](#input\_origin\_group\_use\_next) | If the option is active (has true value),
in case the origin responds with 4XX or 5XX codes, use the next origin from the list. | `bool` | `true` | no |
| [origin\_protocol](#input\_origin\_protocol) | Origin protocol for sources | `string` | `"http"` | no |
| [proxy\_cache\_methods\_set](#input\_proxy\_cache\_methods\_set) | Allows caching for GET, HEAD and POST requests. | `bool` | `true` | no |
| [query\_params\_blacklist](#input\_query\_params\_blacklist) | Files with the specified query parameters are cached as objects with the same key,
files with other parameters are cached as objects with different keys. | `list(string)` | `[]` | no |
| [query\_params\_whitelist](#input\_query\_params\_whitelist) | Files with the specified query parameters are cached as objects with different keys,
files with other parameters are cached as objects with the same key. | `list(string)` | `[]` | no |
| [redirect\_http\_to\_https](#input\_redirect\_http\_to\_https) | Parameter for redirecting clients from HTTP to HTTPS;
possible values: 'true' or 'false'.
Available when using an SSL certificate, otherwise will be set as false. | `bool` | `true` | no |
| [redirect\_https\_to\_http](#input\_redirect\_https\_to\_http) | Set up a redirect from HTTPS to HTTP. | `bool` | `false` | no |
| [secondary\_hostnames](#input\_secondary\_hostnames) | Additional domain names for content distribution. | `list(string)` | `[]` | no |
| [secure\_key](#input\_secure\_key) | The secret key. An arbitrary string from 6 to 32 characters long.
Required to clarify access to a resource using secure tokens | `string` | `null` | no |
| [slice](#input\_slice) | Files larger than 10 MB will be requested and cached in parts
(no larger than 10 MB each part). It reduces time to first byte.
The origin must support HTTP Range requests. | `bool` | `false` | no |
| [static\_request\_headers](#input\_static\_request\_headers) | Set up custom headers that CDN servers will send in requests to origins. | `map(string)` | `{}` | no |
| [static\_response\_headers](#input\_static\_response\_headers) | Set up custom headers that CDN servers will send in response to clients. | `map(string)` | `{}` | no |

## Outputs

| Name | Description |
|------|-------------|
| [cdn\_origin\_group\_id](#output\_cdn\_origin\_group\_id) | The ID of the CDN origin group. |
| [cdn\_resource\_cname](#output\_cdn\_resource\_cname) | The CNAME of the CDN resource. |
| [cdn\_resource\_id](#output\_cdn\_resource\_id) | The ID of the CDN resource. |
| [cdn\_ssl\_certificate\_id](#output\_cdn\_ssl\_certificate\_id) | The ID of the SSL certificate used by the CDN resource. |
| [dns\_recordset\_ids](#output\_dns\_recordset\_ids) | The IDs of the DNS recordsets created for the CDN challenges. |

## License

Apache-2.0 Licensed.
See [LICENSE](https://github.com/terraform-yacloud-modules/terraform-yandex-cdn/blob/main/LICENSE).