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

Updated cdn sdk and some fixes #40

Merged
merged 3 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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: 0 additions & 2 deletions docs/data-sources/floatingip.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,3 @@ Read-Only:
- `key` (String)
- `read_only` (Boolean)
- `value` (String)


2 changes: 0 additions & 2 deletions docs/data-sources/image.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,3 @@ Read-Only:
- `key` (String)
- `read_only` (Boolean)
- `value` (String)


2 changes: 0 additions & 2 deletions docs/data-sources/instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,3 @@ Read-Only:

- `delete_on_termination` (Boolean)
- `volume_id` (String)


2 changes: 0 additions & 2 deletions docs/data-sources/k8s.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,3 @@ Read-Only:
- `node_count` (Number)
- `stack_id` (String)
- `uuid` (String)


2 changes: 0 additions & 2 deletions docs/data-sources/k8s_client_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,3 @@ data "edgecenter_k8s_client_config" "cfg" {
- `client_certificate_data` (String) The client_certificate_data field from k8s config.
- `client_key_data` (String) The client_key_data field from k8s config.
- `id` (String) The ID of this resource.


2 changes: 0 additions & 2 deletions docs/data-sources/k8s_pool.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,3 @@ data "edgecenter_k8s_pool" "pool" {
- `node_count` (Number) The current number of nodes in the pool.
- `node_names` (List of String) A list of names of nodes within the pool.
- `stack_id` (String) The identifier of the underlying infrastructure stack used by this pool.


2 changes: 0 additions & 2 deletions docs/data-sources/lblistener.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,3 @@ output "view" {
- `protocol` (String) Available values is 'HTTP', 'HTTPS', 'TCP', 'UDP'
- `protocol_port` (Number) The port on which the protocol is bound.
- `provisioning_status` (String) The current provisioning status of the load balancer.


2 changes: 0 additions & 2 deletions docs/data-sources/lbpool.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,3 @@ Read-Only:
- `persistence_granularity` (String)
- `persistence_timeout` (Number)
- `type` (String)


2 changes: 0 additions & 2 deletions docs/data-sources/loadbalancer.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,3 @@ Read-Only:
- `key` (String)
- `read_only` (Boolean)
- `value` (String)


2 changes: 0 additions & 2 deletions docs/data-sources/loadbalancerv2.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,3 @@ Read-Only:
- `key` (String)
- `read_only` (Boolean)
- `value` (String)


2 changes: 0 additions & 2 deletions docs/data-sources/network.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,3 @@ Read-Only:

- `destination` (String)
- `nexthop` (String)


2 changes: 0 additions & 2 deletions docs/data-sources/project.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,3 @@ data "edgecenter_project" "pr" {
### Read-Only

- `id` (String) The ID of this resource.


2 changes: 0 additions & 2 deletions docs/data-sources/region.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,3 @@ data "edgecenter_region" "rg" {
### Read-Only

- `id` (String) The ID of this resource.


2 changes: 0 additions & 2 deletions docs/data-sources/reservedfixedip.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,3 @@ Read-Only:

- `ip_address` (String)
- `mac_address` (String)


2 changes: 0 additions & 2 deletions docs/data-sources/router.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,3 @@ Read-Only:

- `destination` (String)
- `nexthop` (String)


2 changes: 0 additions & 2 deletions docs/data-sources/secret.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,3 @@ output "view" {
- `id` (String) The ID of this resource.
- `mode` (String) The mode of the encryption algorithm.
- `status` (String) The current status of the secret.


2 changes: 0 additions & 2 deletions docs/data-sources/securitygroup.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,3 @@ Read-Only:
- `protocol` (String)
- `remote_ip_prefix` (String)
- `updated_at` (String)


2 changes: 0 additions & 2 deletions docs/data-sources/servergroup.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,3 @@ Read-Only:

- `instance_id` (String)
- `instance_name` (String)


2 changes: 0 additions & 2 deletions docs/data-sources/storage_s3.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,3 @@ data "edgecenter_storage_s3" "example_s3" {
- `generated_s3_endpoint` (String) A s3 endpoint for new storage resource.
- `id` (String) The ID of this resource.
- `location` (String) A location of new storage resource. One of (s-dt2)


2 changes: 0 additions & 2 deletions docs/data-sources/storage_s3_bucket.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,3 @@ data "edgecenter_storage_s3_bucket" "example_s3_bucket" {
### Read-Only

- `id` (String) The ID of this resource.


2 changes: 0 additions & 2 deletions docs/data-sources/subnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,3 @@ Read-Only:
- `key` (String)
- `read_only` (Boolean)
- `value` (String)


2 changes: 0 additions & 2 deletions docs/data-sources/volume.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,3 @@ Read-Only:
- `key` (String)
- `read_only` (Boolean)
- `value` (String)


2 changes: 0 additions & 2 deletions docs/resources/cdn_origingroup.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,3 @@ Optional:
Read-Only:

- `id` (Number) The ID of this resource.


4 changes: 2 additions & 2 deletions docs/resources/cdn_resource.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ resource "edgecenter_cdn_resource" "cdn_example_com" {
### Read-Only

- `id` (String) The ID of this resource.
- `ssl_le_enabled` (Boolean)
- `status` (String) Status of a CDN resource content availability. Possible values are: Active, Suspended, Processed.

<a id="nestedblock--options"></a>
Expand Down Expand Up @@ -247,6 +248,7 @@ Required:
Optional:

- `enabled` (Boolean)
- `use_host` (Boolean)


<a id="nestedblock--options--force_return"></a>
Expand Down Expand Up @@ -618,5 +620,3 @@ Required:
Optional:

- `enabled` (Boolean)


3 changes: 1 addition & 2 deletions docs/resources/cdn_rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ Required:
Optional:

- `enabled` (Boolean)
- `use_host` (Boolean)


<a id="nestedblock--options--force_return"></a>
Expand Down Expand Up @@ -607,5 +608,3 @@ Required:
Optional:

- `enabled` (Boolean)


2 changes: 0 additions & 2 deletions docs/resources/cdn_sslcert.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,3 @@ resource "edgecenter_cdn_sslcert" "cdnopt_cert" {
- `automated` (Boolean) The way SSL certificate was issued.
- `has_related_resources` (Boolean) It shows if the SSL certificate is used by a CDN resource.
- `id` (String) The ID of this resource.


2 changes: 0 additions & 2 deletions docs/resources/keypair.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,3 @@ output "kp" {
- `fingerprint` (String) A fingerprint of the SSH public key, used to verify the integrity of the key.
- `id` (String) The ID of this resource.
- `sshkey_id` (String) The unique identifier assigned by the provider to the SSH key pair.


2 changes: 0 additions & 2 deletions docs/resources/storage_s3.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,3 @@ resource "edgecenter_storage_s3" "example_s3" {
### Read-Only

- `id` (String) The ID of this resource.


2 changes: 0 additions & 2 deletions docs/resources/storage_s3_bucket.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,3 @@ resource "edgecenter_storage_s3_bucket" "example_s3_bucket" {
### Read-Only

- `id` (String) The ID of this resource.


15 changes: 15 additions & 0 deletions edgecenter/resource_edgecenter_cdn_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ var resourceOptionsSchema = &schema.Schema{
Required: true,
Description: "",
},
"use_host": {
Type: schema.TypeBool,
Computed: true,
Optional: true,
},
},
},
},
Expand Down Expand Up @@ -996,6 +1001,7 @@ func resourceCDNResource() *schema.Resource {
"ssl_automated": {
Type: schema.TypeBool,
Optional: true,
Computed: true,
Description: "generate LE certificate automatically.",
},
"issue_le_cert": {
Expand All @@ -1015,6 +1021,13 @@ func resourceCDNResource() *schema.Resource {
Computed: true,
Description: "Status of a CDN resource content availability. Possible values are: Active, Suspended, Processed.",
},
"ssl_le_enabled": {
Type: schema.TypeBool,
Required: false,
Optional: false,
strelkov-a marked this conversation as resolved.
Show resolved Hide resolved
Computed: true,
Description: "",
},
"options": resourceOptionsSchema,
},
CreateContext: resourceCDNResourceCreate,
Expand Down Expand Up @@ -1089,6 +1102,7 @@ func resourceCDNResourceRead(ctx context.Context, d *schema.ResourceData, m inte
d.Set("ssl_automated", result.SSLAutomated)
d.Set("status", result.Status)
d.Set("active", result.Active)
d.Set("ssl_le_enabled", result.SSLLEEnabled)
if err := d.Set("options", resourceOptionsToList(result.Options)); err != nil {
return diag.FromErr(err)
}
Expand Down Expand Up @@ -1237,6 +1251,7 @@ func listToResourceOptions(l []interface{}) *cdn.ResourceOptions {
if opt, ok := getOptByName(fields, "follow_origin_redirect"); ok {
opts.FollowOriginRedirect = &cdn.FollowOriginRedirect{
Enabled: opt["enabled"].(bool),
UseHost: opt["use_host"].(bool),
}
for _, v := range opt["codes"].(*schema.Set).List() {
opts.FollowOriginRedirect.Codes = append(opts.FollowOriginRedirect.Codes, v.(int))
Expand Down
6 changes: 6 additions & 0 deletions edgecenter/resource_edgecenter_cdn_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ var locationOptionsSchema = &schema.Schema{
Required: true,
Description: "",
},
"use_host": {
Type: schema.TypeBool,
Computed: true,
Optional: true,
},
},
},
},
Expand Down Expand Up @@ -1148,6 +1153,7 @@ func listToLocationOptions(l []interface{}) *cdn.LocationOptions {
if opt, ok := getOptByName(fields, "follow_origin_redirect"); ok {
opts.FollowOriginRedirect = &cdn.FollowOriginRedirect{
Enabled: opt["enabled"].(bool),
UseHost: opt["use_host"].(bool),
}
for _, v := range opt["codes"].(*schema.Set).List() {
opts.FollowOriginRedirect.Codes = append(opts.FollowOriginRedirect.Codes, v.(int))
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/AlekSi/pointer v1.2.0
github.com/Edge-Center/edgecenter-dns-sdk-go v0.1.0
github.com/Edge-Center/edgecenter-storage-sdk-go v0.2.0
github.com/Edge-Center/edgecentercdn-go v0.1.4
github.com/Edge-Center/edgecentercdn-go v0.1.5
github.com/Edge-Center/edgecentercloud-go v0.1.11
github.com/hashicorp/go-cty v1.4.1-0.20200723130312-85980079f637
github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ github.com/Edge-Center/edgecenter-dns-sdk-go v0.1.0 h1:MDQr/60IhD1x7f5Bs20ljTQXG
github.com/Edge-Center/edgecenter-dns-sdk-go v0.1.0/go.mod h1:xWN2LYVokamADMRz1cPhOrYX/NlxiDJp9tjBumHU5G8=
github.com/Edge-Center/edgecenter-storage-sdk-go v0.2.0 h1:1aPDpywWbaF7VEjP/GjVoSgcipxWTTzEPPZv5kOWE8A=
github.com/Edge-Center/edgecenter-storage-sdk-go v0.2.0/go.mod h1:TcWO0BPvDsE6AGlPBqpKCZhoQ70rRlqmm85J32qcL8I=
github.com/Edge-Center/edgecentercdn-go v0.1.4 h1:Jt8f+CSriwVQ/KAb+a+v1dDNChtHjlpilgJOX8mOSx0=
github.com/Edge-Center/edgecentercdn-go v0.1.4/go.mod h1:RwEyxwPAmxor1mZKUTa2bIU2p5qM6kcAofUkaE4O1V4=
github.com/Edge-Center/edgecentercdn-go v0.1.5 h1:142aCMrAngvrlLSHyyPM4ZCztcvdRt4xC/Y3//AG+RA=
github.com/Edge-Center/edgecentercdn-go v0.1.5/go.mod h1:RwEyxwPAmxor1mZKUTa2bIU2p5qM6kcAofUkaE4O1V4=
github.com/Edge-Center/edgecentercloud-go v0.1.11 h1:00h5o/71lEoSdU1B4AWmviuOfO28P6nsRP+afjIsW80=
github.com/Edge-Center/edgecentercloud-go v0.1.11/go.mod h1:kmXGtx0lL1ib+SPfJe/uIAyDHamquAvqiftoLSyhxF8=
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
Expand Down