diff --git a/.gitignore b/.gitignore index 4ade4187..091298e1 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,6 @@ id_rsa.pub # Binary terraform-provider-proxmox* + +# .vscode +.vscode/settings.json \ No newline at end of file diff --git a/.vscode/settings.example.json b/.vscode/settings.example.json new file mode 100644 index 00000000..016cd15c --- /dev/null +++ b/.vscode/settings.example.json @@ -0,0 +1,133 @@ +{ + "editor.bracketPairColorization.enabled": true, + "editor.guides.bracketPairs": false, + "editor.guides.bracketPairsHorizontal": false, + "editor.guides.highlightActiveBracketPair": true, + "editor.rulers": [100], + "git.alwaysSignOff": true, + "cSpell.words": [ + "aarch", + "ACPI", + "archlinux", + "armhf", + "bodyclose", + "burstable", + "capi", + "CDROM", + "cloudinit", + "CLRF", + "clusterfirewall", + "cmode", + "cpulimit", + "CPUNUMA", + "cpus", + "cputype", + "cpuunits", + "customdiff", + "datasource", + "datasources", + "deepcode", + "directsync", + "efidisk", + "efidisks", + "FSTRIM", + "fwprovider", + "gocritic", + "gosimple", + "hookscript", + "hostnodes", + "hostpci", + "Hotplugged", + "Hugepages", + "iface", + "importdisk", + "iothread", + "iothreads", + "ivshmem", + "keyctl", + "knownhosts", + "mbps", + "mdev", + "nameserver", + "nestif", + "nixos", + "nolint", + "NUMA", + "ostype", + "OVMF", + "prealloc", + "proxmoxtf", + "pvesm", + "qcow", + "ROMBAR", + "romfile", + "rootfs", + "seabios", + "signoff", + "skeema", + "SMBIOSSKU", + "SMBIOSUUID", + "stretchr", + "testacc", + "tflog", + "tfstate", + "tfvars", + "tpmstate", + "unmanaged", + "unthrottled", + "uring", + "usbdisk", + "vcpus", + "virtio", + "VLANID", + "vmbr", + "VMID", + "vztmpl", + "writeback", + "writethrough", + "wvista", + "XVGA" + ], + "go.lintTool": "golangci-lint", + "go.lintFlags": ["--config=${workspaceFolder}/.golangci.yml", "--fast"], + "go.lintOnSave": "workspace", + "go.testEnvFile": "${workspaceFolder}/testacc.env", + "material-icon-theme.folders.associations": { + ".github/workflows": "robot", + "fwprovider": "middleware", + "proxmox": "api", + "proxmoxtf": "container", + "structure": "utils", + "access": "admin", + "firewall": "secure", + "nodes": "server", + "storage": "database", + "pools": "batch", + "ssh": "connection", + "version": "include", + "datasource": "database" + }, + "psi-header.config": { + "forceToTop": true, + "blankLinesAfter": 1, + "license": "Apache-2.0" + }, + "psi-header.changes-tracking": { + "include": ["go"], + "isActive": true, + "enforceHeader": true + }, + "psi-header.templates": [ + { + "language": "*", + "template": [ + "This Source Code Form is subject to the terms of the Mozilla Public", + "License, v. 2.0. If a copy of the MPL was not distributed with this", + "file, You can obtain one at https://mozilla.org/MPL/2.0/." + ] + } + ], + "makefile.configureOnOpen": false, + "go.buildFlags": ["-tags=all"], + "gopls": { "build.buildFlags": ["-tags=all"] } +} diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 706d1676..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,136 +0,0 @@ -{ - "editor.bracketPairColorization.enabled": true, - "editor.guides.bracketPairs": false, - "editor.guides.bracketPairsHorizontal": false, - "editor.guides.highlightActiveBracketPair": true, - "editor.rulers": [ - 100 - ], - "git.alwaysSignOff": true, - "cSpell.words": [ - "aarch", - "ACPI", - "archlinux", - "armhf", - "bodyclose", - "burstable", - "capi", - "CDROM", - "cloudinit", - "CLRF", - "clusterfirewall", - "cmode", - "cpulimit", - "CPUNUMA", - "cpus", - "cputype", - "cpuunits", - "customdiff", - "datasource", - "datasources", - "deepcode", - "directsync", - "efidisk", - "efidisks", - "FSTRIM", - "fwprovider", - "gocritic", - "gosimple", - "hookscript", - "hostnodes", - "hostpci", - "Hotplugged", - "Hugepages", - "iface", - "importdisk", - "iothread", - "iothreads", - "ivshmem", - "keyctl", - "knownhosts", - "mbps", - "mdev", - "nameserver", - "nestif", - "nixos", - "nolint", - "NUMA", - "ostype", - "OVMF", - "prealloc", - "proxmoxtf", - "pvesm", - "qcow", - "ROMBAR", - "romfile", - "rootfs", - "seabios", - "signoff", - "skeema", - "SMBIOSSKU", - "SMBIOSUUID", - "stretchr", - "testacc", - "tflog", - "tfstate", - "tfvars", - "tpmstate", - "unmanaged", - "unthrottled", - "uring", - "usbdisk", - "vcpus", - "virtio", - "VLANID", - "vmbr", - "VMID", - "vztmpl", - "writeback", - "writethrough", - "wvista", - "XVGA" - ], - "go.lintTool": "golangci-lint", - "go.lintFlags": [ - "--config=${workspaceFolder}/.golangci.yml", - "--fast" - ], - "go.lintOnSave": "workspace", - "go.testEnvFile": "${workspaceFolder}/testacc.env", - "material-icon-theme.folders.associations": { - ".github/workflows": "robot", - "fwprovider": "middleware", - "proxmox": "api", - "proxmoxtf": "container", - "structure": "utils", - "access": "admin", - "firewall": "secure", - "nodes": "server", - "storage": "database", - "pools": "batch", - "ssh": "connection", - "version": "include", - "datasource": "database", - }, - "psi-header.config": { - "forceToTop": true, - "blankLinesAfter": 1, - "license": "Apache-2.0", - }, - "psi-header.changes-tracking": { - "include": ["go"], - "isActive": true, - "enforceHeader": true, - }, - "psi-header.templates": [ - { - "language": "*", - "template": [ - "This Source Code Form is subject to the terms of the Mozilla Public", - "License, v. 2.0. If a copy of the MPL was not distributed with this", - "file, You can obtain one at https://mozilla.org/MPL/2.0/.", - ], - }, - ], - "makefile.configureOnOpen": false -} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 716fabbf..77f40e5a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,6 +39,10 @@ ability to merge PRs and respond to issues. The binaries will be placed in the `dist` directory. +## IDE support + +If you are using VS Code, feel free to copy `settings.json` from `.vscode/settings.example.json`. + ## Testing The project has a handful of test cases which must pass for a contribution to be @@ -61,9 +65,11 @@ PROXMOX_VE_API_TOKEN="root@pam!=" PROXMOX_VE_ENDPOINT="https://:8006/" PROXMOX_VE_SSH_AGENT="true" PROXMOX_VE_SSH_USERNAME="root" -# optionally, youcan override the default node name and ssh address +# optionally, you can override the default node name and ssh address and other things #PROXMOX_VE_ACC_NODE_NAME="pve1" #PROXMOX_VE_ACC_NODE_SSH_ADDRESS="10.0.0.11" +#PROXMOX_VE_ACC_NODE_SSH_PORT="22" +#PROXMOX_VE_ACC_IFACE_NAME="enp1s0" ``` Then use `make testacc` to run the acceptance tests. diff --git a/fwprovider/network/resource_linux_vlan_test.go b/fwprovider/network/resource_linux_vlan_test.go index adfd2db7..f387ae40 100644 --- a/fwprovider/network/resource_linux_vlan_test.go +++ b/fwprovider/network/resource_linux_vlan_test.go @@ -10,6 +10,7 @@ package network_test import ( "fmt" + "os" "strconv" "testing" @@ -26,7 +27,11 @@ const ( func TestAccResourceLinuxVLAN(t *testing.T) { te := test.InitEnvironment(t) - iface := "ens18" + iface := os.Getenv("PROXMOX_VE_ACC_IFACE_NAME") + if iface == "" { + iface = "ens18" + } + vlan1 := gofakeit.Number(10, 4094) customName := fmt.Sprintf("iface_%s", gofakeit.Word()) vlan2 := gofakeit.Number(10, 4094) diff --git a/fwprovider/provider_test.go b/fwprovider/provider_test.go index ed5beef1..73ae5c7d 100644 --- a/fwprovider/provider_test.go +++ b/fwprovider/provider_test.go @@ -1,3 +1,5 @@ +//go:build acceptance || all + /* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/fwprovider/test/resource_vm_test.go b/fwprovider/test/resource_vm_test.go index 14fe6d55..3bfe0c3c 100644 --- a/fwprovider/test/resource_vm_test.go +++ b/fwprovider/test/resource_vm_test.go @@ -1,11 +1,11 @@ +//go:build acceptance || all + /* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -//go:build acceptance || all - package test import ( diff --git a/fwprovider/vm/concurrency_test.go b/fwprovider/vm/concurrency_test.go index 755cbc02..06198ad7 100644 --- a/fwprovider/vm/concurrency_test.go +++ b/fwprovider/vm/concurrency_test.go @@ -1,3 +1,5 @@ +//go:build acceptance || all + /* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this