Skip to content

Commit

Permalink
adding encrypt and cabailities to volume/instance (#611)
Browse files Browse the repository at this point in the history
## 📝 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
```
  • Loading branch information
jriddle-linode authored Oct 29, 2024
1 parent 59c3e61 commit c670322
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/modules/instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ Manage Linode Instances, Configs, and Disks.
| `migration_type` | <center>`str`</center> | <center>Optional</center> | The type of migration to use for Region and Type migrations. **(Choices: `cold`, `warm`; Default: `cold`)** |
| `auto_disk_resize` | <center>`bool`</center> | <center>Optional</center> | Whether implicitly created disks should be resized during a type change operation. **(Default: `False`)** |
| `tags` | <center>`list`</center> | <center>Optional</center> | An array of tags applied to this object. Tags are for organizational purposes only. **(Updatable)** |
| `capabilities` | <center>`list`</center> | <center>Optional</center> | Read-only. A list of capabilities this compute instance supports. |
| [`placement_group` (sub-options)](#placement_group) | <center>`dict`</center> | <center>Optional</center> | A Placement Group to create this Linode under. |
| `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`)** |
| `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. |
Expand Down
1 change: 1 addition & 0 deletions docs/modules/volume.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ Manage a Linode Volume.
| `region` | <center>`str`</center> | <center>Optional</center> | The location to deploy the volume in. See https://api.linode.com/v4/regions |
| `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)** |
| `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)** |
| `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`)** |
| `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`)** |
| `source_volume_id` | <center>`int`</center> | <center>Optional</center> | The volume id of the desired volume to clone. |
| `tags` | <center>`list`</center> | <center>Optional</center> | The tags to be attached to the volume. |
Expand Down
7 changes: 7 additions & 0 deletions plugins/modules/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,13 @@
],
editable=True,
),
"capabilities": SpecField(
type=FieldType.list,
element_type=FieldType.string,
description=[
"Read-only. A list of capabilities this compute instance supports.",
],
),
"placement_group": SpecField(
type=FieldType.dict,
suboptions=linode_instance_placement_group_spec,
Expand Down
8 changes: 8 additions & 0 deletions plugins/modules/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@
"Otherwise, the volume will be detached."
],
),
"encryption": SpecField(
type=FieldType.string,
description=[
"Enables encryption on the volume. Full disk encryption ensures "
"the data stored on a block storage volume drive is secure."
],
choices=["disabled", "enabled"],
),
"wait_timeout": SpecField(
type=FieldType.integer,
default=240,
Expand Down
1 change: 1 addition & 0 deletions tests/integration/targets/instance_basic/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
- info_id.instance.region == pg_region
- info_id.configs|length == 1
- info_id.networking.ipv4.public[0].address != None
- info_id.instance.capabilities == create.instance.capabilities

- name: Get info about the instance by label
linode.cloud.instance_info:
Expand Down
1 change: 1 addition & 0 deletions tests/integration/targets/volume_basic/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
that:
- volume_info_label.volume.linode_id == attach_volume.volume.linode_id
- volume_info_label.volume.size == attach_volume.volume.size
- volume_info_label.volume.encryption == attach_volume.volume.encryption

- name: Detach the volume
linode.cloud.volume:
Expand Down

0 comments on commit c670322

Please sign in to comment.