diff --git a/go.mod b/go.mod index 36b5369922..2c93805fd5 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ require ( github.com/hashicorp/errwrap v1.0.0 github.com/hashicorp/go-cleanhttp v0.5.1 github.com/hashicorp/terraform-plugin-sdk v1.13.0 - github.com/huaweicloud/golangsdk v0.0.0-20200522103936-0f79f7190275 + github.com/huaweicloud/golangsdk v0.0.0-20200615044122-296c30220a0c github.com/jen20/awspolicyequivalence v0.0.0-20170831201602-3d48364a137a github.com/mitchellh/go-homedir v1.1.0 github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa // indirect diff --git a/go.sum b/go.sum index fd3697a531..2bbd845c47 100644 --- a/go.sum +++ b/go.sum @@ -131,6 +131,8 @@ github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1 github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= github.com/huaweicloud/golangsdk v0.0.0-20200522103936-0f79f7190275 h1:t5rC0iUHFANQq0LiXGiGYi3qk7dR8Dmnmh90+bIc+zQ= github.com/huaweicloud/golangsdk v0.0.0-20200522103936-0f79f7190275/go.mod h1:WQBcHRNX9shz3928lWEvstQJtAtYI7ks6XlgtRT9Tcw= +github.com/huaweicloud/golangsdk v0.0.0-20200615044122-296c30220a0c h1:VLEty8RjU2HSe2/onDr/JdhBHNQlac0/NOc0xs5Xr/o= +github.com/huaweicloud/golangsdk v0.0.0-20200615044122-296c30220a0c/go.mod h1:WQBcHRNX9shz3928lWEvstQJtAtYI7ks6XlgtRT9Tcw= github.com/jen20/awspolicyequivalence v0.0.0-20170831201602-3d48364a137a h1:FyS/ubzBR5xJlnJGRTwe7GUHpJOR4ukYK3y+LFNffuA= github.com/jen20/awspolicyequivalence v0.0.0-20170831201602-3d48364a137a/go.mod h1:uoIMjNxUfXi48Ci40IXkPRbghZ1vbti6v9LCbNqRgHY= github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/huaweicloud/resource_huaweicloud_dds_instance_v3.go b/huaweicloud/resource_huaweicloud_dds_instance_v3.go index af30bd16db..3133c2668e 100644 --- a/huaweicloud/resource_huaweicloud_dds_instance_v3.go +++ b/huaweicloud/resource_huaweicloud_dds_instance_v3.go @@ -167,6 +167,12 @@ func resourceDdsInstanceV3() *schema.Resource { }, }, }, + "ssl": { + Type: schema.TypeBool, + Optional: true, + ForceNew: true, + Default: true, + }, "db_username": { Type: schema.TypeString, Computed: true, @@ -271,6 +277,9 @@ func resourceDdsInstanceV3Create(d *schema.ResourceData, meta interface{}) error Flavor: resourceDdsFlavors(d), BackupStrategy: resourceDdsBackupStrategy(d), } + if ssl := d.Get("ssl").(bool); !ssl { + createOpts.Ssl = "0" + } log.Printf("[DEBUG] Create Options: %#v", createOpts) instance, err := instances.Create(client, createOpts).Extract() @@ -336,6 +345,12 @@ func resourceDdsInstanceV3Read(d *schema.ResourceData, meta interface{}) error { d.Set("db_username", instance.DbUserName) d.Set("status", instance.Status) + sslEnable := true + if instance.Ssl == 0 { + sslEnable = false + } + d.Set("ssl", sslEnable) + datastoreList := make([]map[string]interface{}, 0, 1) datastore := map[string]interface{}{ "type": instance.DataStore.Type, diff --git a/huaweicloud/resource_huaweicloud_dds_instance_v3_test.go b/huaweicloud/resource_huaweicloud_dds_instance_v3_test.go index fae7ccf8c0..f270488147 100644 --- a/huaweicloud/resource_huaweicloud_dds_instance_v3_test.go +++ b/huaweicloud/resource_huaweicloud_dds_instance_v3_test.go @@ -23,6 +23,8 @@ func TestAccDDSV3Instance_basic(t *testing.T) { testAccCheckDDSV3InstanceExists("huaweicloud_dds_instance_v3.instance", &instance), resource.TestCheckResourceAttr( "huaweicloud_dds_instance_v3.instance", "name", "dds-instance"), + resource.TestCheckResourceAttr( + "huaweicloud_dds_instance_v3.instance", "ssl", "true"), ), }, }, diff --git a/vendor/github.com/huaweicloud/golangsdk/openstack/cce/v3/nodes/results.go b/vendor/github.com/huaweicloud/golangsdk/openstack/cce/v3/nodes/results.go index baff4d9b4a..ebcc8ab18a 100644 --- a/vendor/github.com/huaweicloud/golangsdk/openstack/cce/v3/nodes/results.go +++ b/vendor/github.com/huaweicloud/golangsdk/openstack/cce/v3/nodes/results.go @@ -2,6 +2,7 @@ package nodes import ( "github.com/huaweicloud/golangsdk" + "github.com/huaweicloud/golangsdk/openstack/common/tags" ) //Describes the Node Structure of cluster @@ -40,7 +41,7 @@ type Metadata struct { Annotations map[string]string `json:"annotations,omitempty"` } -// Describes Nodes specification +// Spec describes Nodes specification type Spec struct { // Node specifications Flavor string `json:"flavor" required:"true"` @@ -48,6 +49,8 @@ type Spec struct { Az string `json:"az" required:"true"` // The OS of the node Os string `json:"os,omitempty"` + // ID of the dedicated host to which nodes will be scheduled + DedicatedHostID string `json:"dedicatedHostId,omitempty"` // Node login parameters Login LoginSpec `json:"login" required:"true"` // System disk parameter of the node @@ -64,6 +67,14 @@ type Spec struct { NodeNicSpec NodeNicSpec `json:"nodeNicSpec,omitempty"` // Extended parameter ExtendParam ExtendParam `json:"extendParam,omitempty"` + // UUID of an ECS group + EcsGroupID string `json:"ecsGroupId,omitempty"` + // Tag of a VM, key value pair format + UserTags []tags.ResourceTag `json:"userTags,omitempty"` + // Tag of a Kubernetes node, key value pair format + K8sTags map[string]string `json:"k8sTags,omitempty"` + // taints to created nodes to configure anti-affinity + Taints []TaintSpec `json:"taints,omitempty"` } // Gives the Nic spec of the node @@ -78,6 +89,14 @@ type PrimaryNic struct { SubnetId string `json:"subnetId,omitempty"` } +// TaintSpec to created nodes to configure anti-affinity +type TaintSpec struct { + Key string `json:"key" required:"true"` + Value string `json:"value" required:"true"` + // Available options are NoSchedule, PreferNoSchedule, and NoExecute + Effect string `json:"effect" required:"true"` +} + // Gives the current status of the node type Status struct { // The state of the Node diff --git a/vendor/github.com/huaweicloud/golangsdk/openstack/common/tags/urls.go b/vendor/github.com/huaweicloud/golangsdk/openstack/common/tags/urls.go index 54ba5e4afd..52d450c1c2 100644 --- a/vendor/github.com/huaweicloud/golangsdk/openstack/common/tags/urls.go +++ b/vendor/github.com/huaweicloud/golangsdk/openstack/common/tags/urls.go @@ -1,6 +1,8 @@ package tags import ( + "strings" + "github.com/huaweicloud/golangsdk" ) @@ -8,13 +10,33 @@ import ( // "DNS-public_zone", "DNS-private_zone", "DNS-ptr_record" // "DNS-public_recordset", "DNS-private_recordset" func actionURL(c *golangsdk.ServiceClient, resourceType, id string) string { + if hasProjectID(c) { + return c.ServiceURL(resourceType, id, "tags/action") + } return c.ServiceURL(c.ProjectID, resourceType, id, "tags/action") } func getURL(c *golangsdk.ServiceClient, resourceType, id string) string { + if hasProjectID(c) { + return c.ServiceURL(resourceType, id, "tags") + } return c.ServiceURL(c.ProjectID, resourceType, id, "tags") } func listURL(c *golangsdk.ServiceClient, resourceType string) string { + if hasProjectID(c) { + return c.ServiceURL(resourceType, "tags") + } return c.ServiceURL(c.ProjectID, resourceType, "tags") } + +func hasProjectID(c *golangsdk.ServiceClient) bool { + url := c.ResourceBaseURL() + array := strings.Split(url, "/") + + // the baseURL must be end with "/" + if array[len(array)-2] == c.ProjectID { + return true + } + return false +} diff --git a/vendor/github.com/huaweicloud/golangsdk/openstack/dds/v3/instances/requests.go b/vendor/github.com/huaweicloud/golangsdk/openstack/dds/v3/instances/requests.go index f97bac5369..4848fa0158 100644 --- a/vendor/github.com/huaweicloud/golangsdk/openstack/dds/v3/instances/requests.go +++ b/vendor/github.com/huaweicloud/golangsdk/openstack/dds/v3/instances/requests.go @@ -15,6 +15,7 @@ type CreateOpts struct { SecurityGroupId string `json:"security_group_id" required:"true"` Password string `json:"password" required:"true"` DiskEncryptionId string `json:"disk_encryption_id,omitempty"` + Ssl string `json:"ssl_option,omitempty"` Mode string `json:"mode" required:"true"` Flavor []Flavor `json:"flavor" required:"true"` BackupStrategy BackupStrategy `json:"backup_strategy,omitempty"` diff --git a/vendor/github.com/huaweicloud/golangsdk/openstack/dds/v3/instances/results.go b/vendor/github.com/huaweicloud/golangsdk/openstack/dds/v3/instances/results.go index c3b675dd2d..1c35912082 100644 --- a/vendor/github.com/huaweicloud/golangsdk/openstack/dds/v3/instances/results.go +++ b/vendor/github.com/huaweicloud/golangsdk/openstack/dds/v3/instances/results.go @@ -24,6 +24,7 @@ type Instance struct { SubnetId string `json:"subnet_id"` SecurityGroupId string `json:"security_group_id"` DiskEncryptionId string `json:"disk_encryption_id"` + Ssl string `json:"ssl_option"` Mode string `json:"mode"` Flavor []FlavorOpt `json:"flavor"` BackupStrategy BackupStrategyOpt `json:"backup_strategy"` diff --git a/vendor/modules.txt b/vendor/modules.txt index 694d21fd67..1f98322aa0 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -129,6 +129,7 @@ github.com/hashicorp/terraform-json # github.com/hashicorp/terraform-plugin-sdk v1.13.0 github.com/hashicorp/terraform-plugin-sdk/plugin github.com/hashicorp/terraform-plugin-sdk/helper/hashcode +github.com/hashicorp/terraform-plugin-sdk/helper/logging github.com/hashicorp/terraform-plugin-sdk/helper/mutexkv github.com/hashicorp/terraform-plugin-sdk/helper/pathorcontents github.com/hashicorp/terraform-plugin-sdk/helper/resource @@ -144,7 +145,6 @@ github.com/hashicorp/terraform-plugin-sdk/internal/providers github.com/hashicorp/terraform-plugin-sdk/internal/provisioners github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5 github.com/hashicorp/terraform-plugin-sdk/acctest -github.com/hashicorp/terraform-plugin-sdk/helper/logging github.com/hashicorp/terraform-plugin-sdk/internal/addrs github.com/hashicorp/terraform-plugin-sdk/internal/command/format github.com/hashicorp/terraform-plugin-sdk/internal/configs @@ -182,7 +182,7 @@ github.com/hashicorp/terraform-svchost github.com/hashicorp/terraform-svchost/auth # github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d github.com/hashicorp/yamux -# github.com/huaweicloud/golangsdk v0.0.0-20200522103936-0f79f7190275 +# github.com/huaweicloud/golangsdk v0.0.0-20200615044122-296c30220a0c github.com/huaweicloud/golangsdk github.com/huaweicloud/golangsdk/openstack github.com/huaweicloud/golangsdk/openstack/antiddos/v1/antiddos diff --git a/website/docs/r/dds_instance_v3.html.markdown b/website/docs/r/dds_instance_v3.html.markdown index a8572943a0..9d6983586f 100644 --- a/website/docs/r/dds_instance_v3.html.markdown +++ b/website/docs/r/dds_instance_v3.html.markdown @@ -117,6 +117,9 @@ The following arguments are supported: * `backup_strategy` - (Optional) Specifies the advanced backup policy. The structure is described below. Changing this creates a new instance. +* `ssl` - (Optional) Specifies whether to enable or disable SSL. Defaults to true. + Changing this creates a new instance. + The `datastore` block supports: * `type` - (Required) Specifies the DB engine. 'DDS-Community' and 'DDS-Enhanced' are supported. @@ -181,8 +184,9 @@ The following attributes are exported: * `security_group_id` - See Argument Reference above. * `password` - See Argument Reference above. * `disk_encryption_id` - See Argument Reference above. +* `ssl` - See Argument Reference above. * `mode` - See Argument Reference above. * `flavor` - See Argument Reference above. * `backup_strategy` - See Argument Reference above. * `db_username` - Indicates the DB Administator name. -* `status` - Indicates the the DB instance status \ No newline at end of file +* `status` - Indicates the the DB instance status