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

support ssl parameter in dds instance resource #343

Merged
merged 2 commits into from
Jun 16, 2020
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 go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
15 changes: 15 additions & 0 deletions huaweicloud/resource_huaweicloud_dds_instance_v3.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions huaweicloud/resource_huaweicloud_dds_instance_v3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
),
},
},
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion website/docs/r/dds_instance_v3.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
* `status` - Indicates the the DB instance status