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

refactor: cloudavenue_vm #286

Merged
merged 37 commits into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
f8924ea
refactor: base
azrod Apr 5, 2023
232b276
refactor: meta object vm_disk resource
azrod Apr 5, 2023
7d0d9f1
refactor: new schema and struct
azrod Apr 6, 2023
40e3825
fix: disk creae/update/read nil pointer
azrod Apr 26, 2023
9baafe1
chore: Fix customization
dmicheneau May 26, 2023
56ce143
fix(vm): error not returned in Init func
dmicheneau Jun 2, 2023
740207a
fix(vm): use description in state not in API
dmicheneau Jun 2, 2023
45282fa
fix(vm): add validator schema
dmicheneau Jun 2, 2023
28a3768
fix(vm): return good powerON status
dmicheneau Jun 2, 2023
d03e64e
fix(vm): add plan modifier for state
dmicheneau Jun 2, 2023
bc0cf91
fix(vm): var netorks
dmicheneau Jun 6, 2023
8b9a2e3
fix(vm): var networks
dmicheneau Jun 6, 2023
b44b723
fix(vm): empty default value
dmicheneau Jun 6, 2023
953edf4
fix(vm): delete vapp power_on value to manage drift between vm and vapp
dmicheneau Jun 6, 2023
c1f2447
fix(vm): pb creation resource
dmicheneau Jun 8, 2023
7530b11
fix: multi org network not found
azrod Jun 8, 2023
8b31e24
fix: vm_name in tfstate
azrod Jun 8, 2023
39d492a
fix: Construct network object in create VM
azrod Jun 8, 2023
75c2fbd
fix: validators in vm schema
azrod Jun 8, 2023
33126fb
chore: update validators dependency
azrod Jun 8, 2023
993ecb3
chore: clean vm disk resource
azrod Jun 8, 2023
41b8abb
chore: reorganize vm resource files
azrod Jun 8, 2023
c09e0f9
fix(vm): move power on/off status to const
azrod Jun 8, 2023
c3bd524
fix: network section return
azrod Jun 8, 2023
f5f6d3e
fix: fix all lints issues
azrod Jun 8, 2023
4e35fb5
fix: create multiple disk
azrod Jun 13, 2023
f3b578b
fix: vm add storage profile default and remove detach disk
azrod Jun 13, 2023
b9e36ed
feat(vm): add validator nullifattributeisoneof
azrod Jun 13, 2023
9ce6bee
feat(vm): add validator IsIP
azrod Jun 13, 2023
20f9183
chore: up VCDVersion to 37.1
azrod Jun 14, 2023
1bfb068
fix: vapp status for deleting org_network
azrod Jun 14, 2023
3a39ddc
fix: vm with boot_image_id and tests
azrod Jun 14, 2023
42b48e3
docs: update docs
azrod Jun 14, 2023
7100e85
fix: osType Markdown
azrod Jun 14, 2023
4451b40
chore: Add changelog message
dmicheneau Jun 15, 2023
0b538eb
fix: validator schema
azrod Jun 15, 2023
8532a48
fix: minor fix before validate merge request
azrod Jun 15, 2023
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
23 changes: 23 additions & 0 deletions .changelog/286.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
```release-note:breaking-change
New major change on schema for `cloudavenue_vm` resource.
```

```release-note:breaking-change
Deletion of `power_on` attribute in schema for `cloudavenue_vapp` resource and datasource.
```

```release-note:breaking-change
New major change on schema `cloudavenue_vm_disk` resource.
```

```release-note:bug
Force to `power_off` a `cloudavenue_vapp` when you delete a `cloudavenue_vapp_org_network` resource.
```

```release-note:dependency
deps: bumps github.com/FrangipaneTeam/terraform-plugin-framework-validators from 1.5.1 to 1.6.3
```

