From a14308d9c0ac22e7cb7dca323abc86ac82a1fcd0 Mon Sep 17 00:00:00 2001 From: Aleksandr Strelkov Date: Tue, 9 Jan 2024 16:53:19 +0500 Subject: [PATCH 1/3] Updated CDN SDK and fixed some fields --- edgecenter/resource_edgecenter_cdn_resource.go | 15 +++++++++++++++ edgecenter/resource_edgecenter_cdn_rule.go | 6 ++++++ go.mod | 2 +- go.sum | 4 ++-- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/edgecenter/resource_edgecenter_cdn_resource.go b/edgecenter/resource_edgecenter_cdn_resource.go index da8633df..e8ce6074 100644 --- a/edgecenter/resource_edgecenter_cdn_resource.go +++ b/edgecenter/resource_edgecenter_cdn_resource.go @@ -253,6 +253,11 @@ var resourceOptionsSchema = &schema.Schema{ Required: true, Description: "", }, + "use_host": { + Type: schema.TypeBool, + Computed: true, + Optional: true, + }, }, }, }, @@ -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": { @@ -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, + Computed: true, + Description: "", + }, "options": resourceOptionsSchema, }, CreateContext: resourceCDNResourceCreate, @@ -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) } @@ -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)) diff --git a/edgecenter/resource_edgecenter_cdn_rule.go b/edgecenter/resource_edgecenter_cdn_rule.go index c20fc8ac..d584c2f1 100644 --- a/edgecenter/resource_edgecenter_cdn_rule.go +++ b/edgecenter/resource_edgecenter_cdn_rule.go @@ -253,6 +253,11 @@ var locationOptionsSchema = &schema.Schema{ Required: true, Description: "", }, + "use_host": { + Type: schema.TypeBool, + Computed: true, + Optional: true, + }, }, }, }, @@ -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)) diff --git a/go.mod b/go.mod index 456331a3..d1488e49 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 6041bcde..fc56ef43 100644 --- a/go.sum +++ b/go.sum @@ -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= From d8b43fdb156c4e238bd687f1db5701e779f7b9a4 Mon Sep 17 00:00:00 2001 From: Aleksandr Strelkov Date: Tue, 9 Jan 2024 17:15:23 +0500 Subject: [PATCH 2/3] Updated docs --- docs/data-sources/floatingip.md | 2 -- docs/data-sources/image.md | 2 -- docs/data-sources/instance.md | 2 -- docs/data-sources/k8s.md | 2 -- docs/data-sources/k8s_client_config.md | 2 -- docs/data-sources/k8s_pool.md | 2 -- docs/data-sources/lblistener.md | 2 -- docs/data-sources/lbpool.md | 2 -- docs/data-sources/loadbalancer.md | 2 -- docs/data-sources/loadbalancerv2.md | 2 -- docs/data-sources/network.md | 2 -- docs/data-sources/project.md | 2 -- docs/data-sources/region.md | 2 -- docs/data-sources/reservedfixedip.md | 2 -- docs/data-sources/router.md | 2 -- docs/data-sources/secret.md | 2 -- docs/data-sources/securitygroup.md | 2 -- docs/data-sources/servergroup.md | 2 -- docs/data-sources/storage_s3.md | 2 -- docs/data-sources/storage_s3_bucket.md | 2 -- docs/data-sources/subnet.md | 2 -- docs/data-sources/volume.md | 2 -- docs/resources/cdn_origingroup.md | 2 -- docs/resources/cdn_resource.md | 4 ++-- docs/resources/cdn_rule.md | 3 +-- docs/resources/cdn_sslcert.md | 2 -- docs/resources/keypair.md | 2 -- docs/resources/storage_s3.md | 2 -- docs/resources/storage_s3_bucket.md | 2 -- 29 files changed, 3 insertions(+), 58 deletions(-) diff --git a/docs/data-sources/floatingip.md b/docs/data-sources/floatingip.md index 91ae492b..0329c76d 100644 --- a/docs/data-sources/floatingip.md +++ b/docs/data-sources/floatingip.md @@ -71,5 +71,3 @@ Read-Only: - `key` (String) - `read_only` (Boolean) - `value` (String) - - diff --git a/docs/data-sources/image.md b/docs/data-sources/image.md index f2d62cfb..9168398d 100644 --- a/docs/data-sources/image.md +++ b/docs/data-sources/image.md @@ -71,5 +71,3 @@ Read-Only: - `key` (String) - `read_only` (Boolean) - `value` (String) - - diff --git a/docs/data-sources/instance.md b/docs/data-sources/instance.md index 88214e8c..40b153b3 100644 --- a/docs/data-sources/instance.md +++ b/docs/data-sources/instance.md @@ -116,5 +116,3 @@ Read-Only: - `delete_on_termination` (Boolean) - `volume_id` (String) - - diff --git a/docs/data-sources/k8s.md b/docs/data-sources/k8s.md index 52a56586..0e01f69c 100644 --- a/docs/data-sources/k8s.md +++ b/docs/data-sources/k8s.md @@ -82,5 +82,3 @@ Read-Only: - `node_count` (Number) - `stack_id` (String) - `uuid` (String) - - diff --git a/docs/data-sources/k8s_client_config.md b/docs/data-sources/k8s_client_config.md index 8ddf6775..ed26b094 100644 --- a/docs/data-sources/k8s_client_config.md +++ b/docs/data-sources/k8s_client_config.md @@ -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. - - diff --git a/docs/data-sources/k8s_pool.md b/docs/data-sources/k8s_pool.md index fa0f111b..0be95f9e 100644 --- a/docs/data-sources/k8s_pool.md +++ b/docs/data-sources/k8s_pool.md @@ -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. - - diff --git a/docs/data-sources/lblistener.md b/docs/data-sources/lblistener.md index b58b1fe2..2bd9a88a 100644 --- a/docs/data-sources/lblistener.md +++ b/docs/data-sources/lblistener.md @@ -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. - - diff --git a/docs/data-sources/lbpool.md b/docs/data-sources/lbpool.md index 3c0bc40d..91398b9b 100644 --- a/docs/data-sources/lbpool.md +++ b/docs/data-sources/lbpool.md @@ -87,5 +87,3 @@ Read-Only: - `persistence_granularity` (String) - `persistence_timeout` (Number) - `type` (String) - - diff --git a/docs/data-sources/loadbalancer.md b/docs/data-sources/loadbalancer.md index dc6a47f9..bc5d0be3 100644 --- a/docs/data-sources/loadbalancer.md +++ b/docs/data-sources/loadbalancer.md @@ -79,5 +79,3 @@ Read-Only: - `key` (String) - `read_only` (Boolean) - `value` (String) - - diff --git a/docs/data-sources/loadbalancerv2.md b/docs/data-sources/loadbalancerv2.md index 80488550..f600b504 100644 --- a/docs/data-sources/loadbalancerv2.md +++ b/docs/data-sources/loadbalancerv2.md @@ -67,5 +67,3 @@ Read-Only: - `key` (String) - `read_only` (Boolean) - `value` (String) - - diff --git a/docs/data-sources/network.md b/docs/data-sources/network.md index 29133f02..655b4a02 100644 --- a/docs/data-sources/network.md +++ b/docs/data-sources/network.md @@ -96,5 +96,3 @@ Read-Only: - `destination` (String) - `nexthop` (String) - - diff --git a/docs/data-sources/project.md b/docs/data-sources/project.md index e267efb9..514371f4 100644 --- a/docs/data-sources/project.md +++ b/docs/data-sources/project.md @@ -32,5 +32,3 @@ data "edgecenter_project" "pr" { ### Read-Only - `id` (String) The ID of this resource. - - diff --git a/docs/data-sources/region.md b/docs/data-sources/region.md index 0351bff3..63c21ed2 100644 --- a/docs/data-sources/region.md +++ b/docs/data-sources/region.md @@ -32,5 +32,3 @@ data "edgecenter_region" "rg" { ### Read-Only - `id` (String) The ID of this resource. - - diff --git a/docs/data-sources/reservedfixedip.md b/docs/data-sources/reservedfixedip.md index 9edae5a4..2f709163 100644 --- a/docs/data-sources/reservedfixedip.md +++ b/docs/data-sources/reservedfixedip.md @@ -67,5 +67,3 @@ Read-Only: - `ip_address` (String) - `mac_address` (String) - - diff --git a/docs/data-sources/router.md b/docs/data-sources/router.md index 43a0572e..6eb92ec9 100644 --- a/docs/data-sources/router.md +++ b/docs/data-sources/router.md @@ -97,5 +97,3 @@ Read-Only: - `destination` (String) - `nexthop` (String) - - diff --git a/docs/data-sources/secret.md b/docs/data-sources/secret.md index 4ee24d2e..961266f4 100644 --- a/docs/data-sources/secret.md +++ b/docs/data-sources/secret.md @@ -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. - - diff --git a/docs/data-sources/securitygroup.md b/docs/data-sources/securitygroup.md index 75610362..b485c147 100644 --- a/docs/data-sources/securitygroup.md +++ b/docs/data-sources/securitygroup.md @@ -84,5 +84,3 @@ Read-Only: - `protocol` (String) - `remote_ip_prefix` (String) - `updated_at` (String) - - diff --git a/docs/data-sources/servergroup.md b/docs/data-sources/servergroup.md index 4cbc4651..2deb5596 100644 --- a/docs/data-sources/servergroup.md +++ b/docs/data-sources/servergroup.md @@ -63,5 +63,3 @@ Read-Only: - `instance_id` (String) - `instance_name` (String) - - diff --git a/docs/data-sources/storage_s3.md b/docs/data-sources/storage_s3.md index 8e726c4a..5a545c12 100644 --- a/docs/data-sources/storage_s3.md +++ b/docs/data-sources/storage_s3.md @@ -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) - - diff --git a/docs/data-sources/storage_s3_bucket.md b/docs/data-sources/storage_s3_bucket.md index 08223c02..abf8402d 100644 --- a/docs/data-sources/storage_s3_bucket.md +++ b/docs/data-sources/storage_s3_bucket.md @@ -34,5 +34,3 @@ data "edgecenter_storage_s3_bucket" "example_s3_bucket" { ### Read-Only - `id` (String) The ID of this resource. - - diff --git a/docs/data-sources/subnet.md b/docs/data-sources/subnet.md index b7444fe3..12f2d7ce 100644 --- a/docs/data-sources/subnet.md +++ b/docs/data-sources/subnet.md @@ -81,5 +81,3 @@ Read-Only: - `key` (String) - `read_only` (Boolean) - `value` (String) - - diff --git a/docs/data-sources/volume.md b/docs/data-sources/volume.md index aa99d73f..bee7327d 100644 --- a/docs/data-sources/volume.md +++ b/docs/data-sources/volume.md @@ -69,5 +69,3 @@ Read-Only: - `key` (String) - `read_only` (Boolean) - `value` (String) - - diff --git a/docs/resources/cdn_origingroup.md b/docs/resources/cdn_origingroup.md index 17853aed..a49a6715 100644 --- a/docs/resources/cdn_origingroup.md +++ b/docs/resources/cdn_origingroup.md @@ -60,5 +60,3 @@ Optional: Read-Only: - `id` (Number) The ID of this resource. - - diff --git a/docs/resources/cdn_resource.md b/docs/resources/cdn_resource.md index 9ca6c652..3a0137a0 100644 --- a/docs/resources/cdn_resource.md +++ b/docs/resources/cdn_resource.md @@ -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. @@ -247,6 +248,7 @@ Required: Optional: - `enabled` (Boolean) +- `use_host` (Boolean) @@ -618,5 +620,3 @@ Required: Optional: - `enabled` (Boolean) - - diff --git a/docs/resources/cdn_rule.md b/docs/resources/cdn_rule.md index 3c1422bc..9071a99e 100644 --- a/docs/resources/cdn_rule.md +++ b/docs/resources/cdn_rule.md @@ -272,6 +272,7 @@ Required: Optional: - `enabled` (Boolean) +- `use_host` (Boolean) @@ -607,5 +608,3 @@ Required: Optional: - `enabled` (Boolean) - - diff --git a/docs/resources/cdn_sslcert.md b/docs/resources/cdn_sslcert.md index 0b909e6e..7910c836 100644 --- a/docs/resources/cdn_sslcert.md +++ b/docs/resources/cdn_sslcert.md @@ -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. - - diff --git a/docs/resources/keypair.md b/docs/resources/keypair.md index 74519a64..e38fb751 100644 --- a/docs/resources/keypair.md +++ b/docs/resources/keypair.md @@ -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. - - diff --git a/docs/resources/storage_s3.md b/docs/resources/storage_s3.md index 31a9e86d..48bd7436 100644 --- a/docs/resources/storage_s3.md +++ b/docs/resources/storage_s3.md @@ -44,5 +44,3 @@ resource "edgecenter_storage_s3" "example_s3" { ### Read-Only - `id` (String) The ID of this resource. - - diff --git a/docs/resources/storage_s3_bucket.md b/docs/resources/storage_s3_bucket.md index 436760c2..cc354c7a 100644 --- a/docs/resources/storage_s3_bucket.md +++ b/docs/resources/storage_s3_bucket.md @@ -34,5 +34,3 @@ resource "edgecenter_storage_s3_bucket" "example_s3_bucket" { ### Read-Only - `id` (String) The ID of this resource. - - From 435453ba1ad903c859386ce8d11a9fc6905dcfff Mon Sep 17 00:00:00 2001 From: Aleksandr Strelkov Date: Tue, 9 Jan 2024 23:09:13 +0500 Subject: [PATCH 3/3] Removed unnecessary params for ssl le enabled --- edgecenter/resource_edgecenter_cdn_resource.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/edgecenter/resource_edgecenter_cdn_resource.go b/edgecenter/resource_edgecenter_cdn_resource.go index e8ce6074..127b9096 100644 --- a/edgecenter/resource_edgecenter_cdn_resource.go +++ b/edgecenter/resource_edgecenter_cdn_resource.go @@ -1023,8 +1023,6 @@ func resourceCDNResource() *schema.Resource { }, "ssl_le_enabled": { Type: schema.TypeBool, - Required: false, - Optional: false, Computed: true, Description: "", },