This repository has been archived by the owner on Mar 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added support for basic cdn resources (#26)
* added support for basic cdn resources * apply terraform crud best practices * fixed tests
- Loading branch information
Showing
19 changed files
with
1,122 additions
and
17 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "gcore_cdn_origingroup Resource - terraform-provider-gcorelabs" | ||
subcategory: "" | ||
description: |- | ||
Represent origin group | ||
--- | ||
|
||
# gcore_cdn_origingroup (Resource) | ||
|
||
Represent origin group | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
provider gcore { | ||
user_name = "test" | ||
password = "test" | ||
gcore_platform = "https://api.gcdn.co" | ||
gcore_cdn_api = "https://api.gcdn.co" | ||
} | ||
resource "gcore_cdn_origingroup" "origin_group_1" { | ||
name = "origin_group_1" | ||
use_next = true | ||
origin { | ||
source = "example.com" | ||
enabled = false | ||
} | ||
origin { | ||
source = "mirror.example.com" | ||
enabled = true | ||
backup = true | ||
} | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- **name** (String) Name of the origin group | ||
- **origin** (Block Set, Min: 1) Contains information about all IP address or Domain names of your origin and the port if custom (see [below for nested schema](#nestedblock--origin)) | ||
- **use_next** (Boolean) This options have two possible values: true — The option is active. In case the origin responds with 4XX or 5XX codes, use the next origin from the list. false — The option is disabled. | ||
|
||
### Optional | ||
|
||
- **id** (String) The ID of this resource. | ||
|
||
<a id="nestedblock--origin"></a> | ||
### Nested Schema for `origin` | ||
|
||
Required: | ||
|
||
- **source** (String) IP address or Domain name of your origin and the port if custom | ||
|
||
Optional: | ||
|
||
- **backup** (Boolean) true — The option is active. The origin will not be used until one of active origins become unavailable. false — The option is disabled. | ||
- **enabled** (Boolean) The setting allows to enable or disable an Origin source in the Origins group | ||
|
||
Read-Only: | ||
|
||
- **id** (Number) The ID of this resource. | ||
|
||
|
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,53 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "gcore_cdn_resource Resource - terraform-provider-gcorelabs" | ||
subcategory: "" | ||
description: |- | ||
Represent cdn resource | ||
--- | ||
|
||
# gcore_cdn_resource (Resource) | ||
|
||
Represent cdn resource | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
provider gcore { | ||
user_name = "test" | ||
password = "test" | ||
gcore_platform = "https://api.gcdn.co" | ||
gcore_cdn_api = "https://api.gcdn.co" | ||
} | ||
resource "gcore_cdn_resource" "cdn_example_com" { | ||
cname = "cdn.example.com" | ||
origin_group = 11 | ||
origin_protocol = "MATCH" | ||
secondary_hostnames = ["cdn2.example.com"] | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- **cname** (String) A CNAME that will be used to deliver content though a CDN | ||
|
||
### Optional | ||
|
||
- **active** (Boolean) The setting allows to enable or disable a CDN Resource | ||
- **id** (String) The ID of this resource. | ||
- **origin** (String) A domain name or IP of your origin source. Specify a port if custom. You can use either 'origin' parameter or 'originGroup' in the resource definition. | ||
- **origin_group** (Number) ID of the Origins Group. Use one of your Origins Group or create a new one. You can use either 'origin' parameter or 'originGroup' in the resource definition. | ||
- **origin_protocol** (String) This option defines the protocol that will be used by CDN servers to request content from an origin source. If not specified, we will use HTTP to connect to an origin server. Possible values are: HTTPS, HTTP, MATCH. | ||
- **secondary_hostnames** (Set of String) List of additional CNAMEs. | ||
|
||
### Read-Only | ||
|
||
- **last_updated** (String) | ||
- **status** (String) Status of a CDN resource content availability. Possible values are: Active, Suspended, Processed. | ||
|
||
|
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,73 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "gcore_cdn_rule Resource - terraform-provider-gcorelabs" | ||
subcategory: "" | ||
description: |- | ||
Represent cdn resource rule | ||
--- | ||
|
||
# gcore_cdn_rule (Resource) | ||
|
||
Represent cdn resource rule | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
provider gcore { | ||
user_name = "test" | ||
password = "test" | ||
gcore_platform = "https://api.gcdn.co" | ||
gcore_cdn_api = "https://api.gcdn.co" | ||
} | ||
resource "gcore_cdn_origingroup" "origin_group_1" { | ||
name = "origin_group_1" | ||
use_next = true | ||
origin { | ||
source = "example.com" | ||
enabled = false | ||
} | ||
origin { | ||
source = "mirror.example.com" | ||
enabled = true | ||
backup = true | ||
} | ||
} | ||
resource "gcore_cdn_resource" "cdn_example_com" { | ||
cname = "cdn.example.com" | ||
origin_group = gcore_cdn_origingroup.origin_group_1.id | ||
origin_protocol = "MATCH" | ||
secondary_hostnames = ["cdn2.example.com"] | ||
} | ||
resource "gcore_cdn_rule" "cdn_example_com_rule_1" { | ||
resource_id = gcore_cdn_resource.cdn_example_com.id | ||
name = "All images" | ||
rule = "/folder/images/*.png" | ||
rule_type = 0 | ||
} | ||
resource "gcore_cdn_rule" "cdn_example_com_rule_2" { | ||
resource_id = gcore_cdn_resource.cdn_example_com.id | ||
name = "All scripts" | ||
rule = "/folder/images/*.js" | ||
rule_type = 0 | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- **name** (String) Rule name | ||
- **resource_id** (Number) | ||
- **rule** (String) A pattern that defines when the rule is triggered. By default, we add a leading forward slash to any rule pattern. Specify a pattern without a forward slash. | ||
- **rule_type** (Number) Type of rule. The rule is applied if the requested URI matches the rule pattern. It has two possible values: Type 0 — RegEx. Must start with '^/' or '/'. Type 1 — RegEx. Legacy type. Note that for this rule type we automatically add / to each rule pattern before your regular expression. Please use Type 0. | ||
|
||
### Optional | ||
|
||
- **id** (String) The ID of this resource. | ||
|
||
|
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,20 @@ | ||
provider gcore { | ||
user_name = "test" | ||
password = "test" | ||
gcore_platform = "https://api.gcdn.co" | ||
gcore_cdn_api = "https://api.gcdn.co" | ||
} | ||
|
||
resource "gcore_cdn_origingroup" "origin_group_1" { | ||
name = "origin_group_1" | ||
use_next = true | ||
origin { | ||
source = "example.com" | ||
enabled = false | ||
} | ||
origin { | ||
source = "mirror.example.com" | ||
enabled = true | ||
backup = true | ||
} | ||
} |
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,14 @@ | ||
provider gcore { | ||
user_name = "test" | ||
password = "test" | ||
gcore_platform = "https://api.gcdn.co" | ||
gcore_cdn_api = "https://api.gcdn.co" | ||
} | ||
|
||
|
||
resource "gcore_cdn_resource" "cdn_example_com" { | ||
cname = "cdn.example.com" | ||
origin_group = 11 | ||
origin_protocol = "MATCH" | ||
secondary_hostnames = ["cdn2.example.com"] | ||
} |
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,41 @@ | ||
provider gcore { | ||
user_name = "test" | ||
password = "test" | ||
gcore_platform = "https://api.gcdn.co" | ||
gcore_cdn_api = "https://api.gcdn.co" | ||
} | ||
|
||
resource "gcore_cdn_origingroup" "origin_group_1" { | ||
name = "origin_group_1" | ||
use_next = true | ||
origin { | ||
source = "example.com" | ||
enabled = false | ||
} | ||
origin { | ||
source = "mirror.example.com" | ||
enabled = true | ||
backup = true | ||
} | ||
} | ||
|
||
resource "gcore_cdn_resource" "cdn_example_com" { | ||
cname = "cdn.example.com" | ||
origin_group = gcore_cdn_origingroup.origin_group_1.id | ||
origin_protocol = "MATCH" | ||
secondary_hostnames = ["cdn2.example.com"] | ||
} | ||
|
||
resource "gcore_cdn_rule" "cdn_example_com_rule_1" { | ||
resource_id = gcore_cdn_resource.cdn_example_com.id | ||
name = "All images" | ||
rule = "/folder/images/*.png" | ||
rule_type = 0 | ||
} | ||
|
||
resource "gcore_cdn_rule" "cdn_example_com_rule_2" { | ||
resource_id = gcore_cdn_resource.cdn_example_com.id | ||
name = "All scripts" | ||
rule = "/folder/images/*.js" | ||
rule_type = 0 | ||
} |
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.