```release-note:dependency
Update VMware Cloud Director API from v37.0 to v37.1
```
6 changes: 3 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ linters:
- bidichk # Checks for dangerous unicode character sequences [fast: true, auto-fix: false]
- deadcode # Finds unused code [fast: false, auto-fix: false]
- decorder # check declaration order and count of types, constants, variables and functions [fast: true, auto-fix: false]
- depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: true, auto-fix: false]
- dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) [fast: true, auto-fix: false]
- durationcheck # check for two durations multiplied together [fast: false, auto-fix: false]
- errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases [fast: false, auto-fix: false]
Expand Down Expand Up @@ -38,7 +37,6 @@ linters:
- ineffassign # Detects when assignments to existing variables are not used [fast: true, auto-fix: false]
- makezero # Finds slice declarations with non-zero initial length [fast: false, auto-fix: false]
- misspell # Finds commonly misspelled English words in comments [fast: true, auto-fix: true]
- nakedret # Finds naked returns in functions greater than a specified function length [fast: true, auto-fix: false]
- nilerr # Finds the code that returns nil even if it checks that the error is not nil. [fast: false, auto-fix: false]
- noctx # noctx finds sending http request without context.Context [fast: false, auto-fix: false]
- nolintlint # Reports ill-formed or insufficient nolint directives [fast: true, auto-fix: false]
Expand All @@ -48,7 +46,6 @@ linters:
- revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint. [fast: false, auto-fix: false]
- rowserrcheck # checks whether Err of rows is checked successfully [fast: false, auto-fix: false]
- sqlclosecheck # Checks that sql.Rows and sql.Stmt are closed. [fast: false, auto-fix: false]
- structcheck # Finds unused struct fields [fast: false, auto-fix: false]
- stylecheck # Stylecheck is a replacement for golint [fast: false, auto-fix: false]
- tagliatelle # Checks the struct tags. [fast: true, auto-fix: false]
- tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17 [fast: false, auto-fix: false]
Expand All @@ -68,6 +65,9 @@ linters:
- bodyclose # checks whether HTTP response body is closed successfully

