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

Updated telmate to Terraform-for-Proxmox #1

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ install: build

local-dev-install: build
@echo "Building this release $(CURRENT_VERSION_MICRO) on $(KERNEL)/$(ARCH)"
rm -rf ~/.terraform.d/plugins/localhost/telmate/proxmox
mkdir -p ~/.terraform.d/plugins/localhost/telmate/proxmox/$(MAJOR).$(MINOR).$(NEXT_MICRO)/$(KERNEL)_$(ARCH)/
cp bin/terraform-provider-proxmox ~/.terraform.d/plugins/localhost/telmate/proxmox/$(MAJOR).$(MINOR).$(NEXT_MICRO)/$(KERNEL)_$(ARCH)/
rm -rf ~/.terraform.d/plugins/localhost/Terraform-for-Proxmox/proxmox
mkdir -p ~/.terraform.d/plugins/localhost/Terraform-for-Proxmox/proxmox/$(MAJOR).$(MINOR).$(NEXT_MICRO)/$(KERNEL)_$(ARCH)/
cp bin/terraform-provider-proxmox ~/.terraform.d/plugins/localhost/Terraform-for-Proxmox/proxmox/$(MAJOR).$(MINOR).$(NEXT_MICRO)/$(KERNEL)_$(ARCH)/


clean:
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[![Build Status](https://travis-ci.com/Telmate/terraform-provider-proxmox.svg?branch=master)](https://travis-ci.com/Telmate/terraform-provider-proxmox)
[![Build Status](https://travis-ci.com/Terraform-for-Proxmox/terraform-provider-proxmox.svg?branch=master)](https://travis-ci.com/Terraform-for-Proxmox/terraform-provider-proxmox)

# Terraform provider plugin for Proxmox

This is a fork of https://github.com/Telmate/terraform-provider-proxmox which is no longer maintained by the company.

This repository provides a Terraform provider for
the [Proxmox virtualization platform](https://pve.proxmox.com/pve-docs/) and exposes Terraform resources to provision
QEMU VMs and LXC Containers.
Expand Down Expand Up @@ -48,4 +50,4 @@ see: [Debugger-Based Debugging](https://www.terraform.io/docs/extend/debugging.h
* [Proxmox documentation](https://pve.proxmox.com/pve-docs/)
* [Terraform](https://www.terraform.io/)
* [Terraform documentation](https://www.terraform.io/docs/index.html)
* [Recommended ISO builder](https://github.com/Telmate/terraform-ubuntu-proxmox-iso)

20 changes: 10 additions & 10 deletions docs/guides/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ To install this provider, copy and paste this code into your Terraform configura
terraform {
required_providers {
proxmox = {
source = "telmate/proxmox"
source = "Terraform-for-Proxmox/proxmox"
version = "<version tag>"
}
}
Expand Down Expand Up @@ -42,7 +42,7 @@ repository and run the following commands inside the cloned repository.

```shell
$ export GO111MODULE=on
$ go install github.com/Telmate/terraform-provider-proxmox/cmd/terraform-provider-proxmox
$ go install github.com/Terraform-for-Proxmox/terraform-provider-proxmox/cmd/terraform-provider-proxmox
```

Then create the executables. They are placed in the `bin` folder inside the repository.
Expand Down Expand Up @@ -70,7 +70,7 @@ must [conform to a new filesystem layout](https://github.com/hashicorp/terraform

> Terraform assumes that a provider without an explicit source address belongs to the "hashicorp" namespace on registry.terraform.io, which is not true for your in-house provider. Instead, you can use any domain name under your control to establish a virtual source registry to serve as a separate namespace for your local use.

Use the format: [host.domain]/telmate/proxmox/[version]/[arch].
Use the format: [host.domain]/Terraform-for-Proxmox/proxmox/[version]/[arch].

In our case, we will use `registry.example.com` as our virtual source registry in the following examples.

Expand All @@ -81,16 +81,16 @@ In our case, we will use `registry.example.com` as our virtual source registry i
$ PLUGIN_ARCH=linux_amd64

# Create the directory holding the newly built Terraform plugins
$ mkdir -p ~/.terraform.d/plugins/registry.example.com/telmate/proxmox/1.0.0/${PLUGIN_ARCH}
$ mkdir -p ~/.terraform.d/plugins/registry.example.com/Terraform-for-Proxmox/proxmox/1.0.0/${PLUGIN_ARCH}
```

Then, copy the executables to the directory you just created. You could also use the `make local-dev-install` target.
it's important to note that you aren't required to use a semver, and if you don't, then the path must be altered
accordingly.

```shell
$ cp bin/terraform-provider-proxmox ~/.terraform.d/plugins/registry.example.com/telmate/proxmox/1.0.0/${PLUGIN_ARCH}/
$ ls -al ~/.terraform.d/plugins/registry.example.com/telmate/proxmox/1.0.0/${PLUGIN_ARCH}/
$ cp bin/terraform-provider-proxmox ~/.terraform.d/plugins/registry.example.com/Terraform-for-Proxmox/proxmox/1.0.0/${PLUGIN_ARCH}/
$ ls -al ~/.terraform.d/plugins/registry.example.com/Terraform-for-Proxmox/proxmox/1.0.0/${PLUGIN_ARCH}/
-rwxrwxr-x 1 user user 20352759 Feb 22 21:51 terraform-provider-proxmox_v1.0.0*
```

Expand All @@ -101,7 +101,7 @@ $ cat main.tf
terraform {
required_providers {
proxmox = {
source = "telmate/proxmox"
source = "Terraform-for-Proxmox/proxmox"
version = ">=1.0.0"
}
}
Expand All @@ -124,9 +124,9 @@ You should see the following marking the successful plugin installation:
```shell
[...]
Initializing provider plugins...
- Finding registry.example.com/telmate/proxmox versions matching ">= 1.0.0"...
- Installing registry.example.com/telmate/proxmox v1.0.0...
- Installed registry.example.com/telmate/proxmox v1.0.0 (unauthenticated)
- Finding registry.example.com/Terraform-for-Proxmox/proxmox versions matching ">= 1.0.0"...
- Installing registry.example.com/Terraform-for-Proxmox/proxmox v1.0.0...
- Installed registry.example.com/Terraform-for-Proxmox/proxmox v1.0.0 (unauthenticated)

Terraform has been successfully initialized!
[...]
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module github.com/Telmate/terraform-provider-proxmox/v2
module github.com/Terraform-for-Proxmox/terraform-provider-proxmox/v2

go 1.20

require (
github.com/Telmate/proxmox-api-go v0.0.0-20231207182448-31826f2fdc39
github.com/Terraform-for-Proxmox/proxmox-api-go v0.0.0-20231221133235-10701d9a99db
github.com/google/uuid v1.5.0
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
github.com/hashicorp/terraform-plugin-sdk/v2 v2.31.0
Expand Down
5 changes: 2 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 h1:kkhsdkhsCvIsutKu5zLMgWtgh9YxGCNAw8Ad8hjwfYg=
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0=
github.com/Telmate/proxmox-api-go v0.0.0-20231207182448-31826f2fdc39 h1:0MvktdAFWIcc9F4IwQls2Em1F9z2LUZR1fSVm1PkKfM=
github.com/Telmate/proxmox-api-go v0.0.0-20231207182448-31826f2fdc39/go.mod h1:xOwyTd8uC2IiYfmjwCVU2fTTVToFCm9yxJzn4cd7rPw=
github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ=
github.com/Terraform-for-Proxmox/proxmox-api-go v0.0.0-20231221133235-10701d9a99db h1:k2UahCLgHS9lpqnwho8Y0fbz81SeiBt9nrsz++RDa1Q=
github.com/Terraform-for-Proxmox/proxmox-api-go v0.0.0-20231221133235-10701d9a99db/go.mod h1:eVMVJpq/K6YQ7LihmSV05YZ0XAmz/yQha0horw/molk=
github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo=
github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec=
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"flag"

"github.com/Telmate/terraform-provider-proxmox/v2/proxmox"
"github.com/Terraform-for-Proxmox/terraform-provider-proxmox/v2/proxmox"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/plugin"
)
Expand All @@ -14,7 +14,7 @@ func main() {
var pluginPath string

flag.BoolVar(&debugMode, "debug", false, "set to true to run the provider with support for debuggers like delve")
flag.StringVar(&pluginPath, "registry", "registry.terraform.io/telmate/proxmox", "specify path, useful for local debugging")
flag.StringVar(&pluginPath, "registry", "registry.terraform.io/Terraform-for-Proxmox/proxmox", "specify path, useful for local debugging")
flag.Parse()

opts := &plugin.ServeOpts{ProviderFunc: func() *schema.Provider {
Expand Down
2 changes: 1 addition & 1 deletion proxmox/data_ha_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import (
"sort"

"github.com/Telmate/proxmox-api-go/proxmox"
"github.com/Terraform-for-Proxmox/proxmox-api-go/proxmox"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func DataHAGroup() *schema.Resource {

Check failure on line 10 in proxmox/data_ha_group.go

View workflow job for this annotation

GitHub Actions / audit

exported function DataHAGroup should have comment or be unexported
return &schema.Resource{
Read: dataReadHAGroup,
Schema: map[string]*schema.Schema{
Expand Down
2 changes: 1 addition & 1 deletion proxmox/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"strings"
"sync"

pxapi "github.com/Telmate/proxmox-api-go/proxmox"
pxapi "github.com/Terraform-for-Proxmox/proxmox-api-go/proxmox"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

Expand Down Expand Up @@ -193,7 +193,7 @@
}

//permission check
minimum_permissions := []string{

Check failure on line 196 in proxmox/provider.go

View workflow job for this annotation

GitHub Actions / audit

don't use underscores in Go names; var minimum_permissions should be minimumPermissions
"Datastore.AllocateSpace",
"Datastore.Audit",
"Pool.Allocate",
Expand Down Expand Up @@ -265,19 +265,19 @@
LogLevels: logLevels,
DangerouslyIgnoreUnknownAttributes: d.Get("pm_dangerously_ignore_unknown_attributes").(bool),
}, nil
} else {

Check failure on line 268 in proxmox/provider.go

View workflow job for this annotation

GitHub Actions / audit

if block ends with a return statement, so drop this else and outdent its block
err = fmt.Errorf("permissions for user/token %s are not sufficient, please provide also the following permissions that are missing: %v", userID.ToString(), permDiff)
return nil, err
}
}

func getClient(pm_api_url string,

Check failure on line 274 in proxmox/provider.go

View workflow job for this annotation

GitHub Actions / audit

don't use underscores in Go names; func parameter pm_api_url should be pmAPIURL
pm_user string,

Check failure on line 275 in proxmox/provider.go

View workflow job for this annotation

GitHub Actions / audit

don't use underscores in Go names; func parameter pm_user should be pmUser
pm_password string,

Check failure on line 276 in proxmox/provider.go

View workflow job for this annotation

GitHub Actions / audit

don't use underscores in Go names; func parameter pm_password should be pmPassword
pm_api_token_id string,

Check failure on line 277 in proxmox/provider.go

View workflow job for this annotation

GitHub Actions / audit

don't use underscores in Go names; func parameter pm_api_token_id should be pmAPITokenID
pm_api_token_secret string,

Check failure on line 278 in proxmox/provider.go

View workflow job for this annotation

GitHub Actions / audit

don't use underscores in Go names; func parameter pm_api_token_secret should be pmAPITokenSecret
pm_otp string,

Check failure on line 279 in proxmox/provider.go

View workflow job for this annotation

GitHub Actions / audit

don't use underscores in Go names; func parameter pm_otp should be pmOtp
pm_tls_insecure bool,

Check failure on line 280 in proxmox/provider.go

View workflow job for this annotation

GitHub Actions / audit

don't use underscores in Go names; func parameter pm_tls_insecure should be pmTLSInsecure
pm_http_headers string,
pm_timeout int,
pm_debug bool,
Expand Down
2 changes: 1 addition & 1 deletion proxmox/resource_cloud_init_disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"io"
"strings"

"github.com/Telmate/proxmox-api-go/proxmox"
"github.com/Terraform-for-Proxmox/proxmox-api-go/proxmox"
"github.com/kdomanski/iso9660"

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
Expand Down
2 changes: 1 addition & 1 deletion proxmox/resource_lxc.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"
"time"

pxapi "github.com/Telmate/proxmox-api-go/proxmox"
pxapi "github.com/Terraform-for-Proxmox/proxmox-api-go/proxmox"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

Expand Down
2 changes: 1 addition & 1 deletion proxmox/resource_lxc_disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"strings"

pxapi "github.com/Telmate/proxmox-api-go/proxmox"
pxapi "github.com/Terraform-for-Proxmox/proxmox-api-go/proxmox"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

Expand Down
2 changes: 1 addition & 1 deletion proxmox/resource_storage_iso.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"os"
"strings"

"github.com/Telmate/proxmox-api-go/proxmox"
"github.com/Terraform-for-Proxmox/proxmox-api-go/proxmox"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

Expand Down
4 changes: 2 additions & 2 deletions proxmox/resource_vm_qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"strings"
"time"

pxapi "github.com/Telmate/proxmox-api-go/proxmox"
pxapi "github.com/Terraform-for-Proxmox/proxmox-api-go/proxmox"
"github.com/google/uuid"
"github.com/hashicorp/go-cty/cty"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
Expand Down Expand Up @@ -1155,7 +1155,7 @@ func resourceVmQemuCreate(ctx context.Context, d *schema.ResourceData, meta inte
// update the current working state to use the appropriate file specification
// proxmox needs so we can correctly update the existing disks (post-clone)
// instead of accidentially causing the existing disk to be detached.
// see https://github.com/Telmate/terraform-provider-proxmox/issues/239
// see https://github.com/Terraform-for-Proxmox/terraform-provider-proxmox/issues/239
for slot, disk := range config_post_clone.QemuDisks {
// only update the desired configuration if it was not set by the user
// we do not want to overwrite the desired config with the results from
Expand Down
4 changes: 2 additions & 2 deletions proxmox/resource_vm_qemu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ func TestAccProxmoxVmQemu_BasicCreateClone(t *testing.T) {
resource.TestCheckResourceAttr(resourcePath, "name", resourceName),
resource.TestCheckResourceAttr(clonePath, "name", cloneName),
// check for unused_disk.0.file existance as that means an extra disk popped up
// which would be a regression of https://github.com/Telmate/terraform-provider-proxmox/issues/239
// which would be a regression of https://github.com/Terraform-for-Proxmox/terraform-provider-proxmox/issues/239
resource.TestCheckNoResourceAttr(clonePath, "unused_disk.0.file"),
),
},
Expand All @@ -311,7 +311,7 @@ func TestAccProxmoxVmQemu_CreateCloneWithTwoDisks(t *testing.T) {
resource.TestCheckResourceAttr(resourcePath, "name", resourceName),
resource.TestCheckResourceAttr(clonePath, "name", cloneName),
// check for unused_disk.0.file existance as that means an extra disk popped up
// which would be a regression of https://github.com/Telmate/terraform-provider-proxmox/issues/239
// which would be a regression of https://github.com/Terraform-for-Proxmox/terraform-provider-proxmox/issues/239
resource.TestCheckNoResourceAttr(clonePath, "unused_disk.0.file"),
resource.TestCheckResourceAttr(clonePath, "disk.0.size", "2G"),
resource.TestCheckResourceAttr(clonePath, "disk.1.size", "3G"),
Expand Down
2 changes: 1 addition & 1 deletion proxmox/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"testing"
"time"

pxapi "github.com/Telmate/proxmox-api-go/proxmox"
pxapi "github.com/Terraform-for-Proxmox/proxmox-api-go/proxmox"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/rs/zerolog"
)
Expand Down
Loading