mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-07-09 15:25:01 +00:00
chore(deps): update golangci/golangci-lint (v2.1.6 → v2.2.1) (#2013)
* chore(deps): update golangci/golangci-lint (v2.1.6 → v2.2.1) | datasource | package | from | to | | --------------- | ---------------------- | ------ | ------ | | github-releases | golangci/golangci-lint | v2.1.6 | v2.2.1 | * chore: update rules & run linter Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com> --------- Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
This commit is contained in:
parent
ebb0fc74af
commit
6a8f367c46
@ -1,6 +1,6 @@
|
|||||||
FROM golang:1.24.4@sha256:20a022e5112a144aa7b7aeb3f22ebf2cdaefcc4aac0d64e8deeee8cdc18b9c0f
|
FROM golang:1.24.4@sha256:20a022e5112a144aa7b7aeb3f22ebf2cdaefcc4aac0d64e8deeee8cdc18b9c0f
|
||||||
|
|
||||||
ARG GOLANGCI_LINT_VERSION=2.1.6 # renovate: depName=golangci/golangci-lint datasource=github-releases
|
ARG GOLANGCI_LINT_VERSION=2.2.1 # renovate: depName=golangci/golangci-lint datasource=github-releases
|
||||||
|
|
||||||
RUN apt update && apt upgrade -y && \
|
RUN apt update && apt upgrade -y && \
|
||||||
apt-get install --no-install-recommends -y ca-certificates curl gnupg lsb-release jq zsh neovim gh && \
|
apt-get install --no-install-recommends -y ca-certificates curl gnupg lsb-release jq zsh neovim gh && \
|
||||||
|
2
.github/workflows/golangci-lint.yml
vendored
2
.github/workflows/golangci-lint.yml
vendored
@ -42,6 +42,6 @@ jobs:
|
|||||||
if: ${{ steps.filter.outputs.go == 'true' || steps.filter.outputs.linter == 'true'}}
|
if: ${{ steps.filter.outputs.go == 'true' || steps.filter.outputs.linter == 'true'}}
|
||||||
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8
|
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8
|
||||||
with:
|
with:
|
||||||
version: v2.1.6 # renovate: depName=golangci/golangci-lint datasource=github-releases
|
version: v2.2.1 # renovate: depName=golangci/golangci-lint datasource=github-releases
|
||||||
skip-cache: true
|
skip-cache: true
|
||||||
args: -v --timeout=10m
|
args: -v --timeout=10m
|
||||||
|
@ -17,6 +17,7 @@ linters:
|
|||||||
- mnd
|
- mnd
|
||||||
- nestif
|
- nestif
|
||||||
- nlreturn
|
- nlreturn
|
||||||
|
- noinlineerr
|
||||||
- perfsprint
|
- perfsprint
|
||||||
- rowserrcheck
|
- rowserrcheck
|
||||||
- tagliatelle
|
- tagliatelle
|
||||||
@ -24,6 +25,7 @@ linters:
|
|||||||
- tparallel
|
- tparallel
|
||||||
- varnamelen
|
- varnamelen
|
||||||
- wastedassign
|
- wastedassign
|
||||||
|
- wsl
|
||||||
settings:
|
settings:
|
||||||
cyclop:
|
cyclop:
|
||||||
max-complexity: 25
|
max-complexity: 25
|
||||||
@ -49,6 +51,10 @@ linters:
|
|||||||
wrapcheck:
|
wrapcheck:
|
||||||
ignore-package-globs:
|
ignore-package-globs:
|
||||||
- github.com/bpg/terraform-provider-proxmox/*
|
- github.com/bpg/terraform-provider-proxmox/*
|
||||||
|
wsl_v5:
|
||||||
|
allow-first-in-block: true
|
||||||
|
allow-whole-block: false
|
||||||
|
branch-max-lines: 2
|
||||||
exclusions:
|
exclusions:
|
||||||
generated: lax
|
generated: lax
|
||||||
presets:
|
presets:
|
||||||
|
2
Makefile
2
Makefile
@ -3,7 +3,7 @@ TARGETS=darwin linux windows
|
|||||||
TERRAFORM_PLUGIN_EXTENSION=
|
TERRAFORM_PLUGIN_EXTENSION=
|
||||||
VERSION=0.78.2# x-release-please-version
|
VERSION=0.78.2# x-release-please-version
|
||||||
|
|
||||||
GOLANGCI_LINT_VERSION=2.1.6# renovate: depName=golangci/golangci-lint datasource=github-releases
|
GOLANGCI_LINT_VERSION=2.2.1# renovate: depName=golangci/golangci-lint datasource=github-releases
|
||||||
|
|
||||||
# check if opentofu is installed and use it if it is,
|
# check if opentofu is installed and use it if it is,
|
||||||
# otherwise use terraform
|
# otherwise use terraform
|
||||||
|
@ -190,6 +190,7 @@ func (r *userTokenResource) Create(ctx context.Context, req resource.CreateReque
|
|||||||
|
|
||||||
func (r *userTokenResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
|
func (r *userTokenResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
|
||||||
var state userTokenModel
|
var state userTokenModel
|
||||||
|
|
||||||
diags := req.State.Get(ctx, &state)
|
diags := req.State.Get(ctx, &state)
|
||||||
resp.Diagnostics.Append(diags...)
|
resp.Diagnostics.Append(diags...)
|
||||||
|
|
||||||
|
@ -32,12 +32,14 @@ type baseACMEPluginModel struct {
|
|||||||
// acmePluginModel maps the schema data for an ACME plugin.
|
// acmePluginModel maps the schema data for an ACME plugin.
|
||||||
type acmePluginModel struct {
|
type acmePluginModel struct {
|
||||||
baseACMEPluginModel
|
baseACMEPluginModel
|
||||||
|
|
||||||
Type types.String `tfsdk:"type"`
|
Type types.String `tfsdk:"type"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// acmePluginCreateModel maps the schema data for an ACME plugin.
|
// acmePluginCreateModel maps the schema data for an ACME plugin.
|
||||||
type acmePluginCreateModel struct {
|
type acmePluginCreateModel struct {
|
||||||
baseACMEPluginModel
|
baseACMEPluginModel
|
||||||
|
|
||||||
// Flag to disable the config
|
// Flag to disable the config
|
||||||
Disable types.Bool `tfsdk:"disable"`
|
Disable types.Bool `tfsdk:"disable"`
|
||||||
}
|
}
|
||||||
|
@ -719,6 +719,7 @@ func (r *clusterOptionsResource) Create(
|
|||||||
resp *resource.CreateResponse,
|
resp *resource.CreateResponse,
|
||||||
) {
|
) {
|
||||||
var plan clusterOptionsModel
|
var plan clusterOptionsModel
|
||||||
|
|
||||||
diags := req.Plan.Get(ctx, &plan)
|
diags := req.Plan.Get(ctx, &plan)
|
||||||
resp.Diagnostics.Append(diags...)
|
resp.Diagnostics.Append(diags...)
|
||||||
|
|
||||||
@ -776,6 +777,7 @@ func (r *clusterOptionsResource) read(ctx context.Context, model *clusterOptions
|
|||||||
func (r *clusterOptionsResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
|
func (r *clusterOptionsResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
|
||||||
// Get current state
|
// Get current state
|
||||||
var state clusterOptionsModel
|
var state clusterOptionsModel
|
||||||
|
|
||||||
diags := req.State.Get(ctx, &state)
|
diags := req.State.Get(ctx, &state)
|
||||||
resp.Diagnostics.Append(diags...)
|
resp.Diagnostics.Append(diags...)
|
||||||
|
|
||||||
@ -899,6 +901,7 @@ func (r *clusterOptionsResource) Delete(
|
|||||||
resp *resource.DeleteResponse,
|
resp *resource.DeleteResponse,
|
||||||
) {
|
) {
|
||||||
var state clusterOptionsModel
|
var state clusterOptionsModel
|
||||||
|
|
||||||
diags := req.State.Get(ctx, &state)
|
diags := req.State.Get(ctx, &state)
|
||||||
resp.Diagnostics.Append(diags...)
|
resp.Diagnostics.Append(diags...)
|
||||||
|
|
||||||
|
@ -268,6 +268,7 @@ func (r *linuxBridgeResource) Configure(
|
|||||||
//nolint:dupl
|
//nolint:dupl
|
||||||
func (r *linuxBridgeResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
|
func (r *linuxBridgeResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
|
||||||
var plan linuxBridgeResourceModel
|
var plan linuxBridgeResourceModel
|
||||||
|
|
||||||
diags := req.Plan.Get(ctx, &plan)
|
diags := req.Plan.Get(ctx, &plan)
|
||||||
resp.Diagnostics.Append(diags...)
|
resp.Diagnostics.Append(diags...)
|
||||||
|
|
||||||
@ -355,6 +356,7 @@ func (r *linuxBridgeResource) read(ctx context.Context, model *linuxBridgeResour
|
|||||||
func (r *linuxBridgeResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
|
func (r *linuxBridgeResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
|
||||||
// Get current state
|
// Get current state
|
||||||
var state linuxBridgeResourceModel
|
var state linuxBridgeResourceModel
|
||||||
|
|
||||||
diags := req.State.Get(ctx, &state)
|
diags := req.State.Get(ctx, &state)
|
||||||
resp.Diagnostics.Append(diags...)
|
resp.Diagnostics.Append(diags...)
|
||||||
|
|
||||||
@ -461,6 +463,7 @@ func (r *linuxBridgeResource) Update(ctx context.Context, req resource.UpdateReq
|
|||||||
//nolint:dupl
|
//nolint:dupl
|
||||||
func (r *linuxBridgeResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
|
func (r *linuxBridgeResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
|
||||||
var state linuxBridgeResourceModel
|
var state linuxBridgeResourceModel
|
||||||
|
|
||||||
diags := req.State.Get(ctx, &state)
|
diags := req.State.Get(ctx, &state)
|
||||||
resp.Diagnostics.Append(diags...)
|
resp.Diagnostics.Append(diags...)
|
||||||
|
|
||||||
|
@ -240,6 +240,7 @@ func (r *linuxVLANResource) Configure(
|
|||||||
//nolint:dupl
|
//nolint:dupl
|
||||||
func (r *linuxVLANResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
|
func (r *linuxVLANResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
|
||||||
var plan linuxVLANResourceModel
|
var plan linuxVLANResourceModel
|
||||||
|
|
||||||
diags := req.Plan.Get(ctx, &plan)
|
diags := req.Plan.Get(ctx, &plan)
|
||||||
resp.Diagnostics.Append(diags...)
|
resp.Diagnostics.Append(diags...)
|
||||||
|
|
||||||
@ -319,6 +320,7 @@ func (r *linuxVLANResource) read(ctx context.Context, model *linuxVLANResourceMo
|
|||||||
func (r *linuxVLANResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
|
func (r *linuxVLANResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
|
||||||
// Get current state
|
// Get current state
|
||||||
var state linuxVLANResourceModel
|
var state linuxVLANResourceModel
|
||||||
|
|
||||||
diags := req.State.Get(ctx, &state)
|
diags := req.State.Get(ctx, &state)
|
||||||
resp.Diagnostics.Append(diags...)
|
resp.Diagnostics.Append(diags...)
|
||||||
|
|
||||||
@ -409,6 +411,7 @@ func (r *linuxVLANResource) Update(ctx context.Context, req resource.UpdateReque
|
|||||||
//nolint:dupl
|
//nolint:dupl
|
||||||
func (r *linuxVLANResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
|
func (r *linuxVLANResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
|
||||||
var state linuxVLANResourceModel
|
var state linuxVLANResourceModel
|
||||||
|
|
||||||
diags := req.State.Get(ctx, &state)
|
diags := req.State.Get(ctx, &state)
|
||||||
resp.Diagnostics.Append(diags...)
|
resp.Diagnostics.Append(diags...)
|
||||||
|
|
||||||
|
@ -323,6 +323,7 @@ func (r *downloadFileResource) Create(
|
|||||||
resp *resource.CreateResponse,
|
resp *resource.CreateResponse,
|
||||||
) {
|
) {
|
||||||
var plan downloadFileModel
|
var plan downloadFileModel
|
||||||
|
|
||||||
diags := req.Plan.Get(ctx, &plan)
|
diags := req.Plan.Get(ctx, &plan)
|
||||||
resp.Diagnostics.Append(diags...)
|
resp.Diagnostics.Append(diags...)
|
||||||
|
|
||||||
@ -370,7 +371,6 @@ func (r *downloadFileResource) Create(
|
|||||||
storageClient := nodesClient.Storage(plan.Storage.ValueString())
|
storageClient := nodesClient.Storage(plan.Storage.ValueString())
|
||||||
|
|
||||||
err = storageClient.DownloadFileByURL(ctx, &downloadFileReq)
|
err = storageClient.DownloadFileByURL(ctx, &downloadFileReq)
|
||||||
|
|
||||||
if isErrFileAlreadyExists(err) && plan.OverwriteUnmanaged.ValueBool() {
|
if isErrFileAlreadyExists(err) && plan.OverwriteUnmanaged.ValueBool() {
|
||||||
fileID := plan.Content.ValueString() + "/" + plan.FileName.ValueString()
|
fileID := plan.Content.ValueString() + "/" + plan.FileName.ValueString()
|
||||||
|
|
||||||
@ -481,6 +481,7 @@ func (r *downloadFileResource) Read(
|
|||||||
resp *resource.ReadResponse,
|
resp *resource.ReadResponse,
|
||||||
) {
|
) {
|
||||||
var state downloadFileModel
|
var state downloadFileModel
|
||||||
|
|
||||||
diags := req.State.Get(ctx, &state)
|
diags := req.State.Get(ctx, &state)
|
||||||
|
|
||||||
resp.Diagnostics.Append(diags...)
|
resp.Diagnostics.Append(diags...)
|
||||||
|
@ -49,6 +49,7 @@ func FillCreateBody(ctx context.Context, planValue Value, body *vms.CreateReques
|
|||||||
}
|
}
|
||||||
|
|
||||||
var plan map[string]Model
|
var plan map[string]Model
|
||||||
|
|
||||||
d := planValue.ElementsAs(ctx, &plan, false)
|
d := planValue.ElementsAs(ctx, &plan, false)
|
||||||
diags.Append(d...)
|
diags.Append(d...)
|
||||||
|
|
||||||
@ -76,6 +77,7 @@ func FillUpdateBody(
|
|||||||
}
|
}
|
||||||
|
|
||||||
var plan, state map[string]Model
|
var plan, state map[string]Model
|
||||||
|
|
||||||
d := planValue.ElementsAs(ctx, &plan, false)
|
d := planValue.ElementsAs(ctx, &plan, false)
|
||||||
diags.Append(d...)
|
diags.Append(d...)
|
||||||
d = stateValue.ElementsAs(ctx, &state, false)
|
d = stateValue.ElementsAs(ctx, &state, false)
|
||||||
|
@ -265,6 +265,7 @@ func (p *proxmoxProvider) Configure(
|
|||||||
|
|
||||||
// Retrieve provider data from configuration
|
// Retrieve provider data from configuration
|
||||||
var cfg proxmoxProviderModel
|
var cfg proxmoxProviderModel
|
||||||
|
|
||||||
diags := req.Config.Get(ctx, &cfg)
|
diags := req.Config.Get(ctx, &cfg)
|
||||||
resp.Diagnostics.Append(diags...)
|
resp.Diagnostics.Append(diags...)
|
||||||
|
|
||||||
|
@ -195,6 +195,7 @@ func (e *Environment) RenderConfig(cfg string, opt ...RenderConfigOption) string
|
|||||||
require.NoError(e.t, err)
|
require.NoError(e.t, err)
|
||||||
|
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
|
|
||||||
err = tmpl.Execute(&buf, e.templateVars)
|
err = tmpl.Execute(&buf, e.templateVars)
|
||||||
require.NoError(e.t, err)
|
require.NoError(e.t, err)
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ var (
|
|||||||
// PathType is a type that represents a path of a hardware mapping.
|
// PathType is a type that represents a path of a hardware mapping.
|
||||||
type PathType struct {
|
type PathType struct {
|
||||||
basetypes.StringType
|
basetypes.StringType
|
||||||
|
|
||||||
Type proxmoxtypes.Type
|
Type proxmoxtypes.Type
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,8 +52,8 @@ func TestPathValueFromTerraform(t *testing.T) {
|
|||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
ctx := t.Context()
|
ctx := t.Context()
|
||||||
val, err := PathType{}.ValueFromTerraform(ctx, test.val)
|
|
||||||
|
|
||||||
|
val, err := PathType{}.ValueFromTerraform(ctx, test.val)
|
||||||
if err == nil && test.expectError {
|
if err == nil && test.expectError {
|
||||||
t.Fatal("expected error, got no error")
|
t.Fatal("expected error, got no error")
|
||||||
}
|
}
|
||||||
|
@ -52,8 +52,8 @@ func Test_IPAddrTypeValueFromTerraform(t *testing.T) {
|
|||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
ctx := t.Context()
|
ctx := t.Context()
|
||||||
val, err := IPAddrType{}.ValueFromTerraform(ctx, test.val)
|
|
||||||
|
|
||||||
|
val, err := IPAddrType{}.ValueFromTerraform(ctx, test.val)
|
||||||
if err == nil && test.expectError {
|
if err == nil && test.expectError {
|
||||||
t.Fatal("expected error, got no error")
|
t.Fatal("expected error, got no error")
|
||||||
}
|
}
|
||||||
|
@ -52,8 +52,8 @@ func Test_IPCIDRTypeValueFromTerraform(t *testing.T) {
|
|||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
ctx := t.Context()
|
ctx := t.Context()
|
||||||
val, err := IPCIDRType{}.ValueFromTerraform(ctx, test.val)
|
|
||||||
|
|
||||||
|
val, err := IPCIDRType{}.ValueFromTerraform(ctx, test.val)
|
||||||
if err == nil && test.expectError {
|
if err == nil && test.expectError {
|
||||||
t.Fatal("expected error, got no error")
|
t.Fatal("expected error, got no error")
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ type StandardRepoHandleType struct {
|
|||||||
// StandardRepoHandleValue is a type that represents the value of an APT standard repository handle.
|
// StandardRepoHandleValue is a type that represents the value of an APT standard repository handle.
|
||||||
type StandardRepoHandleValue struct {
|
type StandardRepoHandleValue struct {
|
||||||
basetypes.StringValue
|
basetypes.StringValue
|
||||||
|
|
||||||
cvn apitypes.CephVersionName
|
cvn apitypes.CephVersionName
|
||||||
kind apitypes.StandardRepoHandleKind
|
kind apitypes.StandardRepoHandleKind
|
||||||
}
|
}
|
||||||
|
@ -103,8 +103,8 @@ func TestStandardRepoHandleValueFromTerraform(t *testing.T) {
|
|||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
ctx := t.Context()
|
ctx := t.Context()
|
||||||
val, err := StandardRepoHandleType{}.ValueFromTerraform(ctx, test.val)
|
|
||||||
|
|
||||||
|
val, err := StandardRepoHandleType{}.ValueFromTerraform(ctx, test.val)
|
||||||
if err == nil && test.expectError {
|
if err == nil && test.expectError {
|
||||||
t.Fatal("expected error, got no error")
|
t.Fatal("expected error, got no error")
|
||||||
}
|
}
|
||||||
|
@ -332,8 +332,8 @@ func validateResponseCode(res *http.Response) error {
|
|||||||
msg := strings.TrimPrefix(res.Status, fmt.Sprintf("%d ", res.StatusCode))
|
msg := strings.TrimPrefix(res.Status, fmt.Sprintf("%d ", res.StatusCode))
|
||||||
|
|
||||||
errRes := &ErrorResponseBody{}
|
errRes := &ErrorResponseBody{}
|
||||||
err := json.NewDecoder(res.Body).Decode(errRes)
|
|
||||||
|
|
||||||
|
err := json.NewDecoder(res.Body).Decode(errRes)
|
||||||
if err == nil && errRes.Errors != nil {
|
if err == nil && errRes.Errors != nil {
|
||||||
var errList []string
|
var errList []string
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ type ACMEPluginsListResponseBody struct {
|
|||||||
// ACMEPluginsListResponseData contains the data from an ACME plugins list response.
|
// ACMEPluginsListResponseData contains the data from an ACME plugins list response.
|
||||||
type ACMEPluginsListResponseData struct {
|
type ACMEPluginsListResponseData struct {
|
||||||
BaseACMEPluginData
|
BaseACMEPluginData
|
||||||
|
|
||||||
// ACME Plugin ID name
|
// ACME Plugin ID name
|
||||||
Plugin string `json:"plugin" url:"plugin"`
|
Plugin string `json:"plugin" url:"plugin"`
|
||||||
// DNS plugin data.
|
// DNS plugin data.
|
||||||
@ -49,6 +50,7 @@ type ACMEPluginsGetResponseBody struct {
|
|||||||
// ACMEPluginsGetResponseData contains the data from an ACME plugins get response.
|
// ACMEPluginsGetResponseData contains the data from an ACME plugins get response.
|
||||||
type ACMEPluginsGetResponseData struct {
|
type ACMEPluginsGetResponseData struct {
|
||||||
BaseACMEPluginData
|
BaseACMEPluginData
|
||||||
|
|
||||||
// ACME Plugin ID name
|
// ACME Plugin ID name
|
||||||
Plugin string `json:"plugin" url:"plugin"`
|
Plugin string `json:"plugin" url:"plugin"`
|
||||||
// DNS plugin data.
|
// DNS plugin data.
|
||||||
@ -58,6 +60,7 @@ type ACMEPluginsGetResponseData struct {
|
|||||||
// ACMEPluginsCreateRequestBody contains the body for creating a new ACME plugin.
|
// ACMEPluginsCreateRequestBody contains the body for creating a new ACME plugin.
|
||||||
type ACMEPluginsCreateRequestBody struct {
|
type ACMEPluginsCreateRequestBody struct {
|
||||||
BaseACMEPluginData
|
BaseACMEPluginData
|
||||||
|
|
||||||
// ACME Plugin ID name
|
// ACME Plugin ID name
|
||||||
Plugin string `json:"id" url:"id"`
|
Plugin string `json:"id" url:"id"`
|
||||||
// DNS plugin data. (base64 encoded)
|
// DNS plugin data. (base64 encoded)
|
||||||
@ -69,6 +72,7 @@ type ACMEPluginsCreateRequestBody struct {
|
|||||||
// ACMEPluginsUpdateRequestBody contains the body for updating an existing ACME plugin.
|
// ACMEPluginsUpdateRequestBody contains the body for updating an existing ACME plugin.
|
||||||
type ACMEPluginsUpdateRequestBody struct {
|
type ACMEPluginsUpdateRequestBody struct {
|
||||||
BaseACMEPluginData
|
BaseACMEPluginData
|
||||||
|
|
||||||
// DNS plugin data. (base64 encoded)
|
// DNS plugin data. (base64 encoded)
|
||||||
Data *DNSPluginData `url:"data,omitempty"`
|
Data *DNSPluginData `url:"data,omitempty"`
|
||||||
// A list of settings you want to delete.
|
// A list of settings you want to delete.
|
||||||
|
@ -27,6 +27,7 @@ type Client struct {
|
|||||||
|
|
||||||
type groupClient struct {
|
type groupClient struct {
|
||||||
firewall.Client
|
firewall.Client
|
||||||
|
|
||||||
Group string
|
Group string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ type HAGroupDataBase struct {
|
|||||||
type HAGroupGetResponseData struct {
|
type HAGroupGetResponseData struct {
|
||||||
// The group's data
|
// The group's data
|
||||||
HAGroupDataBase
|
HAGroupDataBase
|
||||||
|
|
||||||
// The group's identifier
|
// The group's identifier
|
||||||
ID string `json:"group"`
|
ID string `json:"group"`
|
||||||
// The type. Always set to `group`.
|
// The type. Always set to `group`.
|
||||||
@ -54,6 +55,7 @@ type HAGroupGetResponseData struct {
|
|||||||
type HAGroupCreateRequestBody struct {
|
type HAGroupCreateRequestBody struct {
|
||||||
// The group's data
|
// The group's data
|
||||||
HAGroupDataBase
|
HAGroupDataBase
|
||||||
|
|
||||||
// The group's identifier
|
// The group's identifier
|
||||||
ID string `url:"group"`
|
ID string `url:"group"`
|
||||||
// The type. Always set to `group`.
|
// The type. Always set to `group`.
|
||||||
@ -64,6 +66,7 @@ type HAGroupCreateRequestBody struct {
|
|||||||
type HAGroupUpdateRequestBody struct {
|
type HAGroupUpdateRequestBody struct {
|
||||||
// The group's data
|
// The group's data
|
||||||
HAGroupDataBase
|
HAGroupDataBase
|
||||||
|
|
||||||
// A list of settings to delete
|
// A list of settings to delete
|
||||||
Delete string `url:"delete"`
|
Delete string `url:"delete"`
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@ type HAResourceDataBase struct {
|
|||||||
// HA resource.
|
// HA resource.
|
||||||
type HAResourceGetResponseData struct {
|
type HAResourceGetResponseData struct {
|
||||||
HAResourceDataBase
|
HAResourceDataBase
|
||||||
|
|
||||||
// Identifier of this resource
|
// Identifier of this resource
|
||||||
ID types.HAResourceID `json:"sid"`
|
ID types.HAResourceID `json:"sid"`
|
||||||
// Type of this resource
|
// Type of this resource
|
||||||
@ -54,6 +55,7 @@ type HAResourceGetResponseData struct {
|
|||||||
// HAResourceCreateRequestBody contains data received from the HA resource API when creating a new HA resource.
|
// HAResourceCreateRequestBody contains data received from the HA resource API when creating a new HA resource.
|
||||||
type HAResourceCreateRequestBody struct {
|
type HAResourceCreateRequestBody struct {
|
||||||
HAResourceDataBase
|
HAResourceDataBase
|
||||||
|
|
||||||
// Identifier of this resource
|
// Identifier of this resource
|
||||||
ID types.HAResourceID `url:"sid"`
|
ID types.HAResourceID `url:"sid"`
|
||||||
// Type of this resource
|
// Type of this resource
|
||||||
@ -65,6 +67,7 @@ type HAResourceCreateRequestBody struct {
|
|||||||
// HAResourceUpdateRequestBody contains data received from the HA resource API when updating an existing HA resource.
|
// HAResourceUpdateRequestBody contains data received from the HA resource API when updating an existing HA resource.
|
||||||
type HAResourceUpdateRequestBody struct {
|
type HAResourceUpdateRequestBody struct {
|
||||||
HAResourceDataBase
|
HAResourceDataBase
|
||||||
|
|
||||||
// Settings that must be deleted from the resource's configuration
|
// Settings that must be deleted from the resource's configuration
|
||||||
Delete []string `url:"delete,omitempty,comma"`
|
Delete []string `url:"delete,omitempty,comma"`
|
||||||
}
|
}
|
||||||
|
@ -127,6 +127,7 @@ func (g IDGenerator) NextID(ctx context.Context) (int, error) {
|
|||||||
|
|
||||||
if !g.config.RandomIDs {
|
if !g.config.RandomIDs {
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
|
|
||||||
_, _ = fmt.Fprintf(&b, "%d", *id)
|
_, _ = fmt.Fprintf(&b, "%d", *id)
|
||||||
|
|
||||||
if err := lockedfile.Write(g.config.seqFName, &b, 0o666); err != nil {
|
if err := lockedfile.Write(g.config.seqFName, &b, 0o666); err != nil {
|
||||||
|
@ -43,5 +43,6 @@ type ServersResponseBody struct {
|
|||||||
// ServerRequestData contains the data for a metric server post/put request.
|
// ServerRequestData contains the data for a metric server post/put request.
|
||||||
type ServerRequestData struct {
|
type ServerRequestData struct {
|
||||||
ServerData
|
ServerData
|
||||||
|
|
||||||
Delete *[]string `url:"delete,omitempty"`
|
Delete *[]string `url:"delete,omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,7 @@ type OptionsResponseBody struct {
|
|||||||
// OptionsResponseData contains the data from a cluster options response.
|
// OptionsResponseData contains the data from a cluster options response.
|
||||||
type OptionsResponseData struct {
|
type OptionsResponseData struct {
|
||||||
optionsBaseData
|
optionsBaseData
|
||||||
|
|
||||||
MaxWorkers *types.CustomInt64 `json:"max_workers,omitempty"`
|
MaxWorkers *types.CustomInt64 `json:"max_workers,omitempty"`
|
||||||
ClusterResourceScheduling *crs `json:"crs,omitempty"`
|
ClusterResourceScheduling *crs `json:"crs,omitempty"`
|
||||||
HASettings *haSettings `json:"ha,omitempty"`
|
HASettings *haSettings `json:"ha,omitempty"`
|
||||||
@ -83,6 +84,7 @@ type OptionsResponseData struct {
|
|||||||
// OptionsRequestData contains the body for cluster options request.
|
// OptionsRequestData contains the body for cluster options request.
|
||||||
type OptionsRequestData struct {
|
type OptionsRequestData struct {
|
||||||
optionsBaseData
|
optionsBaseData
|
||||||
|
|
||||||
MaxWorkers *int64 `json:"max_workers,omitempty" url:"max_workers,omitempty"`
|
MaxWorkers *int64 `json:"max_workers,omitempty" url:"max_workers,omitempty"`
|
||||||
Delete *string `json:"delete,omitempty" url:"delete,omitempty"`
|
Delete *string `json:"delete,omitempty" url:"delete,omitempty"`
|
||||||
ClusterResourceScheduling *string `json:"crs,omitempty" url:"crs,omitempty"`
|
ClusterResourceScheduling *string `json:"crs,omitempty" url:"crs,omitempty"`
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
// Client is an interface for accessing the Proxmox node API.
|
// Client is an interface for accessing the Proxmox node API.
|
||||||
type Client struct {
|
type Client struct {
|
||||||
api.Client
|
api.Client
|
||||||
|
|
||||||
NodeName string
|
NodeName string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ import (
|
|||||||
// Client is an interface for accessing the Proxmox container API.
|
// Client is an interface for accessing the Proxmox container API.
|
||||||
type Client struct {
|
type Client struct {
|
||||||
api.Client
|
api.Client
|
||||||
|
|
||||||
VMID int
|
VMID int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,7 +236,6 @@ func (c *Client) WaitForContainerStatus(ctx context.Context, status string) erro
|
|||||||
retry.Delay(1*time.Second),
|
retry.Delay(1*time.Second),
|
||||||
retry.LastErrorOnly(true),
|
retry.LastErrorOnly(true),
|
||||||
)
|
)
|
||||||
|
|
||||||
if errors.Is(err, context.DeadlineExceeded) {
|
if errors.Is(err, context.DeadlineExceeded) {
|
||||||
return fmt.Errorf("timeout while waiting for container %d to enter the status %q", c.VMID, status)
|
return fmt.Errorf("timeout while waiting for container %d to enter the status %q", c.VMID, status)
|
||||||
}
|
}
|
||||||
@ -273,7 +272,6 @@ func (c *Client) WaitForContainerConfigUnlock(ctx context.Context, ignoreErrorRe
|
|||||||
retry.Delay(1*time.Second),
|
retry.Delay(1*time.Second),
|
||||||
retry.LastErrorOnly(true),
|
retry.LastErrorOnly(true),
|
||||||
)
|
)
|
||||||
|
|
||||||
if errors.Is(err, context.DeadlineExceeded) {
|
if errors.Is(err, context.DeadlineExceeded) {
|
||||||
return fmt.Errorf("timeout while waiting for container %d configuration to become unlocked", c.VMID)
|
return fmt.Errorf("timeout while waiting for container %d configuration to become unlocked", c.VMID)
|
||||||
}
|
}
|
||||||
|
@ -636,6 +636,7 @@ func (r *CustomFeatures) UnmarshalJSON(b []byte) error {
|
|||||||
r.MountTypes = &a
|
r.MountTypes = &a
|
||||||
} else {
|
} else {
|
||||||
var a []string
|
var a []string
|
||||||
|
|
||||||
r.MountTypes = &a
|
r.MountTypes = &a
|
||||||
}
|
}
|
||||||
case "nesting":
|
case "nesting":
|
||||||
@ -728,6 +729,7 @@ func (r *CustomMountPoint) UnmarshalJSON(b []byte) error {
|
|||||||
r.MountOptions = &a
|
r.MountOptions = &a
|
||||||
} else {
|
} else {
|
||||||
var a []string
|
var a []string
|
||||||
|
|
||||||
r.MountOptions = &a
|
r.MountOptions = &a
|
||||||
}
|
}
|
||||||
case "mp":
|
case "mp":
|
||||||
@ -827,6 +829,7 @@ func (r *CustomNetworkInterface) UnmarshalJSON(b []byte) error {
|
|||||||
r.Trunks = &a
|
r.Trunks = &a
|
||||||
} else {
|
} else {
|
||||||
var a []int
|
var a []int
|
||||||
|
|
||||||
r.Trunks = &a
|
r.Trunks = &a
|
||||||
}
|
}
|
||||||
case "type":
|
case "type":
|
||||||
@ -865,6 +868,7 @@ func (r *CustomRootFS) UnmarshalJSON(b []byte) error {
|
|||||||
r.MountOptions = &a
|
r.MountOptions = &a
|
||||||
} else {
|
} else {
|
||||||
var a []string
|
var a []string
|
||||||
|
|
||||||
r.MountOptions = &a
|
r.MountOptions = &a
|
||||||
}
|
}
|
||||||
case "quota":
|
case "quota":
|
||||||
|
@ -16,6 +16,7 @@ import (
|
|||||||
// Client is an interface for accessing the Proxmox node storage API.
|
// Client is an interface for accessing the Proxmox node storage API.
|
||||||
type Client struct {
|
type Client struct {
|
||||||
api.Client
|
api.Client
|
||||||
|
|
||||||
StorageName string
|
StorageName string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +168,6 @@ func (c *Client) WaitForTask(ctx context.Context, upid string, opts ...TaskWaitO
|
|||||||
retry.DelayType(retry.FixedDelay),
|
retry.DelayType(retry.FixedDelay),
|
||||||
retry.Delay(time.Second),
|
retry.Delay(time.Second),
|
||||||
)
|
)
|
||||||
|
|
||||||
if errors.Is(err, context.DeadlineExceeded) {
|
if errors.Is(err, context.DeadlineExceeded) {
|
||||||
return fmt.Errorf("timeout while waiting for task %q to complete", upid)
|
return fmt.Errorf("timeout while waiting for task %q to complete", upid)
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ import (
|
|||||||
// Client is an interface for accessing the Proxmox VM API.
|
// Client is an interface for accessing the Proxmox VM API.
|
||||||
type Client struct {
|
type Client struct {
|
||||||
api.Client
|
api.Client
|
||||||
|
|
||||||
VMID int
|
VMID int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,6 +80,7 @@ func (r *CustomCPUEmulation) UnmarshalJSON(b []byte) error {
|
|||||||
r.Flags = &f
|
r.Flags = &f
|
||||||
} else {
|
} else {
|
||||||
var f []string
|
var f []string
|
||||||
|
|
||||||
r.Flags = &f
|
r.Flags = &f
|
||||||
}
|
}
|
||||||
case "hidden":
|
case "hidden":
|
||||||
|
@ -36,6 +36,7 @@ func (r *CustomVirtiofsShare) EncodeValues(key string, v *url.Values) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var values []string
|
var values []string
|
||||||
|
|
||||||
values = append(values, fmt.Sprintf("dirid=%s", r.DirId))
|
values = append(values, fmt.Sprintf("dirid=%s", r.DirId))
|
||||||
|
|
||||||
if r.Cache != nil {
|
if r.Cache != nil {
|
||||||
|
@ -675,7 +675,6 @@ func (c *Client) WaitForVMConfigUnlock(ctx context.Context, ignoreErrorResponse
|
|||||||
return errors.Is(err, stillLocked) || ignoreErrorResponse
|
return errors.Is(err, stillLocked) || ignoreErrorResponse
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
if errors.Is(err, context.DeadlineExceeded) {
|
if errors.Is(err, context.DeadlineExceeded) {
|
||||||
return fmt.Errorf("timeout while waiting for VM %d configuration to become unlocked", c.VMID)
|
return fmt.Errorf("timeout while waiting for VM %d configuration to become unlocked", c.VMID)
|
||||||
}
|
}
|
||||||
@ -714,7 +713,6 @@ func (c *Client) WaitForVMStatus(ctx context.Context, status string) error {
|
|||||||
return errors.Is(err, unexpectedStatus)
|
return errors.Is(err, unexpectedStatus)
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
if errors.Is(err, context.DeadlineExceeded) {
|
if errors.Is(err, context.DeadlineExceeded) {
|
||||||
return fmt.Errorf("timeout while waiting for VM %d to enter the status %q", c.VMID, status)
|
return fmt.Errorf("timeout while waiting for VM %d to enter the status %q", c.VMID, status)
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ func TestUnmarshalGetResponseData(t *testing.T) {
|
|||||||
}`, "local-lvm:vm-100-disk-0,aio=io_uring,backup=1,cache=none,discard=ignore,replicate=1,size=8G,ssd=1")
|
}`, "local-lvm:vm-100-disk-0,aio=io_uring,backup=1,cache=none,discard=ignore,replicate=1,size=8G,ssd=1")
|
||||||
|
|
||||||
var data GetResponseData
|
var data GetResponseData
|
||||||
|
|
||||||
err := json.Unmarshal([]byte(jsonData), &data)
|
err := json.Unmarshal([]byte(jsonData), &data)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
@ -515,6 +515,7 @@ func (c *client) openNodeShell(ctx context.Context, node ProxmoxNode) (*ssh.Clie
|
|||||||
f, fErr := os.OpenFile(khPath, os.O_APPEND|os.O_WRONLY, 0o600)
|
f, fErr := os.OpenFile(khPath, os.O_APPEND|os.O_WRONLY, 0o600)
|
||||||
if fErr == nil {
|
if fErr == nil {
|
||||||
defer utils.CloseOrLogError(ctx)(f)
|
defer utils.CloseOrLogError(ctx)(f)
|
||||||
|
|
||||||
fErr = knownhosts.WriteKnownHost(f, hostname, remote, key)
|
fErr = knownhosts.WriteKnownHost(f, hostname, remote, key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,6 @@ func TestParseDiskSize(t *testing.T) {
|
|||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
got, err := ParseDiskSize(tt.size)
|
got, err := ParseDiskSize(tt.size)
|
||||||
|
|
||||||
if (err != nil) != tt.wantErr {
|
if (err != nil) != tt.wantErr {
|
||||||
t.Errorf("parseDiskSize() error = %v, wantErr %v", err, tt.wantErr)
|
t.Errorf("parseDiskSize() error = %v, wantErr %v", err, tt.wantErr)
|
||||||
return
|
return
|
||||||
|
@ -51,6 +51,7 @@ func dnsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Di
|
|||||||
var diags diag.Diagnostics
|
var diags diag.Diagnostics
|
||||||
|
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
api, err := config.GetClient()
|
api, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
|
@ -78,12 +78,14 @@ func groupRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.
|
|||||||
var diags diag.Diagnostics
|
var diags diag.Diagnostics
|
||||||
|
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
api, err := config.GetClient()
|
api, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
groupID := d.Get(mkDataSourceVirtualEnvironmentGroupID).(string)
|
groupID := d.Get(mkDataSourceVirtualEnvironmentGroupID).(string)
|
||||||
|
|
||||||
group, err := api.Access().GetGroup(ctx, groupID)
|
group, err := api.Access().GetGroup(ctx, groupID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
|
@ -45,6 +45,7 @@ func groupsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag
|
|||||||
var diags diag.Diagnostics
|
var diags diag.Diagnostics
|
||||||
|
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
api, err := config.GetClient()
|
api, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
|
@ -85,6 +85,7 @@ func hostsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.
|
|||||||
var diags diag.Diagnostics
|
var diags diag.Diagnostics
|
||||||
|
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
api, err := config.GetClient()
|
api, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
|
@ -95,6 +95,7 @@ func nodesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.
|
|||||||
var diags diag.Diagnostics
|
var diags diag.Diagnostics
|
||||||
|
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
api, err := config.GetClient()
|
api, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
|
@ -83,12 +83,14 @@ func poolRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.D
|
|||||||
var diags diag.Diagnostics
|
var diags diag.Diagnostics
|
||||||
|
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
api, err := config.GetClient()
|
api, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
poolID := d.Get(mkDataSourceVirtualEnvironmentPoolPoolID).(string)
|
poolID := d.Get(mkDataSourceVirtualEnvironmentPoolPoolID).(string)
|
||||||
|
|
||||||
pool, err := api.Pool().GetPool(ctx, poolID)
|
pool, err := api.Pool().GetPool(ctx, poolID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
|
@ -36,6 +36,7 @@ func Pools() *schema.Resource {
|
|||||||
|
|
||||||
func poolsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func poolsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
api, err := config.GetClient()
|
api, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
|
@ -42,12 +42,14 @@ func Role() *schema.Resource {
|
|||||||
|
|
||||||
func roleRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func roleRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
api, err := config.GetClient()
|
api, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
roleID := d.Get(mkDataSourceVirtualEnvironmentRoleID).(string)
|
roleID := d.Get(mkDataSourceVirtualEnvironmentRoleID).(string)
|
||||||
|
|
||||||
accessRole, err := api.Access().GetRole(ctx, roleID)
|
accessRole, err := api.Access().GetRole(ctx, roleID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
|
@ -55,6 +55,7 @@ func rolesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.
|
|||||||
var diags diag.Diagnostics
|
var diags diag.Diagnostics
|
||||||
|
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
api, err := config.GetClient()
|
api, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
|
@ -57,12 +57,14 @@ func timeRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.D
|
|||||||
var diags diag.Diagnostics
|
var diags diag.Diagnostics
|
||||||
|
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
api, err := config.GetClient()
|
api, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
nodeName := d.Get(mkDataSourceVirtualEnvironmentTimeNodeName).(string)
|
nodeName := d.Get(mkDataSourceVirtualEnvironmentTimeNodeName).(string)
|
||||||
|
|
||||||
nodeTime, err := api.Node(nodeName).GetTime(ctx)
|
nodeTime, err := api.Node(nodeName).GetTime(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
|
@ -115,12 +115,14 @@ func userRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.D
|
|||||||
var diags diag.Diagnostics
|
var diags diag.Diagnostics
|
||||||
|
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
api, err := config.GetClient()
|
api, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
userID := d.Get(mkDataSourceVirtualEnvironmentUserUserID).(string)
|
userID := d.Get(mkDataSourceVirtualEnvironmentUserUserID).(string)
|
||||||
|
|
||||||
v, err := api.Access().GetUser(ctx, userID)
|
v, err := api.Access().GetUser(ctx, userID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
|
@ -98,6 +98,7 @@ func usersRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.
|
|||||||
var diags diag.Diagnostics
|
var diags diag.Diagnostics
|
||||||
|
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
api, err := config.GetClient()
|
api, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
|
@ -174,6 +174,7 @@ func certificateRead(ctx context.Context, d *schema.ResourceData, m interface{})
|
|||||||
var diags diag.Diagnostics
|
var diags diag.Diagnostics
|
||||||
|
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
api, err := config.GetClient()
|
api, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
@ -303,6 +304,7 @@ func certificateRead(ctx context.Context, d *schema.ResourceData, m interface{})
|
|||||||
|
|
||||||
func certificateUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func certificateUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
api, err := config.GetClient()
|
api, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
@ -322,6 +324,7 @@ func certificateUpdate(ctx context.Context, d *schema.ResourceData, m interface{
|
|||||||
|
|
||||||
func certificateDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func certificateDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
api, err := config.GetClient()
|
api, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
|
@ -112,6 +112,7 @@ func dnsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Di
|
|||||||
var diags diag.Diagnostics
|
var diags diag.Diagnostics
|
||||||
|
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
api, err := config.GetClient()
|
api, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
@ -153,6 +154,7 @@ func dnsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Di
|
|||||||
|
|
||||||
func dnsUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dnsUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
api, err := config.GetClient()
|
api, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
|
@ -603,6 +603,7 @@ func fileCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag
|
|||||||
}
|
}
|
||||||
|
|
||||||
volID, di := fileGetVolumeID(ctx, d, capi)
|
volID, di := fileGetVolumeID(ctx, d, capi)
|
||||||
|
|
||||||
diags = append(diags, di...)
|
diags = append(diags, di...)
|
||||||
if diags.HasError() {
|
if diags.HasError() {
|
||||||
return diags
|
return diags
|
||||||
@ -763,6 +764,7 @@ func fileIsURL(d *schema.ResourceData) bool {
|
|||||||
|
|
||||||
func fileRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func fileRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
capi, err := config.GetClient()
|
capi, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
@ -912,6 +914,7 @@ func readURL(
|
|||||||
|
|
||||||
if httpLastModified != "" {
|
if httpLastModified != "" {
|
||||||
var timeParsed time.Time
|
var timeParsed time.Time
|
||||||
|
|
||||||
timeParsed, err = time.Parse(time.RFC1123, httpLastModified)
|
timeParsed, err = time.Parse(time.RFC1123, httpLastModified)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
timeParsed, err = time.Parse(time.RFC1123Z, httpLastModified)
|
timeParsed, err = time.Parse(time.RFC1123Z, httpLastModified)
|
||||||
@ -939,6 +942,7 @@ func readURL(
|
|||||||
|
|
||||||
func fileDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func fileDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
capi, err := config.GetClient()
|
capi, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
|
@ -204,6 +204,7 @@ func RulesCreate(ctx context.Context, api firewall.Rule, d *schema.ResourceData)
|
|||||||
if a == "" || t == "" {
|
if a == "" || t == "" {
|
||||||
diags = append(diags, diag.Errorf("Either '%s' OR both '%s' and '%s' must be defined for the rule #%d",
|
diags = append(diags, diag.Errorf("Either '%s' OR both '%s' and '%s' must be defined for the rule #%d",
|
||||||
mkSecurityGroup, mkRuleAction, mkRuleType, i)...)
|
mkSecurityGroup, mkRuleAction, mkRuleType, i)...)
|
||||||
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,6 +94,7 @@ func Group() *schema.Resource {
|
|||||||
|
|
||||||
func groupCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func groupCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
client, err := config.GetClient()
|
client, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
@ -144,12 +145,14 @@ func groupRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.
|
|||||||
var diags diag.Diagnostics
|
var diags diag.Diagnostics
|
||||||
|
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
client, err := config.GetClient()
|
client, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
groupID := d.Id()
|
groupID := d.Id()
|
||||||
|
|
||||||
group, err := client.Access().GetGroup(ctx, groupID)
|
group, err := client.Access().GetGroup(ctx, groupID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, api.ErrResourceDoesNotExist) {
|
if errors.Is(err, api.ErrResourceDoesNotExist) {
|
||||||
@ -203,6 +206,7 @@ func groupRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.
|
|||||||
|
|
||||||
func groupUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func groupUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
client, err := config.GetClient()
|
client, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
@ -272,6 +276,7 @@ func groupUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) dia
|
|||||||
|
|
||||||
func groupDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func groupDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
client, err := config.GetClient()
|
client, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
|
@ -141,6 +141,7 @@ func hostsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.
|
|||||||
var diags diag.Diagnostics
|
var diags diag.Diagnostics
|
||||||
|
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
api, err := config.GetClient()
|
api, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
@ -210,6 +211,7 @@ func hostsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.
|
|||||||
|
|
||||||
func hostsUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func hostsUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
api, err := config.GetClient()
|
api, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
|
@ -103,6 +103,7 @@ func Pool() *schema.Resource {
|
|||||||
|
|
||||||
func poolCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func poolCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
client, err := config.GetClient()
|
client, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
@ -130,12 +131,14 @@ func poolRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.D
|
|||||||
var diags diag.Diagnostics
|
var diags diag.Diagnostics
|
||||||
|
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
client, err := config.GetClient()
|
client, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
poolID := d.Id()
|
poolID := d.Id()
|
||||||
|
|
||||||
pool, err := client.Pool().GetPool(ctx, poolID)
|
pool, err := client.Pool().GetPool(ctx, poolID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, api.ErrResourceDoesNotExist) {
|
if errors.Is(err, api.ErrResourceDoesNotExist) {
|
||||||
@ -185,6 +188,7 @@ func poolRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.D
|
|||||||
|
|
||||||
func poolUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func poolUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
client, err := config.GetClient()
|
client, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
@ -207,6 +211,7 @@ func poolUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag
|
|||||||
|
|
||||||
func poolDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func poolDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
client, err := config.GetClient()
|
client, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
|
@ -89,12 +89,14 @@ func timeRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.D
|
|||||||
var diags diag.Diagnostics
|
var diags diag.Diagnostics
|
||||||
|
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
api, err := config.GetClient()
|
api, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
nodeName := d.Get(mkResourceVirtualEnvironmentTimeNodeName).(string)
|
nodeName := d.Get(mkResourceVirtualEnvironmentTimeNodeName).(string)
|
||||||
|
|
||||||
nodeTime, err := api.Node(nodeName).GetTime(ctx)
|
nodeTime, err := api.Node(nodeName).GetTime(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
@ -125,6 +127,7 @@ func timeRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.D
|
|||||||
|
|
||||||
func timeUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func timeUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
api, err := config.GetClient()
|
api, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
|
@ -164,6 +164,7 @@ func User() *schema.Resource {
|
|||||||
|
|
||||||
func userCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func userCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
client, err := config.GetClient()
|
client, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
@ -172,6 +173,7 @@ func userCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag
|
|||||||
comment := d.Get(mkResourceVirtualEnvironmentUserComment).(string)
|
comment := d.Get(mkResourceVirtualEnvironmentUserComment).(string)
|
||||||
email := d.Get(mkResourceVirtualEnvironmentUserEmail).(string)
|
email := d.Get(mkResourceVirtualEnvironmentUserEmail).(string)
|
||||||
enabled := types.CustomBool(d.Get(mkResourceVirtualEnvironmentUserEnabled).(bool))
|
enabled := types.CustomBool(d.Get(mkResourceVirtualEnvironmentUserEnabled).(bool))
|
||||||
|
|
||||||
expirationDate, err := time.Parse(
|
expirationDate, err := time.Parse(
|
||||||
time.RFC3339,
|
time.RFC3339,
|
||||||
d.Get(mkResourceVirtualEnvironmentUserExpirationDate).(string),
|
d.Get(mkResourceVirtualEnvironmentUserExpirationDate).(string),
|
||||||
@ -242,12 +244,14 @@ func userCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag
|
|||||||
|
|
||||||
func userRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func userRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
client, err := config.GetClient()
|
client, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
userID := d.Id()
|
userID := d.Id()
|
||||||
|
|
||||||
user, err := client.Access().GetUser(ctx, userID)
|
user, err := client.Access().GetUser(ctx, userID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, api.ErrResourceDoesNotExist) {
|
if errors.Is(err, api.ErrResourceDoesNotExist) {
|
||||||
@ -359,6 +363,7 @@ func userRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.D
|
|||||||
|
|
||||||
func userUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func userUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
client, err := config.GetClient()
|
client, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
@ -367,6 +372,7 @@ func userUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag
|
|||||||
comment := d.Get(mkResourceVirtualEnvironmentUserComment).(string)
|
comment := d.Get(mkResourceVirtualEnvironmentUserComment).(string)
|
||||||
email := d.Get(mkResourceVirtualEnvironmentUserEmail).(string)
|
email := d.Get(mkResourceVirtualEnvironmentUserEmail).(string)
|
||||||
enabled := types.CustomBool(d.Get(mkResourceVirtualEnvironmentUserEnabled).(bool))
|
enabled := types.CustomBool(d.Get(mkResourceVirtualEnvironmentUserEnabled).(bool))
|
||||||
|
|
||||||
expirationDate, err := time.Parse(
|
expirationDate, err := time.Parse(
|
||||||
time.RFC3339,
|
time.RFC3339,
|
||||||
d.Get(mkResourceVirtualEnvironmentUserExpirationDate).(string),
|
d.Get(mkResourceVirtualEnvironmentUserExpirationDate).(string),
|
||||||
@ -399,6 +405,7 @@ func userUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag
|
|||||||
}
|
}
|
||||||
|
|
||||||
userID := d.Id()
|
userID := d.Id()
|
||||||
|
|
||||||
err = client.Access().UpdateUser(ctx, userID, body)
|
err = client.Access().UpdateUser(ctx, userID, body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
@ -406,6 +413,7 @@ func userUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag
|
|||||||
|
|
||||||
if d.HasChange(mkResourceVirtualEnvironmentUserPassword) {
|
if d.HasChange(mkResourceVirtualEnvironmentUserPassword) {
|
||||||
password := d.Get(mkResourceVirtualEnvironmentUserPassword).(string)
|
password := d.Get(mkResourceVirtualEnvironmentUserPassword).(string)
|
||||||
|
|
||||||
err = client.Access().ChangeUserPassword(ctx, userID, password)
|
err = client.Access().ChangeUserPassword(ctx, userID, password)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
@ -464,6 +472,7 @@ func userUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag
|
|||||||
|
|
||||||
func userDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func userDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
config := m.(proxmoxtf.ProviderConfiguration)
|
config := m.(proxmoxtf.ProviderConfiguration)
|
||||||
|
|
||||||
client, err := config.GetClient()
|
client, err := config.GetClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
|
@ -78,6 +78,7 @@ func FileMode() schema.SchemaValidateDiagFunc {
|
|||||||
if !ok {
|
if !ok {
|
||||||
errs = append(errs, fmt.Errorf(
|
errs = append(errs, fmt.Errorf(
|
||||||
`expected string in octal format (e.g. "0o700" or "0700"") for %q, but got %v of type %T`, k, v, i))
|
`expected string in octal format (e.g. "0o700" or "0700"") for %q, but got %v of type %T`, k, v, i))
|
||||||
|
|
||||||
return nil, errs
|
return nil, errs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2693,8 +2693,8 @@ func vmCreateCustom(ctx context.Context, d *schema.ResourceData, m interface{})
|
|||||||
}
|
}
|
||||||
|
|
||||||
vmID = vmIDNew
|
vmID = vmIDNew
|
||||||
e = d.Set(mkVMID, vmID)
|
|
||||||
|
|
||||||
|
e = d.Set(mkVMID, vmID)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
return diag.FromErr(e)
|
return diag.FromErr(e)
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ func TestCloseOrLogError(t *testing.T) {
|
|||||||
func() {
|
func() {
|
||||||
defer f(c)
|
defer f(c)
|
||||||
defer f(b)
|
defer f(b)
|
||||||
|
|
||||||
assert.False(t, c.isClosed)
|
assert.False(t, c.isClosed)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -44,8 +44,8 @@ func compareWithPrefix(a, b string) int {
|
|||||||
bRest := strings.TrimPrefix(b, prefix)
|
bRest := strings.TrimPrefix(b, prefix)
|
||||||
|
|
||||||
aNum, aErr := strconv.Atoi(aRest)
|
aNum, aErr := strconv.Atoi(aRest)
|
||||||
bNum, bErr := strconv.Atoi(bRest)
|
|
||||||
|
|
||||||
|
bNum, bErr := strconv.Atoi(bRest)
|
||||||
if aErr == nil && bErr == nil {
|
if aErr == nil && bErr == nil {
|
||||||
if aNum != bNum {
|
if aNum != bNum {
|
||||||
if aNum < bNum {
|
if aNum < bNum {
|
||||||
|
Loading…
Reference in New Issue
Block a user