diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 23fcbccc..4d327a9e 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,8 +1,8 @@ --- name: Bug report about: Create a report to help us improve -title: "[BUG]" -labels: '' +title: "" +labels: 'bug' assignees: '' --- diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index e0c0168b..a2fb6728 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,8 +1,8 @@ --- name: Feature request about: Suggest an idea for this project -title: "[FEATURE]" -labels: '' +title: "" +labels: 'enhancement' assignees: '' --- diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..9d24fb90 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,31 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + - package-ecosystem: "gomod" + directory: "/" + ignore: + - dependency-name: "golang.org/x/tools" + - dependency-name: "google.golang.org/grpc" + schedule: + interval: "daily" + - package-ecosystem: "gomod" + directory: "/awsproviderlint" + ignore: + - dependency-name: "golang.org/x/tools" + - dependency-name: "google.golang.org/grpc" + schedule: + interval: "daily" + - package-ecosystem: "gomod" + directory: "/tools" + ignore: + - dependency-name: "golang.org/x/tools" + - dependency-name: "google.golang.org/grpc" + schedule: + interval: "daily" + - package-ecosystem: "terraform" + directory: "/infrastructure/repository" + schedule: + interval: "daily" diff --git a/.github/workflows/generate_changelog.yml b/.github/workflows/generate_changelog.yml new file mode 100644 index 00000000..244092c2 --- /dev/null +++ b/.github/workflows/generate_changelog.yml @@ -0,0 +1,28 @@ +name: Generate CHANGELOG + +on: + pull_request: + types: [closed] + + release: + types: [published] + + issues: + types: [closed, edited] + +jobs: + generate_changelog: + runs-on: ubuntu-latest + name: Generate changelog for master branch + steps: + - uses: actions/checkout@v2 + + - name: Generate changelog + uses: charmixer/auto-changelog-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Update Changelog for PR + file_pattern: CHANGELOG.md diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7f57a235..1694c312 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,34 +1,71 @@ -name: Test changes +name: Tests on: pull_request: + paths-ignore: + - 'README.md' + push: branches: - main - - master - - 'release/v*' + - "release/**" + paths-ignore: + - 'README.md' jobs: - test: - name: Pull Request - runs-on: ubuntu-20.04 + # ensure the code builds... + build: + name: Build + runs-on: ubuntu-latest + timeout-minutes: 5 steps: - - - name: Checkout the code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Install and configure Go + + - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.15 - - - name: Install and configure GoReleaser + go-version: '1.16' + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Get dependencies + run: | + go mod download + - name: Build + run: | + go build -v . + # run acceptance tests in a matrix with Terraform core versions + test: + name: Matrix Test + needs: build + runs-on: ubuntu-latest + timeout-minutes: 15 + strategy: + fail-fast: false + matrix: + # list whatever Terraform versions here you would like to support + terraform: + - '0.14.11' + - '0.15.5' + - '1.0.6' + steps: + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: '1.16' + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Get dependencies + run: | + go mod download + + - name: TF acceptance tests + timeout-minutes: 10 env: - GORELEASER_VERSION: '0.155.1' + TF_ACC: "1" + TF_ACC_TERRAFORM_VERSION: ${{ matrix.terraform }} + run: | - curl -sL -o goreleaser_amd64.deb "https://github.com/goreleaser/goreleaser/releases/download/v${GORELEASER_VERSION}/goreleaser_amd64.deb" - sudo dpkg -i goreleaser_amd64.deb - rm -f goreleaser_amd64.deb - - - name: Create snapshot - run: | - goreleaser build --parallelism 2 --rm-dist --snapshot --timeout 1h + go test -v -cover ./... diff --git a/.github_changelog_generator b/.github_changelog_generator new file mode 100644 index 00000000..56966475 --- /dev/null +++ b/.github_changelog_generator @@ -0,0 +1,3 @@ +since_tag=v0.4.4 +add-sections={"dependencies":{"prefix":"**Dependency updates:**","labels":["dependencies"]}} +pr-wo-labels=false diff --git a/.go-version b/.go-version new file mode 100644 index 00000000..15b989e3 --- /dev/null +++ b/.go-version @@ -0,0 +1 @@ +1.16.0 diff --git a/.goreleaser.yml b/.goreleaser.yml index 59cdb41b..fe1eb97f 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,48 +1,47 @@ +archives: + - files: + - none* + format: zip + name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' before: hooks: - - go mod tidy + - go mod download builds: - - env: - - CGO_ENABLED=0 - mod_timestamp: '{{ .CommitTimestamp }}' + - binary: '{{ .ProjectName }}_{{ .Version }}' flags: - -trimpath - ldflags: - - '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}' - goos: - - freebsd - - windows - - linux - - darwin goarch: - - amd64 - '386' + - amd64 - arm - arm64 + goos: + - darwin + - freebsd + - linux + - windows ignore: - - goos: darwin - goarch: '386' - binary: '{{ .ProjectName }}_v{{ .Version }}' -archives: - - format: zip - name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' + - goarch: '386' + goos: darwin + ldflags: + - -s -w -X version.ProviderVersion={{.Version}} + mod_timestamp: '{{ .CommitTimestamp }}' +changelog: + skip: true checksum: name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS' algorithm: sha256 +env: + - CGO_ENABLED=0 +release: + disable: true signs: - artifacts: checksum args: - "--batch" - "--local-user" - - "{{ .Env.GPG_FINGERPRINT }}" + - "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key - "--output" - "${signature}" - - "--passphrase-fd" - - "0" - "--detach-sign" - "${artifact}" - stdin_file: /tmp/.gpg_passphrase -release: - draft: false -changelog: - skip: true diff --git a/HISTORY.md b/HISTORY.md new file mode 100644 index 00000000..f87d8641 --- /dev/null +++ b/HISTORY.md @@ -0,0 +1,143 @@ +## v0.4.4 + +BUG FIXES: + +* resource/virtual_environment_vm: Fix watchdog deserialization issue + +## v0.4.3 + +BUG FIXES: + +* resource/virtual_environment_container: Fix IP initialization issue + +## v0.4.2 + +BUG FIXES: + +* resource/virtual_environment_vm: Fix `disk.file_id` diff issue +* resource/virtual_environment_vm: Fix disk resizing issue + +OTHER: + +* provider/example: Remove support for Terraform v0.11 and older +* provider/makefile: Update to use plugin caching to support local builds + +## v0.4.1 + +OTHER: + +* provider/docs: Fix issue with navigational link titles in Terraform Registry + +## v0.4.0 + +FEATURES: + +* **New Data Source:** `proxmox_virtual_environment_time` +* **New Resource:** `proxmox_virtual_environment_time` + +BREAKING CHANGES: + +* resource/virtual_environment_vm: `interface` is now required to create disks + + ``` + disk { + datastore_id = "local-lvm" + file_id = "${proxmox_virtual_environment_file.ubuntu_cloud_image.id}" + interface = "scsi0" + } + ``` + +ENHANCEMENTS: + +* provider/configuration: Add `virtual_environment.otp` argument for TOTP support +* resource/virtual_environment_vm: Clone supports resize and datastore_id for moving disks +* resource/virtual_environment_vm: Bulk clones can now use retries as argument to try multiple times to create a clone. +* resource/virtual_environment_vm: `on_boot` parameter can be used to start a VM after the Node has been rebooted. +* resource/virtual_environment_vm: `reboot` parameter can be used to reboot a VM after creation +* resource/virtual_environment_vm: Has now multiple new parameters to set timeouts for the vm creation/cloning `timeout_clone`, `timeout_move_disk`, `timeout_reboot`, `timeout_shutdown_vm`, `timeout_start_vm`, `timeout_stop_vm` + +BUG FIXES: + +* library/virtual_environment_nodes: Fix node IP address format +* library/virtual_environment_nodes: Fix WaitForNodeTask now detects errors correctly +* library/virtual_environment_vm: Fix CloneVM now waits for the task to be finished and detect errors. +* resource/virtual_environment_container: Fix VM ID collision when `vm_id` is not specified +* resource/virtual_environment_vm: Fix VM ID collision when `vm_id` is not specified +* resource/virtual_environment_vm: Fix disk import issue when importing from directory-based datastores +* resource/virtual_environment_vm: Fix handling of storage name - correct handling of `-` + +WORKAROUNDS: + +* resource/virtual_environment_vm: Ignore default value for `cpu.architecture` when the root account is not being used + +## 0.3.0 + +ENHANCEMENTS: + +* resource/virtual_environment_container: Add `clone` argument +* resource/virtual_environment_container: Add `disk` argument +* resource/virtual_environment_container: Add `template` argument +* resource/virtual_environment_vm: Add `agent.timeout` argument +* resource/virtual_environment_vm: Add `audio_device` argument +* resource/virtual_environment_vm: Add `clone` argument +* resource/virtual_environment_vm: Add `initialization.datastore_id` argument +* resource/virtual_environment_vm: Add `serial_device` argument +* resource/virtual_environment_vm: Add `template` argument + +BUG FIXES: + +* resource/virtual_environment_container: Fix `network_interface` deletion issue +* resource/virtual_environment_vm: Fix `network_device` deletion issue +* resource/virtual_environment_vm: Fix slow refresh when VM is stopped and agent is enabled +* resource/virtual_environment_vm: Fix crash caused by assuming IP addresses are always reported by the QEMU agent +* resource/virtual_environment_vm: Fix timeout issue while waiting for IP addresses to be reported by the QEMU agent + +OTHER: + +* provider/docs: Add HTML documentation powered by GitHub Pages + +## 0.2.0 + +BREAKING CHANGES: + +* resource/virtual_environment_vm: Rename `cloud_init` argument to `initialization` +* resource/virtual_environment_vm: Rename `os_type` argument to `operating_system.type` + +FEATURES: + +* **New Data Source:** `proxmox_virtual_environment_dns` +* **New Data Source:** `proxmox_virtual_environment_hosts` +* **New Resource:** `proxmox_virtual_environment_certificate` +* **New Resource:** `proxmox_virtual_environment_container` +* **New Resource:** `proxmox_virtual_environment_dns` +* **New Resource:** `proxmox_virtual_environment_hosts` + +ENHANCEMENTS: + +* resource/virtual_environment_vm: Add `acpi` argument +* resource/virtual_environment_vm: Add `bios` argument +* resource/virtual_environment_vm: Add `cpu.architecture`, `cpu.flags`, `cpu.type` and `cpu.units` arguments +* resource/virtual_environment_vm: Add `tablet_device` argument +* resource/virtual_environment_vm: Add `vga` argument + +## 0.1.0 + +FEATURES: + +* **New Data Source:** `proxmox_virtual_environment_datastores` +* **New Data Source:** `proxmox_virtual_environment_group` +* **New Data Source:** `proxmox_virtual_environment_groups` +* **New Data Source:** `proxmox_virtual_environment_nodes` +* **New Data Source:** `proxmox_virtual_environment_pool` +* **New Data Source:** `proxmox_virtual_environment_pools` +* **New Data Source:** `proxmox_virtual_environment_role` +* **New Data Source:** `proxmox_virtual_environment_roles` +* **New Data Source:** `proxmox_virtual_environment_user` +* **New Data Source:** `proxmox_virtual_environment_users` +* **New Data Source:** `proxmox_virtual_environment_version` +* **New Resource:** `proxmox_virtual_environment_file` +* **New Resource:** `proxmox_virtual_environment_group` +* **New Resource:** `proxmox_virtual_environment_pool` +* **New Resource:** `proxmox_virtual_environment_role` +* **New Resource:** `proxmox_virtual_environment_user` +* **New Resource:** `proxmox_virtual_environment_vm` diff --git a/README.md b/README.md index 7a8e3efd..47e3fe65 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ A Terraform Provider which adds support for Proxmox solutions. ## Requirements - [Terraform](https://www.terraform.io/downloads.html) 0.13+ -- [Go](https://golang.org/doc/install) 1.15+ (to build the provider plugin) +- [Go](https://golang.org/doc/install) 1.16+ (to build the provider plugin) - [GoReleaser](https://goreleaser.com/install/) 0.155+ (to build the provider plugin) ## Table of Contents