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

Fix rate limit err, split origin and add stuff #32

Merged
merged 1 commit into from
Oct 2, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@ jobs:
- env:
TF_ACC: "1"
CDN77_TOKEN: ${{ secrets.CDN77_TOKEN }}
run: go test -v ./internal/provider/
run: go test -p 1 -v --count 1 ./...
timeout-minutes: 10
3 changes: 1 addition & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ linters: # 2022-07-21 modified
- durationcheck
- errorlint
- exhaustive
- exportloopref
- copyloopvar
- gci
- gochecknoglobals
- gochecknoinits
Expand All @@ -33,7 +33,6 @@ linters: # 2022-07-21 modified
- nilnil
- nlreturn
- nolintlint
# - paralleltest # @todo check later, maybe enable
- prealloc
- predeclared
- revive
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ GOLANGCI_LINT ?= go run github.com/golangci/golangci-lint/cmd/golangci-lint@late

.PHONY: testacc
testacc: clearacc
TF_ACC=1 go test ./internal/provider -v -cover $(TESTARGS) --timeout 10m --count 1
TF_ACC=1 go test ./... -p 1 -v -cover $(TESTARGS) --timeout 10m --count 1

.PHONY: clearacc
clearacc:
Expand Down
9 changes: 4 additions & 5 deletions docs/data-sources/cdn.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ CDN resource allows you to manage your CDNs

```terraform
data "cdn77_cdn" "example" {
id = 7364999192
id = 1837865409
}
```

