diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9c96f1d1..bdd8c48e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,6 +31,12 @@ jobs: - name: Build run: go vet . && go build -v . + - name: Run coverage + run: go test -race -coverprofile=coverage.out -covermode=atomic ./... + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + # run acceptance tests in a matrix with Terraform core versions test: name: Matrix Test diff --git a/README.md b/README.md index 8329cf8b..082a4f21 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Terraform Provider for Proxmox [![Go Report Card](https://goreportcard.com/badge/github.com/bpg/terraform-provider-proxmox)](https://goreportcard.com/report/github.com/bpg/terraform-provider-proxmox) +[![codecov](https://codecov.io/github/bpg/terraform-provider-proxmox/branch/main/graph/badge.svg?token=RTSCyU0qyN)](https://codecov.io/github/bpg/terraform-provider-proxmox) [![GoDoc](https://godoc.org/github.com/bpg/terraform-provider-proxmox?status.svg)](http://godoc.org/github.com/bpg/terraform-provider-proxmox) [![GitHub release (latest by date)](https://img.shields.io/github/v/release/bpg/terraform-provider-proxmox)](https://github.com/bpg/terraform-provider-proxmox/releases/latest) [![GitHub Release Date](https://img.shields.io/github/release-date/bpg/terraform-provider-proxmox)](https://github.com/bpg/terraform-provider-proxmox/releases/latest) diff --git a/docs/resources/virtual_environment_container.md b/docs/resources/virtual_environment_container.md index 996445d7..3e3c2bef 100644 --- a/docs/resources/virtual_environment_container.md +++ b/docs/resources/virtual_environment_container.md @@ -30,7 +30,7 @@ resource "proxmox_virtual_environment_container" "ubuntu_container" { } user_account { - keys = [ + keys = [ trimspace(tls_private_key.ubuntu_container_key.public_key_openssh) ] password = random_password.ubuntu_container_password.result @@ -88,8 +88,7 @@ output "ubuntu_container_public_key" { - `clone` - (Optional) The cloning configuration. - `datastore_id` - (Optional) The identifier for the target datastore. - `node_name` - (Optional) The name of the source node (leave blank, if - equal - to the `node_name` argument). + equal to the `node_name` argument). - `vm_id` - (Required) The identifier for the source container. - `console` - (Optional) The console configuration. - `enabled` - (Optional) Whether to enable the console device (defaults @@ -111,7 +110,8 @@ output "ubuntu_container_public_key" { - `disk` - (Optional) The disk configuration. - `datastore_id` - (Optional) The identifier for the datastore to create the disk in (defaults to `local`). - * `size` - (Optional) The size of the root filesystem in gigabytes (defaults to `4`). Requires `datastore_id` to be set. + -`size` - (Optional) The size of the root filesystem in gigabytes ( + defaults to `4`). Requires `datastore_id` to be set. - `initialization` - (Optional) The initialization configuration. - `dns` - (Optional) The DNS configuration. - `domain` - (Optional) The DNS search domain. @@ -123,14 +123,12 @@ output "ubuntu_container_public_key" { - `address` - (Optional) The IPv4 address (use `dhcp` for autodiscovery). - `gateway` - (Optional) The IPv4 gateway (must be omitted - when `dhcp` is - used as the address). + when `dhcp` is used as the address). - `ipv6` - (Optional) The IPv4 configuration. - `address` - (Optional) The IPv6 address (use `dhcp` for autodiscovery). - `gateway` - (Optional) The IPv6 gateway (must be omitted - when `dhcp` is - used as the address). + when `dhcp` is used as the address). - `user_account` - (Optional) The user account configuration. - `keys` - (Optional) The SSH keys for the root account. - `password` - (Optional) The password for the root account. @@ -146,8 +144,7 @@ output "ubuntu_container_public_key" { to `true`). - `mac_address` - (Optional) The MAC address. - `mtu` - (Optional) Maximum transfer unit of the interface. Cannot be - larger - than the bridge's MTU. + larger than the bridge's MTU. - `name` - (Required) The network interface name. - `rate_limit` - (Optional) The rate limit in megabytes per second. - `vlan_id` - (Optional) The VLAN identifier. @@ -166,7 +163,11 @@ output "ubuntu_container_public_key" { - `unmanaged` - Unmanaged. - `pool_id` - (Optional) The identifier for a pool to assign the container to. - `started` - (Optional) Whether to start the container (defaults to `true`). -- `tags` - (Optional) A list of tags of the container. This is only meta information (defaults to `[]`). Note: Proxmox always sorts the container tags. If the list in template is not sorted, then Proxmox will always report a difference on the resource. You may use the `ignore_changes` lifecycle meta-argument to ignore changes to this attribute. +- `tags` - (Optional) A list of tags of the container. This is only meta + information (defaults to `[]`). Note: Proxmox always sorts the container tags. + If the list in template is not sorted, then Proxmox will always report a + difference on the resource. You may use the `ignore_changes` lifecycle + meta-argument to ignore changes to this attribute. - `template` - (Optional) Whether to create a template (defaults to `false`). - `vm_id` - (Optional) The virtual machine identifier diff --git a/docs/resources/virtual_environment_vm.md b/docs/resources/virtual_environment_vm.md index cf5c5885..2afb9a6d 100644 --- a/docs/resources/virtual_environment_vm.md +++ b/docs/resources/virtual_environment_vm.md @@ -102,8 +102,7 @@ output "ubuntu_vm_public_key" { - `enabled` - (Optional) Whether to enable the QEMU agent (defaults to `false`). - `timeout` - (Optional) The maximum amount of time to wait for data from - the - QEMU agent to become available ( defaults to `15m`). + the QEMU agent to become available ( defaults to `15m`). - `trim` - (Optional) Whether to enable the FSTRIM feature in the QEMU agent (defaults to `false`). - `type` - (Optional) The QEMU agent interface type (defaults to `virtio`). @@ -125,14 +124,14 @@ output "ubuntu_vm_public_key" { - `enabled` - (Optional) Whether to enable the CDROM drive (defaults to `false`). - `file_id` - (Optional) A file ID for an ISO file (defaults to `cdrom` as - in - the physical drive). + in the physical drive). - `clone` - (Optional) The cloning configuration. - `datastore_id` - (Optional) The identifier for the target datastore. - `node_name` - (Optional) The name of the source node (leave blank, if equal to the `node_name` argument). - `retries` - (Optional) Number of retries in Proxmox for clone vm. - Sometimes Proxmox errors with timeout when creating multiple clones at once. + Sometimes Proxmox errors with timeout when creating multiple clones at + once. - `vm_id` - (Required) The identifier for the source VM. - `cpu` - (Optional) The CPU configuration. - `architecture` - (Optional) The CPU architecture (defaults to `x86_64`). @@ -252,8 +251,7 @@ output "ubuntu_vm_public_key" { With this enabled the `vga` configuration argument will be ignored. - `initialization` - (Optional) The cloud-init configuration. - `datastore_id` - (Optional) The identifier for the datastore to create the - cloud-init disk in (defaults - to `local-lvm`). + cloud-init disk in (defaults to `local-lvm`). - `dns` - (Optional) The DNS configuration. - `domain` - (Optional) The DNS search domain. - `server` - (Optional) The DNS server. @@ -278,8 +276,7 @@ output "ubuntu_vm_public_key" { network configuration data passed to the VM via cloud-init (conflicts with `ip_config`). - `user_data_file_id` - (Optional) The identifier for a file containing - custom user data (conflicts - with `user_account`). + custom user data (conflicts with `user_account`). - `vendor_data_file_id` - (Optional) The identifier for a file containing all vendor data passed to the VM via cloud-init. - `keyboard_layout` - (Optional) The keyboard layout (defaults to `en-us`). @@ -309,7 +306,7 @@ output "ubuntu_vm_public_key" { - `sv` - Swedish. - `tr` - Turkish. - `kvm_arguments` - (Optional) Arbitrary arguments passed to kvm. -* `machine` - (Optional) The VM machine type (defaults to `i440fx`). +- `machine` - (Optional) The VM machine type (defaults to `i440fx`). - `i440fx` - Standard PC (i440FX + PIIX, 1996). - `q35` - Standard PC (Q35 + ICH9, 2009). - `memory` - (Optional) The memory configuration. @@ -415,7 +412,7 @@ output "ubuntu_vm_public_key" { ## Important Notes When cloning an existing virtual machine, whether it's a template or not, the -resource will only detect changes to the arguments which are not set to their +resource will only detect changes to the arguments which are not set to their default values. Furthermore, when cloning from one node to a different one, the behavior changes @@ -427,7 +424,7 @@ API. **Note:** Because the migration step after the clone tries to preserve the used datastores by their name, it may fail if a datastore used in the source VM is not available on the target node (e.g. `local-lvm` is used on the source node in -the VM but no `local-lvm` datastore is availabel on the target node). In this +the VM but no `local-lvm` datastore is available on the target node). In this case, it is recommended to set the `datastore_id` argument in the `clone` block to force the migration step to migrate all disks to a specific datastore on the target node. If you need certain disks to be on specific datastores, set