Skip to content

Commit c670322

Browse files
adding encrypt and cabailities to volume/instance (#611)
## 📝 Description **What does this PR do and why is this change necessary?** Add support for `capabilities` and `encryption` to GET linode and POST volume respectively. ## ✔️ How to Test **How do I run the relevant unit/integration tests?** ```bash make TEST_ARGS="volume_basic" test ``` ```bash make TEST_ARGS="instance_basic" test ```
1 parent 59c3e61 commit c670322

File tree

6 files changed

+19
-0
lines changed

6 files changed

+19
-0
lines changed

docs/modules/instance.md

+1
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ Manage Linode Instances, Configs, and Disks.
148148
| `migration_type` | <center>`str`</center> | <center>Optional</center> | The type of migration to use for Region and Type migrations. **(Choices: `cold`, `warm`; Default: `cold`)** |
149149
| `auto_disk_resize` | <center>`bool`</center> | <center>Optional</center> | Whether implicitly created disks should be resized during a type change operation. **(Default: `False`)** |
150150
| `tags` | <center>`list`</center> | <center>Optional</center> | An array of tags applied to this object. Tags are for organizational purposes only. **(Updatable)** |
151+
| `capabilities` | <center>`list`</center> | <center>Optional</center> | Read-only. A list of capabilities this compute instance supports. |
151152
| [`placement_group` (sub-options)](#placement_group) | <center>`dict`</center> | <center>Optional</center> | A Placement Group to create this Linode under. |
152153
| `disk_encryption` | <center>`str`</center> | <center>Optional</center> | The disk encryption status of this Linode. NOTE: Disk encryption may not currently be available to all users. **(Choices: `enabled`, `disabled`)** |
153154
| `swap_size` | <center>`int`</center> | <center>Optional</center> | When deploying from an Image, this field is optional, otherwise it is ignored. This is used to set the swap disk size for the newly-created Linode. |

docs/modules/volume.md

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Manage a Linode Volume.
7575
| `region` | <center>`str`</center> | <center>Optional</center> | The location to deploy the volume in. See https://api.linode.com/v4/regions |
7676
| `size` | <center>`int`</center> | <center>Optional</center> | The size of this volume, in GB. Be aware that volumes may only be resized up after creation. **(Updatable)** |
7777
| `attached` | <center>`bool`</center> | <center>Optional</center> | If true, the volume will be attached to a Linode. Otherwise, the volume will be detached. **(Default: `True`; Updatable)** |
78+
| `encryption` | <center>`str`</center> | <center>Optional</center> | Enables encryption on the volume. Full disk encryption ensures the data stored on a block storage volume drive is secure. **(Choices: `disabled`, `enabled`)** |
7879
| `wait_timeout` | <center>`int`</center> | <center>Optional</center> | The amount of time, in seconds, to wait for a volume to have the active status. **(Default: `240`)** |
7980
| `source_volume_id` | <center>`int`</center> | <center>Optional</center> | The volume id of the desired volume to clone. |
8081
| `tags` | <center>`list`</center> | <center>Optional</center> | The tags to be attached to the volume. |

plugins/modules/instance.py

+7
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,13 @@
524524
],
525525
editable=True,
526526
),
527+
"capabilities": SpecField(
528+
type=FieldType.list,
529+
element_type=FieldType.string,
530+
description=[
531+
"Read-only. A list of capabilities this compute instance supports.",
532+
],
533+
),
527534
"placement_group": SpecField(
528535
type=FieldType.dict,
529536
suboptions=linode_instance_placement_group_spec,

plugins/modules/volume.py

+8
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@
7474
"Otherwise, the volume will be detached."
7575
],
7676
),
77+
"encryption": SpecField(
78+
type=FieldType.string,
79+
description=[
80+
"Enables encryption on the volume. Full disk encryption ensures "
81+
"the data stored on a block storage volume drive is secure."
82+
],
83+
choices=["disabled", "enabled"],
84+
),
7785
"wait_timeout": SpecField(
7886
type=FieldType.integer,
7987
default=240,

tests/integration/targets/instance_basic/tasks/main.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@
133133
- info_id.instance.region == pg_region
134134
- info_id.configs|length == 1
135135
- info_id.networking.ipv4.public[0].address != None
136+
- info_id.instance.capabilities == create.instance.capabilities
136137

137138
- name: Get info about the instance by label
138139
linode.cloud.instance_info:

tests/integration/targets/volume_basic/tasks/main.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
that:
9696
- volume_info_label.volume.linode_id == attach_volume.volume.linode_id
9797
- volume_info_label.volume.size == attach_volume.volume.size
98+
- volume_info_label.volume.encryption == attach_volume.volume.encryption
9899

99100
- name: Detach the volume
100101
linode.cloud.volume:

0 commit comments

Comments
 (0)