mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-07-01 19:12:59 +00:00
fix(provider): sanitize PVE endpoint value (#686)
Ignore `/api2/json` path in case it is present in the endpoint. Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
This commit is contained in:
parent
3fd6b6b2ce
commit
3f582d8163
@ -186,7 +186,8 @@ Proxmox `provider` block:
|
||||
|
||||
- `endpoint` - (Required) The endpoint for the Proxmox Virtual Environment
|
||||
API (can also be sourced from `PROXMOX_VE_ENDPOINT`). Usually this is
|
||||
`https://<your-cluster-endpoint>:8006/`.
|
||||
`https://<your-cluster-endpoint>:8006/`. **Do not** include `/api2/json` at
|
||||
the end.
|
||||
- `insecure` - (Optional) Whether to skip the TLS verification step (can
|
||||
also be sourced from `PROXMOX_VE_INSECURE`). If omitted, defaults
|
||||
to `false`.
|
||||
|
@ -84,6 +84,9 @@ func NewConnection(endpoint string, insecure bool) (*Connection, error) {
|
||||
transport = logging.NewLoggingHTTPTransport(transport)
|
||||
}
|
||||
|
||||
// make sure the path does not contain "/api2/json"
|
||||
u.Path = ""
|
||||
|
||||
return &Connection{
|
||||
endpoint: strings.TrimRight(u.String(), "/"),
|
||||
httpClient: &http.Client{
|
||||
|
Loading…
Reference in New Issue
Block a user