0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-06-30 10:33:46 +00:00

chore: set up code coverage (#215)

* chore: set up code coverage

* reformat docs
This commit is contained in:
Pavel Boldyrev 2023-01-22 23:58:52 -05:00 committed by GitHub
parent 5c8ae3c3f8
commit 06bd5aef0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 23 deletions

View File

@ -31,6 +31,12 @@ jobs:
- name: Build - name: Build
run: go vet . && go build -v . 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 # run acceptance tests in a matrix with Terraform core versions
test: test:
name: Matrix Test name: Matrix Test

View File

@ -1,6 +1,7 @@
# Terraform Provider for Proxmox # 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) [![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) [![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 (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) [![GitHub Release Date](https://img.shields.io/github/release-date/bpg/terraform-provider-proxmox)](https://github.com/bpg/terraform-provider-proxmox/releases/latest)

View File

@ -30,7 +30,7 @@ resource "proxmox_virtual_environment_container" "ubuntu_container" {
} }
user_account { user_account {
keys = [ keys = [
trimspace(tls_private_key.ubuntu_container_key.public_key_openssh) trimspace(tls_private_key.ubuntu_container_key.public_key_openssh)
] ]
password = random_password.ubuntu_container_password.result password = random_password.ubuntu_container_password.result
@ -88,8 +88,7 @@ output "ubuntu_container_public_key" {
- `clone` - (Optional) The cloning configuration. - `clone` - (Optional) The cloning configuration.
- `datastore_id` - (Optional) The identifier for the target datastore. - `datastore_id` - (Optional) The identifier for the target datastore.
- `node_name` - (Optional) The name of the source node (leave blank, if - `node_name` - (Optional) The name of the source node (leave blank, if
equal equal to the `node_name` argument).
to the `node_name` argument).
- `vm_id` - (Required) The identifier for the source container. - `vm_id` - (Required) The identifier for the source container.
- `console` - (Optional) The console configuration. - `console` - (Optional) The console configuration.
- `enabled` - (Optional) Whether to enable the console device (defaults - `enabled` - (Optional) Whether to enable the console device (defaults
@ -111,7 +110,8 @@ output "ubuntu_container_public_key" {
- `disk` - (Optional) The disk configuration. - `disk` - (Optional) The disk configuration.
- `datastore_id` - (Optional) The identifier for the datastore to create the - `datastore_id` - (Optional) The identifier for the datastore to create the
disk in (defaults to `local`). 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. - `initialization` - (Optional) The initialization configuration.
- `dns` - (Optional) The DNS configuration. - `dns` - (Optional) The DNS configuration.
- `domain` - (Optional) The DNS search domain. - `domain` - (Optional) The DNS search domain.
@ -123,14 +123,12 @@ output "ubuntu_container_public_key" {
- `address` - (Optional) The IPv4 address (use `dhcp` for - `address` - (Optional) The IPv4 address (use `dhcp` for
autodiscovery). autodiscovery).
- `gateway` - (Optional) The IPv4 gateway (must be omitted - `gateway` - (Optional) The IPv4 gateway (must be omitted
when `dhcp` is when `dhcp` is used as the address).
used as the address).
- `ipv6` - (Optional) The IPv4 configuration. - `ipv6` - (Optional) The IPv4 configuration.
- `address` - (Optional) The IPv6 address (use `dhcp` for - `address` - (Optional) The IPv6 address (use `dhcp` for
autodiscovery). autodiscovery).
- `gateway` - (Optional) The IPv6 gateway (must be omitted - `gateway` - (Optional) The IPv6 gateway (must be omitted
when `dhcp` is when `dhcp` is used as the address).
used as the address).
- `user_account` - (Optional) The user account configuration. - `user_account` - (Optional) The user account configuration.
- `keys` - (Optional) The SSH keys for the root account. - `keys` - (Optional) The SSH keys for the root account.
- `password` - (Optional) The password for the root account. - `password` - (Optional) The password for the root account.
@ -146,8 +144,7 @@ output "ubuntu_container_public_key" {
to `true`). to `true`).
- `mac_address` - (Optional) The MAC address. - `mac_address` - (Optional) The MAC address.
- `mtu` - (Optional) Maximum transfer unit of the interface. Cannot be - `mtu` - (Optional) Maximum transfer unit of the interface. Cannot be
larger larger than the bridge's MTU.
than the bridge's MTU.
- `name` - (Required) The network interface name. - `name` - (Required) The network interface name.
- `rate_limit` - (Optional) The rate limit in megabytes per second. - `rate_limit` - (Optional) The rate limit in megabytes per second.
- `vlan_id` - (Optional) The VLAN identifier. - `vlan_id` - (Optional) The VLAN identifier.
@ -166,7 +163,11 @@ output "ubuntu_container_public_key" {
- `unmanaged` - Unmanaged. - `unmanaged` - Unmanaged.
- `pool_id` - (Optional) The identifier for a pool to assign the container to. - `pool_id` - (Optional) The identifier for a pool to assign the container to.
- `started` - (Optional) Whether to start the container (defaults to `true`). - `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`). - `template` - (Optional) Whether to create a template (defaults to `false`).
- `vm_id` - (Optional) The virtual machine identifier - `vm_id` - (Optional) The virtual machine identifier

View File

@ -102,8 +102,7 @@ output "ubuntu_vm_public_key" {
- `enabled` - (Optional) Whether to enable the QEMU agent (defaults - `enabled` - (Optional) Whether to enable the QEMU agent (defaults
to `false`). to `false`).
- `timeout` - (Optional) The maximum amount of time to wait for data from - `timeout` - (Optional) The maximum amount of time to wait for data from
the the QEMU agent to become available ( defaults to `15m`).
QEMU agent to become available ( defaults to `15m`).
- `trim` - (Optional) Whether to enable the FSTRIM feature in the QEMU agent - `trim` - (Optional) Whether to enable the FSTRIM feature in the QEMU agent
(defaults to `false`). (defaults to `false`).
- `type` - (Optional) The QEMU agent interface type (defaults to `virtio`). - `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 - `enabled` - (Optional) Whether to enable the CDROM drive (defaults
to `false`). to `false`).
- `file_id` - (Optional) A file ID for an ISO file (defaults to `cdrom` as - `file_id` - (Optional) A file ID for an ISO file (defaults to `cdrom` as
in in the physical drive).
the physical drive).
- `clone` - (Optional) The cloning configuration. - `clone` - (Optional) The cloning configuration.
- `datastore_id` - (Optional) The identifier for the target datastore. - `datastore_id` - (Optional) The identifier for the target datastore.
- `node_name` - (Optional) The name of the source node (leave blank, if - `node_name` - (Optional) The name of the source node (leave blank, if
equal to the `node_name` argument). equal to the `node_name` argument).
- `retries` - (Optional) Number of retries in Proxmox for clone vm. - `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. - `vm_id` - (Required) The identifier for the source VM.
- `cpu` - (Optional) The CPU configuration. - `cpu` - (Optional) The CPU configuration.
- `architecture` - (Optional) The CPU architecture (defaults to `x86_64`). - `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. With this enabled the `vga` configuration argument will be ignored.
- `initialization` - (Optional) The cloud-init configuration. - `initialization` - (Optional) The cloud-init configuration.
- `datastore_id` - (Optional) The identifier for the datastore to create the - `datastore_id` - (Optional) The identifier for the datastore to create the
cloud-init disk in (defaults cloud-init disk in (defaults to `local-lvm`).
to `local-lvm`).
- `dns` - (Optional) The DNS configuration. - `dns` - (Optional) The DNS configuration.
- `domain` - (Optional) The DNS search domain. - `domain` - (Optional) The DNS search domain.
- `server` - (Optional) The DNS server. - `server` - (Optional) The DNS server.
@ -278,8 +276,7 @@ output "ubuntu_vm_public_key" {
network configuration data passed to the network configuration data passed to the
VM via cloud-init (conflicts with `ip_config`). VM via cloud-init (conflicts with `ip_config`).
- `user_data_file_id` - (Optional) The identifier for a file containing - `user_data_file_id` - (Optional) The identifier for a file containing
custom user data (conflicts custom user data (conflicts with `user_account`).
with `user_account`).
- `vendor_data_file_id` - (Optional) The identifier for a file containing - `vendor_data_file_id` - (Optional) The identifier for a file containing
all vendor data passed to the VM via cloud-init. all vendor data passed to the VM via cloud-init.
- `keyboard_layout` - (Optional) The keyboard layout (defaults to `en-us`). - `keyboard_layout` - (Optional) The keyboard layout (defaults to `en-us`).
@ -309,7 +306,7 @@ output "ubuntu_vm_public_key" {
- `sv` - Swedish. - `sv` - Swedish.
- `tr` - Turkish. - `tr` - Turkish.
- `kvm_arguments` - (Optional) Arbitrary arguments passed to kvm. - `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). - `i440fx` - Standard PC (i440FX + PIIX, 1996).
- `q35` - Standard PC (Q35 + ICH9, 2009). - `q35` - Standard PC (Q35 + ICH9, 2009).
- `memory` - (Optional) The memory configuration. - `memory` - (Optional) The memory configuration.
@ -415,7 +412,7 @@ output "ubuntu_vm_public_key" {
## Important Notes ## Important Notes
When cloning an existing virtual machine, whether it's a template or not, the 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. default values.
Furthermore, when cloning from one node to a different one, the behavior changes 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 **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 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 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 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 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 target node. If you need certain disks to be on specific datastores, set