disable:
- structcheck # Finds unused struct fields [fast: false, auto-fix: false]
- nakedret # Finds naked returns in functions greater than a specified function length [fast: true, auto-fix: false]
- depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: true, auto-fix: false]
- goimports # In addition to fixing imports, goimports also formats your code in the same style as gofmt. [fast: true, auto-fix: true]
- containedctx # containedctx is a linter that detects struct contained context.Context field [fast: true, auto-fix: false]
- thelper # thelper detects golang test helpers without t.Helper() call and checks the consistency of test helpers [fast: false, auto-fix: false]
Expand Down
1 change: 0 additions & 1 deletion docs/data-sources/vapp.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ data "cloudavenue_vapp" "example" {
- `description` (String) Description of the vApp.
- `guest_properties` (Map of String) Key/value settings for guest properties.
- `lease` (Attributes) Informations about vApp lease. (see [below for nested schema](#nestedatt--lease))
- `power_on` (Boolean) A boolean value indicating whether this vApp is powered on or not.

<a id="nestedatt--lease"></a>
### Nested Schema for `lease`
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/alb_pool.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Required:

Optional:

- `value` (String) Value of attribute based on persistence type. If persistence_profile.type attribute is set and the value is one of `"HTTP_COOKIE"`, this attribute is required.
- `value` (String) Value of attribute based on persistence type. If persistence_profile.type attribute is set and the value is one of `"HTTP_COOKIE"`, this attribute is REQUIRED.

## Import

Expand Down
1 change: 0 additions & 1 deletion docs/resources/vapp.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ resource "cloudavenue_vapp" "example" {
- `description` (String) Description of the vApp.
- `guest_properties` (Map of String) Key/value settings for guest properties.
- `lease` (Attributes) Informations about vApp lease. Value defaults to `{"runtime_lease_in_sec":0,"storage_lease_in_sec":0}`. (see [below for nested schema](#nestedatt--lease))
- `power_on` (Boolean) A boolean value indicating whether this vApp is powered on or not. Value defaults to `false`.
- `vdc` (String) (ForceNew) The name of vDC to use, optional if defined at provider level.

### Read-Only
Expand Down
4 changes: 4 additions & 0 deletions docs/resources/vapp_org_network.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ description: |-

Provides a Cloud Avenue routed vAPP Org Network resource. This can be used to create, modify, and delete routed vAPP Network.

!> **Warning on deleting resource:** Deleting a resource require **vApp to be in a powered OFF** state.
If the vApp is in a powered on state, the resource will power OFF the vApp before deleting the resource and then power it back on.
On power **ALL** VMs in the vApp will be powered ON, regardless of their previous state.

## Example Usage

```terraform
Expand Down
339 changes: 260 additions & 79 deletions docs/resources/vm.md

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions docs/resources/vm_disk.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
page_title: "cloudavenue_vm_disk Resource - cloudavenue"
subcategory: "VM (Virtual Machine)"
description: |-
The disk resource allows you to manage a disk in the vDC.
The virtual machine (vm) resource allows you to manage a virtual machine in the CloudAvenue.
---

# cloudavenue_vm_disk (Resource)

The disk resource allows you to manage a disk in the vDC.
The virtual machine (vm) resource allows you to manage a virtual machine in the CloudAvenue.

## Example Usage

Expand All @@ -31,25 +31,25 @@ resource "cloudavenue_vm_disk" "example-detachable" {

### Required

- `is_detachable` (Boolean) If the disk is detachable or not. If set to `true`, the disk will be attached to any VM that is created from the vApp. If set to `false`, the disk will be attached to the VM specified in `vm_name` or `vm_id`. Change this field requires a replacement of the disk.
- `name` (String) The name of the disk.
- `size_in_mb` (Number) The size of the disk in MB.

### Optional

- `bus_number` (Number) The number of the controller itself.
- `bus_type` (String) The type of disk controller. Possible values: `scsi`, `sata` or `nvme`. Default value is `scsi`.
- `size_in_mb` (Number) The size of the disk in MB.
- `storage_profile` (String) Storage profile to override the VM default one. Allowed values are: `silver`, `silver_r1`, `silver_r2`, `gold`, `gold_r1`, `gold_r2`, `gold_hm`, `platinum3k`, `platinum3k_r1`, `platinum3k_r2`, `platinum3k_hm`, `platinum7k`, `platinum7k_r1`, `platinum7k_r2`, `platinum7k_hm`.
- `unit_number` (Number) The device number on the controller of the disk.
- `vapp_id` (String) (ForceNew) ID of the vApp. Required if `vapp_name` is not set.
- `vapp_name` (String) (ForceNew) Name of the vApp. Required if `vapp_id` is not set.
- `bus_number` (Number) The bus number of the disk controller. If the disk is attached to a VM and this attribute is not set, the disk will be attached to the first available bus. Value must be between 0 and 3.
- `bus_type` (String) The type of disk controller. Value must be one of : `IDE`, `SATA`, `SCSI`, `NVME`. Value defaults to `SCSI`.
- `is_detachable` (Boolean) (ForceNew) If set to `true`, the disk will be detached from the VM. If set to `false`, the disk will be attached to the VM. Value defaults to `false`.
- `name` (String) The name of the disk. If is_detachable attribute is set and the value is one of `true`, this attribute is REQUIRED.
- `storage_profile` (String) The name of the storage profile. If not set, the default storage profile will be used. Value must be one of : `silver`, `silver_r1`, `silver_r2`, `gold`, `gold_r1`, `gold_r2`, `gold_hm`, `platinum3k`, `platinum3k_r1`, `platinum3k_r2`, `platinum3k_hm`, `platinum7k`, `platinum7k_r1`, `platinum7k_r2`, `platinum7k_hm`.
- `unit_number` (Number) The unit number of the disk controller. If the disk is attached to a VM and this attribute is not set, the disk will be attached to the first available unit. Value must be between 0 and 15.
- `vapp_id` (String) (ForceNew) ID of the vApp. Ensure that one and only one attribute from this collection is set : `vapp_name`, `vapp_id`.
- `vapp_name` (String) (ForceNew) Name of the vApp. Ensure that one and only one attribute from this collection is set : `vapp_id`, `vapp_name`.
- `vdc` (String) (ForceNew) The name of vDC to use, optional if defined at provider level.
- `vm_id` (String) The ID of the VM. If `vm_name` is not set and `ìs_detachable` is set to `true`, the disk will be attached to any VM. This field is required if `is_detachable` is set to `false`.
- `vm_name` (String) The name of the VM. If `vm_id` is not set and `ìs_detachable` is set to `true`, the disk will be attached to any VM. This field is required if `is_detachable` is set to `false`.
- `vm_id` (String) The ID of the VM where the disk will be attached. Value must satisfy at least one of the validations: If is_detachable attribute is set and the value is one of false, this attribute is REQUIRED + Ensure that one and only one attribute from this collection is set: "[vm_name]".
- `vm_name` (String) The name of the VM where the disk will be attached. Value must satisfy at least one of the validations: If is_detachable attribute is set and the value is one of false, this attribute is REQUIRED + Ensure that one and only one attribute from this collection is set: "[vm_id]".

### Read-Only

- `id` (String) The ID of the disk.
- `id` (String) The ID of the VM.

## Import

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.20
require (
github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers v1.2.2
github.com/FrangipaneTeam/terraform-plugin-framework-superschema v1.3.0
github.com/FrangipaneTeam/terraform-plugin-framework-validators v1.5.1
github.com/FrangipaneTeam/terraform-plugin-framework-validators v1.6.3
github.com/antihax/optional v1.0.0
github.com/google/uuid v1.3.0
github.com/hashicorp/terraform-plugin-docs v0.15.0
Expand Down
Loading