Manages resource pool memberships for containers, virtual machines and storages
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as proxmoxve from "@muhlba91/pulumi-proxmoxve";
const testVm1 = new proxmoxve.vm.VirtualMachine("test_vm1", {
vmId: 1234,
nodeName: "pve",
started: false,
});
const testPool = new proxmoxve.permission.Pool("test_pool", {poolId: "test-pool"});
const vmMembership = new proxmoxve.pool.Membership("vm_membership", {
poolId: testPool.id,
vmId: testVm1.id,
});
const storageMembership = new proxmoxve.pool.Membership("storage_membership", {
poolId: testPool.id,
storageId: "local-lvm",
});
import pulumi
import pulumi_proxmoxve as proxmoxve
test_vm1 = proxmoxve.vm.VirtualMachine("test_vm1",
vm_id=1234,
node_name="pve",
started=False)
test_pool = proxmoxve.permission.Pool("test_pool", pool_id="test-pool")
vm_membership = proxmoxve.pool.Membership("vm_membership",
pool_id=test_pool.id,
vm_id=test_vm1.id)
storage_membership = proxmoxve.pool.Membership("storage_membership",
pool_id=test_pool.id,
storage_id="local-lvm")
package main
import (
"github.com/muhlba91/pulumi-proxmoxve/sdk/v7/go/proxmoxve/permission"
"github.com/muhlba91/pulumi-proxmoxve/sdk/v7/go/proxmoxve/pool"
"github.com/muhlba91/pulumi-proxmoxve/sdk/v7/go/proxmoxve/vm"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
testVm1, err := vm.NewVirtualMachine(ctx, "test_vm1", &vm.VirtualMachineArgs{
VmId: pulumi.Int(1234),
NodeName: pulumi.String("pve"),
Started: pulumi.Bool(false),
})
if err != nil {
return err
}
testPool, err := permission.NewPool(ctx, "test_pool", &permission.PoolArgs{
PoolId: pulumi.String("test-pool"),
})
if err != nil {
return err
}
_, err = pool.NewMembership(ctx, "vm_membership", &pool.MembershipArgs{
PoolId: testPool.ID(),
VmId: testVm1.ID(),
})
if err != nil {
return err
}
_, err = pool.NewMembership(ctx, "storage_membership", &pool.MembershipArgs{
PoolId: testPool.ID(),
StorageId: pulumi.String("local-lvm"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using ProxmoxVE = Pulumi.ProxmoxVE;
return await Deployment.RunAsync(() =>
{
var testVm1 = new ProxmoxVE.VM.VirtualMachine("test_vm1", new()
{
VmId = 1234,
NodeName = "pve",
Started = false,
});
var testPool = new ProxmoxVE.Permission.Pool("test_pool", new()
{
PoolId = "test-pool",
});
var vmMembership = new ProxmoxVE.Pool.Membership("vm_membership", new()
{
PoolId = testPool.Id,
VmId = testVm1.Id,
});
var storageMembership = new ProxmoxVE.Pool.Membership("storage_membership", new()
{
PoolId = testPool.Id,
StorageId = "local-lvm",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import io.muehlbachler.pulumi.proxmoxve.VM.VirtualMachine;
import io.muehlbachler.pulumi.proxmoxve.VM.VirtualMachineArgs;
import io.muehlbachler.pulumi.proxmoxve.Permission.Pool;
import io.muehlbachler.pulumi.proxmoxve.Permission.PoolArgs;
import io.muehlbachler.pulumi.proxmoxve.Pool.Membership;
import io.muehlbachler.pulumi.proxmoxve.Pool.MembershipArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var testVm1 = new VirtualMachine("testVm1", VirtualMachineArgs.builder()
.vmId(1234)
.nodeName("pve")
.started(false)
.build());
var testPool = new Pool("testPool", PoolArgs.builder()
.poolId("test-pool")
.build());
var vmMembership = new Membership("vmMembership", MembershipArgs.builder()
.poolId(testPool.id())
.vmId(testVm1.id())
.build());
var storageMembership = new Membership("storageMembership", MembershipArgs.builder()
.poolId(testPool.id())
.storageId("local-lvm")
.build());
}
}
resources:
testVm1:
type: proxmoxve:VM:VirtualMachine
name: test_vm1
properties:
vmId: 1234
nodeName: pve
started: false
testPool:
type: proxmoxve:Permission:Pool
name: test_pool
properties:
poolId: test-pool
vmMembership:
type: proxmoxve:Pool:Membership
name: vm_membership
properties:
poolId: ${testPool.id}
vmId: ${testVm1.id}
storageMembership:
type: proxmoxve:Pool:Membership
name: storage_membership
properties:
poolId: ${testPool.id}
storageId: local-lvm
Create Membership Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Membership(name: string, args: MembershipArgs, opts?: CustomResourceOptions);@overload
def Membership(resource_name: str,
args: MembershipArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Membership(resource_name: str,
opts: Optional[ResourceOptions] = None,
pool_id: Optional[str] = None,
storage_id: Optional[str] = None,
vm_id: Optional[int] = None)func NewMembership(ctx *Context, name string, args MembershipArgs, opts ...ResourceOption) (*Membership, error)public Membership(string name, MembershipArgs args, CustomResourceOptions? opts = null)
public Membership(String name, MembershipArgs args)
public Membership(String name, MembershipArgs args, CustomResourceOptions options)
type: proxmoxve:Pool:Membership
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args MembershipArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args MembershipArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args MembershipArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args MembershipArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args MembershipArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var membershipResource = new ProxmoxVE.Pool.Membership("membershipResource", new()
{
PoolId = "string",
StorageId = "string",
VmId = 0,
});
example, err := pool.NewMembership(ctx, "membershipResource", &pool.MembershipArgs{
PoolId: pulumi.String("string"),
StorageId: pulumi.String("string"),
VmId: pulumi.Int(0),
})
var membershipResource = new Membership("membershipResource", MembershipArgs.builder()
.poolId("string")
.storageId("string")
.vmId(0)
.build());
membership_resource = proxmoxve.pool.Membership("membershipResource",
pool_id="string",
storage_id="string",
vm_id=0)
const membershipResource = new proxmoxve.pool.Membership("membershipResource", {
poolId: "string",
storageId: "string",
vmId: 0,
});
type: proxmoxve:Pool:Membership
properties:
poolId: string
storageId: string
vmId: 0
Membership Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Membership resource accepts the following input properties:
- pool_
id str - Resource pool id
- storage_
id str - Storage id
- vm_
id int - VM or CT id
Outputs
All input properties are implicitly available as output properties. Additionally, the Membership resource produces the following output properties:
Look up Existing Membership Resource
Get an existing Membership resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: MembershipState, opts?: CustomResourceOptions): Membership@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
pool_id: Optional[str] = None,
storage_id: Optional[str] = None,
type: Optional[str] = None,
vm_id: Optional[int] = None) -> Membershipfunc GetMembership(ctx *Context, name string, id IDInput, state *MembershipState, opts ...ResourceOption) (*Membership, error)public static Membership Get(string name, Input<string> id, MembershipState? state, CustomResourceOptions? opts = null)public static Membership get(String name, Output<String> id, MembershipState state, CustomResourceOptions options)resources: _: type: proxmoxve:Pool:Membership get: id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- pool_
id str - Resource pool id
- storage_
id str - Storage id
- type str
- Resource pool membership type (can be
vmfor VMs and CTs orstoragefor storages) - vm_
id int - VM or CT id
Import
#!/usr/bin/env sh
Resource pool membership can be imported using its unique identifier, e.g.: {pool_id}/{type}/{member_id}
$ pulumi import proxmoxve:Pool/membership:Membership example_membership test-pool/vm/102
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- proxmoxve muhlba91/pulumi-proxmoxve
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
proxmoxTerraform Provider.