Expand All @@ -40,7 +40,6 @@ data "cdn77_cdn" "example" {
- `note` (String) Optional note
- `origin_headers` (Map of String) Custom HTTP headers included in requests sent to the origin server
- `origin_id` (String) ID (UUID) of attached Origin (content source for CDN)
- `origin_protection_enabled` (Boolean) Enabled origin protection can ease the load on your server or even hide it from direct incoming traffic with our proxy servers.
- `query_string` (Attributes) Enabling this feature will ignore the query string, allowing URLs with query strings to cache properly. This is particularly useful if you tag your URLs with tracking/marketing parameters, for example. (see [below for nested schema](#nestedatt--query_string))
- `rate_limit_enabled` (Boolean) When enabled, this feature limits the data transfer rate by setting "limit_rate" based on the "rs" URL parameter and "limit_rate_after" by the value from the "ri" URL parameter.
- `secure_token` (Attributes) This feature allows you to serve your content using signed URLs. You can enable your users to download secured content from the CDN with a valid hash. Note: When you check this option, make sure to generate secured links to access your content. (see [below for nested schema](#nestedatt--secure_token))
Expand Down Expand Up @@ -123,12 +122,12 @@ Read-Only:
Read-Only:

- `token` (String, Sensitive) Token length is between 8 and 64 characters.
- `type` (String) <ol>
- `type` (String) <ul>
<li>parameter - Token will be in the query string - e.g.: /video.mp4?secure=MY_SECURE_TOKEN.</li>
<li>path - Token will be in the path - e.g.: /MY_SECURE_TOKEN/video.mp4.</li>
<li>none - Use to disable secure token.</li>
<li>highwinds</li>
</ol>
</ul>


<a id="nestedatt--ssl"></a>
Expand All @@ -137,7 +136,7 @@ Read-Only:
Read-Only:

- `ssl_id` (String) ID (UUID) of the SSL certificate
- `type` (String) Available values: instantSsl, none, SNI
- `type` (String) Possible values: instantSsl, none, SNI


<a id="nestedatt--stream"></a>
Expand Down
116 changes: 116 additions & 0 deletions docs/data-sources/cdns.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,127 @@ data "cdn77_cdns" "all" {

Read-Only:

- `cache` (Attributes) Your files will remain cached for the specified duration, after which your origin will be checked for an updated version of your files. Expiry/cache-control headers override this setting. (see [below for nested schema](#nestedatt--cdns--cache))
- `cnames` (Set of String) CNAME assigned to CDN. CNAME should be mapped via DNS to CDN URL. Otherwise it's not possible to generate an SSL certificate for any related CNAME.
- `creation_time` (String) Timestamp when CDN was created
- `geo_protection` (Attributes) Geo protection enables you to control which countries can access your content directly (see [below for nested schema](#nestedatt--cdns--geo_protection))
- `headers` (Attributes) (see [below for nested schema](#nestedatt--cdns--headers))
- `hotlink_protection` (Attributes) Hotlink protection enables you to control which hostnames/domains can link to and access your content directly (see [below for nested schema](#nestedatt--cdns--hotlink_protection))
- `https_redirect` (Attributes) If enabled, all requests via HTTP are redirected to HTTPS. Verify HTTPS availability of CNAMEs before activating, if applicable. (see [below for nested schema](#nestedatt--cdns--https_redirect))
- `id` (Number) ID of the CDN. This is also used as the CDN URL
- `ip_protection` (Attributes) IP protection enables you to control which networks can access your content directly (see [below for nested schema](#nestedatt--cdns--ip_protection))
- `label` (String) The label helps you to identify your CDN
- `mp4_pseudo_streaming_enabled` (Boolean) Turn this option on if using a flash-based video player with MP4 files. Pseudo-streaming is used mainly in flash players. HTML5 players use range-requests. When enabled the "query_string" option must be set to ignore all parameters.
- `note` (String) Optional note
- `origin_headers` (Map of String) Custom HTTP headers included in requests sent to the origin server
- `origin_id` (String) ID (UUID) of attached Origin (content source for CDN)
- `query_string` (Attributes) Enabling this feature will ignore the query string, allowing URLs with query strings to cache properly. This is particularly useful if you tag your URLs with tracking/marketing parameters, for example. (see [below for nested schema](#nestedatt--cdns--query_string))
- `rate_limit_enabled` (Boolean) When enabled, this feature limits the data transfer rate by setting "limit_rate" based on the "rs" URL parameter and "limit_rate_after" by the value from the "ri" URL parameter.
- `secure_token` (Attributes) This feature allows you to serve your content using signed URLs. You can enable your users to download secured content from the CDN with a valid hash. Note: When you check this option, make sure to generate secured links to access your content. (see [below for nested schema](#nestedatt--cdns--secure_token))
- `ssl` (Attributes) (see [below for nested schema](#nestedatt--cdns--ssl))
- `stream` (Attributes) Detail parameters of stream CDN (see [below for nested schema](#nestedatt--cdns--stream))
- `url` (String) URL of the CDN. Automatically generated when the CDN is created. The number is the same as the CDN ID.
- `waf_enabled` (Boolean) Protect your website against XSS, SQL injection and more with our SmartWAF. We're using OWASP Core Rule Set (CRS) to protect your data against the most exploited vulnerabilities.

<a id="nestedatt--cdns--cache"></a>
### Nested Schema for `cdns.cache`

Read-Only:

- `max_age` (Number) In minutes
- `max_age_404` (Number) In seconds
- `requests_with_cookies_enabled` (Boolean) When disabled, requests with cookies will ignore changing cookie headers allowing all requests to hit the cache. When enabled, requests with cookies will be handled separately, so when the cookie changes it will not hit the previously cached request with different cookie options.


<a id="nestedatt--cdns--geo_protection"></a>
### Nested Schema for `cdns.geo_protection`

Read-Only:

- `countries` (Set of String) We are using ISO 3166-1 alpha-2 code
- `type` (String) With "type": "blocklist" all countries set in the "countries" parameter are not allowed. With "type": "passlist" only countries set in the "countries" parameter are allowed.


<a id="nestedatt--cdns--headers"></a>
### Nested Schema for `cdns.headers`

Read-Only:

- `content_disposition_type` (String) When the "type" is set to "parameter" the Content-Disposition is defined by the "cd" parameter in the URL, often set to "attachment". The filename is specified using the "fn" parameter in the URL.
- `cors_enabled` (Boolean) The "Access-Control-Allow-Origin:" response header will always act in accordance with the "Origin:" request header sent by the client. For example, a request including the HTTP header "Origin: https://www.cdn77.com" will translate to the response header "Access-Control-Allow-Origin: https://www.cdn77.com". Files remain cached while the request/response header changes.
- `cors_timing_enabled` (Boolean) When enabled "Timing-Allow-Origin" CORS header is set
- `cors_wildcard_enabled` (Boolean) When enabled the wildcard value (*) is set in CORS headers
- `host_header_forwarding_enabled` (Boolean) When fetching the content from the origin server, our edge servers will pass the host header that was included in the request between the user and our edge server.


<a id="nestedatt--cdns--hotlink_protection"></a>
### Nested Schema for `cdns.hotlink_protection`

Read-Only:

- `domains` (Set of String)
- `empty_referer_denied` (Boolean) Enabling this parameter prevents your content from being directly accessed by sources that send empty referrers.
- `type` (String) With "type": "blocklist" all domains set in the "domains" parameter are not allowed. With "type": "passlist" only domains in "domains" parameter are allowed.


<a id="nestedatt--cdns--https_redirect"></a>
### Nested Schema for `cdns.https_redirect`

Read-Only:

- `code` (Number) 301 for permanent redirect and 302 for temporary redirect. If you are not sure, select the default 301 code.
- `enabled` (Boolean)


<a id="nestedatt--cdns--ip_protection"></a>
### Nested Schema for `cdns.ip_protection`

Read-Only:

- `ips` (Set of String)
- `type` (String) With "type": "blocklist" all IP addresses set in the "ips" parameter are not allowed. With "type": "passlist" only IP addresses in "ips" parameter are allowed.


<a id="nestedatt--cdns--query_string"></a>
### Nested Schema for `cdns.query_string`

Read-Only:

- `ignore_type` (String)
- `parameters` (Set of String) List of parameters used when "ignore_type" is set to "list"


<a id="nestedatt--cdns--secure_token"></a>
### Nested Schema for `cdns.secure_token`

Read-Only:

- `token` (String, Sensitive) Token length is between 8 and 64 characters.
- `type` (String) <ul>
<li>parameter - Token will be in the query string - e.g.: /video.mp4?secure=MY_SECURE_TOKEN.</li>
<li>path - Token will be in the path - e.g.: /MY_SECURE_TOKEN/video.mp4.</li>
<li>none - Use to disable secure token.</li>
<li>highwinds</li>
</ul>


<a id="nestedatt--cdns--ssl"></a>
### Nested Schema for `cdns.ssl`

Read-Only:

- `ssl_id` (String) ID (UUID) of the SSL certificate
- `type` (String) Possible values: instantSsl, none, SNI


<a id="nestedatt--cdns--stream"></a>
### Nested Schema for `cdns.stream`

Read-Only:

- `origin_url` (String)
- `password` (String, Sensitive)
- `path` (String)
- `port` (Number)
- `protocol` (String)
- `query_key` (String)
17 changes: 13 additions & 4 deletions docs/data-sources/object_storages.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,17 @@ Object Storages data source allows you to read all available Object Storage clus

Read-Only:

- `host` (String)
- `id` (String) ID (UUID) of the Object Storage cluster
- `label` (String)
- `port` (Number)
- `scheme` (String)
- `label` (String) Label of the Object Storage cluster
- `url` (String) Absolute URL of this resource. Alternative to the attribute "url_parts".
- `url_parts` (Attributes) Set of attributes describing the resource URL. Alternative to the attribute "url". (see [below for nested schema](#nestedatt--clusters--url_parts))

<a id="nestedatt--clusters--url_parts"></a>
### Nested Schema for `clusters.url_parts`

Read-Only:

- `base_path` (String) Path to the directory where the content is stored
- `host` (String) Network host; can be a domain name or an IP address
- `port` (Number) Port number between 1 and 65535 (if not specified, default scheme port is used)
- `scheme` (String) URL scheme; can be either "http" or "https"
45 changes: 0 additions & 45 deletions docs/data-sources/origin.md

This file was deleted.

46 changes: 46 additions & 0 deletions docs/data-sources/origin_aws.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "cdn77_origin_aws Data Source - terraform-provider-cdn77"
subcategory: ""
description: |-
AWS Origin resource allows you to manage your AWS Origins
---

# cdn77_origin_aws (Data Source)

AWS Origin resource allows you to manage your AWS Origins

## Example Usage

```terraform
data "cdn77_origin_aws" "example" {
id = "4cd2378b-dec8-49e2-aa17-bf7561452998"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `id` (String) Origin ID (UUID)

### Read-Only

- `access_key_id` (String) AWS access key ID
- `access_key_secret` (String, Sensitive) AWS access key secret
- `label` (String) The label helps you to identify your Origin
- `note` (String) Optional note for the Origin
- `region` (String) AWS region
- `url` (String) Absolute URL of this resource. Alternative to the attribute "url_parts".
- `url_parts` (Attributes) Set of attributes describing the resource URL. Alternative to the attribute "url". (see [below for nested schema](#nestedatt--url_parts))

<a id="nestedatt--url_parts"></a>
### Nested Schema for `url_parts`

Read-Only:

- `base_path` (String) Path to the directory where the content is stored
- `host` (String) Network host; can be a domain name or an IP address
- `port` (Number) Port number between 1 and 65535 (if not specified, default scheme port is used)
- `scheme` (String) URL scheme; can be either "http" or "https"
58 changes: 58 additions & 0 deletions docs/data-sources/origin_object_storage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "cdn77_origin_object_storage Data Source - terraform-provider-cdn77"
subcategory: ""
description: |-
Object Storage Origin resource allows you to manage your Object Storage Origins
---

# cdn77_origin_object_storage (Data Source)

Object Storage Origin resource allows you to manage your Object Storage Origins

## Example Usage

```terraform
data "cdn77_origin_object_storage" "example" {
id = "b2d6a7df-18df-4931-8c78-3842bc6e12f0"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `id` (String) Origin ID (UUID)

### Read-Only

- `access_key_id` (String) Access key to your Object Storage bucket
- `access_key_secret` (String, Sensitive) Access secret to your Object Storage bucket
- `acl` (String) Object Storage access key ACL
- `bucket_name` (String) Name of your Object Storage bucket
- `cluster_id` (String) ID of the Object Storage storage cluster
- `label` (String) The label helps you to identify your Origin
- `note` (String) Optional note for the Origin
- `url` (String) Absolute URL of this resource. Alternative to the attribute "url_parts".
- `url_parts` (Attributes) Set of attributes describing the resource URL. Alternative to the attribute "url". (see [below for nested schema](#nestedatt--url_parts))
- `usage` (Attributes) Usage statistics of the Object Storage bucket (see [below for nested schema](#nestedatt--usage))

<a id="nestedatt--url_parts"></a>
### Nested Schema for `url_parts`

Read-Only:

- `base_path` (String) Path to the directory where the content is stored
- `host` (String) Network host; can be a domain name or an IP address
- `port` (Number) Port number between 1 and 65535 (if not specified, default scheme port is used)
- `scheme` (String) URL scheme; can be either "http" or "https"


<a id="nestedatt--usage"></a>
### Nested Schema for `usage`

Read-Only:

- `files` (Number) Number of files stored on the Object Storage bucket
- `size_bytes` (Number) Total size of the Object Storage bucket in bytes
Loading