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

[DMS]: Enable encryption for resource/opentelekomcloud_dms_instance_v2 #2280

Merged
merged 3 commits into from Aug 24, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/resources/dms_instance_v2.md
Expand Up @@ -195,6 +195,10 @@ The following arguments are supported:
* Provided ip amount should be same as amount of DMS cluster nodes.
* Example: `["0f2a51dc-93ce-42af","d967d49b-6659-4052","002872f4-82a4-4f6e-9a4e"]`.

* `disk_encrypted_enable` - (Optional) - Indicates whether disk encryption is enabled.

* `disk_encrypted_key` - (Optional) - Disk encryption key. If disk encryption is not enabled, this parameter is left blank.

* `tags` - (Optional) Tags key/value pairs to associate with the instance.

## Attributes Reference
Expand Down
Expand Up @@ -159,20 +159,19 @@ func ResourceDmsInstancesV2() *schema.Resource {
"produce_reject", "time_base",
}, false),
},
// Not supported on current version
// "disk_encrypted_enable": {
// Type: schema.TypeBool,
// Optional: true,
// Computed: true,
// ForceNew: true,
// },
// "disk_encrypted_key": {
// Type: schema.TypeString,
// Optional: true,
// Computed: true,
// ForceNew: true,
// RequiredWith: []string{"disk_encrypted_enable"},
// },
"disk_encrypted_enable": {
Type: schema.TypeBool,
Optional: true,
Computed: true,
ForceNew: true,
},
"disk_encrypted_key": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
RequiredWith: []string{"disk_encrypted_enable"},
},
"specification": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -310,11 +309,11 @@ func resourceDmsInstancesV2Create(ctx context.Context, d *schema.ResourceData, m
createOpts.PublicIpID = strings.Join(ipList, ",")
}

// if d.Get("disk_encrypted_enable").(bool) {
// diskEncryptedEnable := true
// createOpts.DiskEncryptedEnable = &diskEncryptedEnable
// createOpts.DiskEncryptedKey = d.Get("disk_encrypted_key").(string)
// }
if d.Get("disk_encrypted_enable").(bool) {
diskEncryptedEnable := true
createOpts.DiskEncryptedEnable = &diskEncryptedEnable
createOpts.DiskEncryptedKey = d.Get("disk_encrypted_key").(string)
}

log.Printf("[DEBUG] Create Options: %#v", createOpts)
v, err := instances.Create(client, createOpts)
Expand Down Expand Up @@ -396,8 +395,8 @@ func resourceDmsInstancesV2Read(_ context.Context, d *schema.ResourceData, meta
d.Set("public_connect_address", flattenPublicIps(v.PublicConnectionAddress)),
d.Set("public_bandwidth", v.PublicBandWidth),
d.Set("ssl_enable", v.SslEnable),
// d.Set("disk_encrypted_enable", v.DiskEncrypted),
// d.Set("disk_encrypted_key", v.DiskEncryptedKey),
d.Set("disk_encrypted_enable", v.DiskEncrypted),
d.Set("disk_encrypted_key", v.DiskEncryptedKey),
d.Set("subnet_cidr", v.SubnetCIDR),
d.Set("total_storage_space", v.TotalStorageSpace),
d.Set("storage_resource_id", v.StorageResourceID),
Expand Down
4 changes: 4 additions & 0 deletions releasenotes/notes/dms_encrypted-e04c3be9a2bd3474.yaml
@@ -0,0 +1,4 @@
---
enhancements:
- |
**[DMS]** Add encryption for ``resource/opentelekomcloud_dms_instance_v2`` (`#2280 <https://github.com/opentelekomcloud/terraform-provider-opentelekomcloud/pull/2280>`_)