vcd.VmPlacementPolicy
Explore with Pulumi AI
Provides a VMware Cloud Director VM Placement Policy resource. This can be used to create, modify, and delete VM Placement Policy.
Supported in provider v3.8+ and requires VCD 10.2+
Note: This resource requires system administrator privileges.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as vcd from "@pulumi/vcd";
const pvdc = vcd.getProviderVdc({
name: "my-pvdc",
});
const vm_group = pvdc.then(pvdc => vcd.getVmGroup({
name: "vmware-vm-group",
providerVdcId: pvdc.id,
}));
const test_placement_pol = new vcd.VmPlacementPolicy("test-placement-pol", {
description: "My awesome VM Placement Policy",
providerVdcId: pvdc.then(pvdc => pvdc.id),
vmGroupIds: [vm_group.then(vm_group => vm_group.id)],
});
import pulumi
import pulumi_vcd as vcd
pvdc = vcd.get_provider_vdc(name="my-pvdc")
vm_group = vcd.get_vm_group(name="vmware-vm-group",
provider_vdc_id=pvdc.id)
test_placement_pol = vcd.VmPlacementPolicy("test-placement-pol",
description="My awesome VM Placement Policy",
provider_vdc_id=pvdc.id,
vm_group_ids=[vm_group.id])
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/vcd/v3/vcd"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
pvdc, err := vcd.LookupProviderVdc(ctx, &vcd.LookupProviderVdcArgs{
Name: "my-pvdc",
}, nil)
if err != nil {
return err
}
vm_group, err := vcd.GetVmGroup(ctx, &vcd.GetVmGroupArgs{
Name: "vmware-vm-group",
ProviderVdcId: pvdc.Id,
}, nil)
if err != nil {
return err
}
_, err = vcd.NewVmPlacementPolicy(ctx, "test-placement-pol", &vcd.VmPlacementPolicyArgs{
Description: pulumi.String("My awesome VM Placement Policy"),
ProviderVdcId: pulumi.String(pvdc.Id),
VmGroupIds: pulumi.StringArray{
pulumi.String(vm_group.Id),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Vcd = Pulumi.Vcd;
return await Deployment.RunAsync(() =>
{
var pvdc = Vcd.GetProviderVdc.Invoke(new()
{
Name = "my-pvdc",
});
var vm_group = Vcd.GetVmGroup.Invoke(new()
{
Name = "vmware-vm-group",
ProviderVdcId = pvdc.Apply(getProviderVdcResult => getProviderVdcResult.Id),
});
var test_placement_pol = new Vcd.VmPlacementPolicy("test-placement-pol", new()
{
Description = "My awesome VM Placement Policy",
ProviderVdcId = pvdc.Apply(getProviderVdcResult => getProviderVdcResult.Id),
VmGroupIds = new[]
{
vm_group.Apply(vm_group => vm_group.Apply(getVmGroupResult => getVmGroupResult.Id)),
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vcd.VcdFunctions;
import com.pulumi.vcd.inputs.GetProviderVdcArgs;
import com.pulumi.vcd.inputs.GetVmGroupArgs;
import com.pulumi.vcd.VmPlacementPolicy;
import com.pulumi.vcd.VmPlacementPolicyArgs;
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) {
final var pvdc = VcdFunctions.getProviderVdc(GetProviderVdcArgs.builder()
.name("my-pvdc")
.build());
final var vm-group = VcdFunctions.getVmGroup(GetVmGroupArgs.builder()
.name("vmware-vm-group")
.providerVdcId(pvdc.applyValue(getProviderVdcResult -> getProviderVdcResult.id()))
.build());
var test_placement_pol = new VmPlacementPolicy("test-placement-pol", VmPlacementPolicyArgs.builder()
.description("My awesome VM Placement Policy")
.providerVdcId(pvdc.applyValue(getProviderVdcResult -> getProviderVdcResult.id()))
.vmGroupIds(vm_group.id())
.build());
}
}
resources:
test-placement-pol:
type: vcd:VmPlacementPolicy
properties:
description: My awesome VM Placement Policy
providerVdcId: ${pvdc.id}
vmGroupIds:
- ${["vm-group"].id}
variables:
pvdc:
fn::invoke:
function: vcd:getProviderVdc
arguments:
name: my-pvdc
vm-group:
fn::invoke:
function: vcd:getVmGroup
arguments:
name: vmware-vm-group
providerVdcId: ${pvdc.id}
Create VmPlacementPolicy Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new VmPlacementPolicy(name: string, args: VmPlacementPolicyArgs, opts?: CustomResourceOptions);
@overload
def VmPlacementPolicy(resource_name: str,
args: VmPlacementPolicyArgs,
opts: Optional[ResourceOptions] = None)
@overload
def VmPlacementPolicy(resource_name: str,
opts: Optional[ResourceOptions] = None,
provider_vdc_id: Optional[str] = None,
description: Optional[str] = None,
logical_vm_group_ids: Optional[Sequence[str]] = None,
name: Optional[str] = None,
vm_group_ids: Optional[Sequence[str]] = None,
vm_placement_policy_id: Optional[str] = None)
func NewVmPlacementPolicy(ctx *Context, name string, args VmPlacementPolicyArgs, opts ...ResourceOption) (*VmPlacementPolicy, error)
public VmPlacementPolicy(string name, VmPlacementPolicyArgs args, CustomResourceOptions? opts = null)
public VmPlacementPolicy(String name, VmPlacementPolicyArgs args)
public VmPlacementPolicy(String name, VmPlacementPolicyArgs args, CustomResourceOptions options)
type: vcd:VmPlacementPolicy
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 VmPlacementPolicyArgs
- 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 VmPlacementPolicyArgs
- 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 VmPlacementPolicyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args VmPlacementPolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args VmPlacementPolicyArgs
- 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 vmPlacementPolicyResource = new Vcd.VmPlacementPolicy("vmPlacementPolicyResource", new()
{
ProviderVdcId = "string",
Description = "string",
LogicalVmGroupIds = new[]
{
"string",
},
Name = "string",
VmGroupIds = new[]
{
"string",
},
VmPlacementPolicyId = "string",
});
example, err := vcd.NewVmPlacementPolicy(ctx, "vmPlacementPolicyResource", &vcd.VmPlacementPolicyArgs{
ProviderVdcId: pulumi.String("string"),
Description: pulumi.String("string"),
LogicalVmGroupIds: pulumi.StringArray{
pulumi.String("string"),
},
Name: pulumi.String("string"),
VmGroupIds: pulumi.StringArray{
pulumi.String("string"),
},
VmPlacementPolicyId: pulumi.String("string"),
})
var vmPlacementPolicyResource = new VmPlacementPolicy("vmPlacementPolicyResource", VmPlacementPolicyArgs.builder()
.providerVdcId("string")
.description("string")
.logicalVmGroupIds("string")
.name("string")
.vmGroupIds("string")
.vmPlacementPolicyId("string")
.build());
vm_placement_policy_resource = vcd.VmPlacementPolicy("vmPlacementPolicyResource",
provider_vdc_id="string",
description="string",
logical_vm_group_ids=["string"],
name="string",
vm_group_ids=["string"],
vm_placement_policy_id="string")
const vmPlacementPolicyResource = new vcd.VmPlacementPolicy("vmPlacementPolicyResource", {
providerVdcId: "string",
description: "string",
logicalVmGroupIds: ["string"],
name: "string",
vmGroupIds: ["string"],
vmPlacementPolicyId: "string",
});
type: vcd:VmPlacementPolicy
properties:
description: string
logicalVmGroupIds:
- string
name: string
providerVdcId: string
vmGroupIds:
- string
vmPlacementPolicyId: string
VmPlacementPolicy 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 VmPlacementPolicy resource accepts the following input properties:
- Provider
Vdc stringId - The ID of the Provider VDC to which this VM Placement Policy belongs.
- Description string
- description of VM Placement Policy.
- Logical
Vm List<string>Group Ids - IDs of one or more Logical VM Groups to define this VM Placement Policy. There is an AND relationship among all the entries set in this attribute
- Name string
- The name of VM Placement Policy.
- Vm
Group List<string>Ids - IDs of the collection of VMs with similar host requirements. Note: Either
vm_group_ids
orlogical_vm_group_ids
must be set. - Vm
Placement stringPolicy Id
- Provider
Vdc stringId - The ID of the Provider VDC to which this VM Placement Policy belongs.
- Description string
- description of VM Placement Policy.
- Logical
Vm []stringGroup Ids - IDs of one or more Logical VM Groups to define this VM Placement Policy. There is an AND relationship among all the entries set in this attribute
- Name string
- The name of VM Placement Policy.
- Vm
Group []stringIds - IDs of the collection of VMs with similar host requirements. Note: Either
vm_group_ids
orlogical_vm_group_ids
must be set. - Vm
Placement stringPolicy Id
- provider
Vdc StringId - The ID of the Provider VDC to which this VM Placement Policy belongs.
- description String
- description of VM Placement Policy.
- logical
Vm List<String>Group Ids - IDs of one or more Logical VM Groups to define this VM Placement Policy. There is an AND relationship among all the entries set in this attribute
- name String
- The name of VM Placement Policy.
- vm
Group List<String>Ids - IDs of the collection of VMs with similar host requirements. Note: Either
vm_group_ids
orlogical_vm_group_ids
must be set. - vm
Placement StringPolicy Id
- provider
Vdc stringId - The ID of the Provider VDC to which this VM Placement Policy belongs.
- description string
- description of VM Placement Policy.
- logical
Vm string[]Group Ids - IDs of one or more Logical VM Groups to define this VM Placement Policy. There is an AND relationship among all the entries set in this attribute
- name string
- The name of VM Placement Policy.
- vm
Group string[]Ids - IDs of the collection of VMs with similar host requirements. Note: Either
vm_group_ids
orlogical_vm_group_ids
must be set. - vm
Placement stringPolicy Id
- provider_
vdc_ strid - The ID of the Provider VDC to which this VM Placement Policy belongs.
- description str
- description of VM Placement Policy.
- logical_
vm_ Sequence[str]group_ ids - IDs of one or more Logical VM Groups to define this VM Placement Policy. There is an AND relationship among all the entries set in this attribute
- name str
- The name of VM Placement Policy.
- vm_
group_ Sequence[str]ids - IDs of the collection of VMs with similar host requirements. Note: Either
vm_group_ids
orlogical_vm_group_ids
must be set. - vm_
placement_ strpolicy_ id
- provider
Vdc StringId - The ID of the Provider VDC to which this VM Placement Policy belongs.
- description String
- description of VM Placement Policy.
- logical
Vm List<String>Group Ids - IDs of one or more Logical VM Groups to define this VM Placement Policy. There is an AND relationship among all the entries set in this attribute
- name String
- The name of VM Placement Policy.
- vm
Group List<String>Ids - IDs of the collection of VMs with similar host requirements. Note: Either
vm_group_ids
orlogical_vm_group_ids
must be set. - vm
Placement StringPolicy Id
Outputs
All input properties are implicitly available as output properties. Additionally, the VmPlacementPolicy resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing VmPlacementPolicy Resource
Get an existing VmPlacementPolicy 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?: VmPlacementPolicyState, opts?: CustomResourceOptions): VmPlacementPolicy
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
description: Optional[str] = None,
logical_vm_group_ids: Optional[Sequence[str]] = None,
name: Optional[str] = None,
provider_vdc_id: Optional[str] = None,
vm_group_ids: Optional[Sequence[str]] = None,
vm_placement_policy_id: Optional[str] = None) -> VmPlacementPolicy
func GetVmPlacementPolicy(ctx *Context, name string, id IDInput, state *VmPlacementPolicyState, opts ...ResourceOption) (*VmPlacementPolicy, error)
public static VmPlacementPolicy Get(string name, Input<string> id, VmPlacementPolicyState? state, CustomResourceOptions? opts = null)
public static VmPlacementPolicy get(String name, Output<String> id, VmPlacementPolicyState state, CustomResourceOptions options)
resources: _: type: vcd:VmPlacementPolicy 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.
- Description string
- description of VM Placement Policy.
- Logical
Vm List<string>Group Ids - IDs of one or more Logical VM Groups to define this VM Placement Policy. There is an AND relationship among all the entries set in this attribute
- Name string
- The name of VM Placement Policy.
- Provider
Vdc stringId - The ID of the Provider VDC to which this VM Placement Policy belongs.
- Vm
Group List<string>Ids - IDs of the collection of VMs with similar host requirements. Note: Either
vm_group_ids
orlogical_vm_group_ids
must be set. - Vm
Placement stringPolicy Id
- Description string
- description of VM Placement Policy.
- Logical
Vm []stringGroup Ids - IDs of one or more Logical VM Groups to define this VM Placement Policy. There is an AND relationship among all the entries set in this attribute
- Name string
- The name of VM Placement Policy.
- Provider
Vdc stringId - The ID of the Provider VDC to which this VM Placement Policy belongs.
- Vm
Group []stringIds - IDs of the collection of VMs with similar host requirements. Note: Either
vm_group_ids
orlogical_vm_group_ids
must be set. - Vm
Placement stringPolicy Id
- description String
- description of VM Placement Policy.
- logical
Vm List<String>Group Ids - IDs of one or more Logical VM Groups to define this VM Placement Policy. There is an AND relationship among all the entries set in this attribute
- name String
- The name of VM Placement Policy.
- provider
Vdc StringId - The ID of the Provider VDC to which this VM Placement Policy belongs.
- vm
Group List<String>Ids - IDs of the collection of VMs with similar host requirements. Note: Either
vm_group_ids
orlogical_vm_group_ids
must be set. - vm
Placement StringPolicy Id
- description string
- description of VM Placement Policy.
- logical
Vm string[]Group Ids - IDs of one or more Logical VM Groups to define this VM Placement Policy. There is an AND relationship among all the entries set in this attribute
- name string
- The name of VM Placement Policy.
- provider
Vdc stringId - The ID of the Provider VDC to which this VM Placement Policy belongs.
- vm
Group string[]Ids - IDs of the collection of VMs with similar host requirements. Note: Either
vm_group_ids
orlogical_vm_group_ids
must be set. - vm
Placement stringPolicy Id
- description str
- description of VM Placement Policy.
- logical_
vm_ Sequence[str]group_ ids - IDs of one or more Logical VM Groups to define this VM Placement Policy. There is an AND relationship among all the entries set in this attribute
- name str
- The name of VM Placement Policy.
- provider_
vdc_ strid - The ID of the Provider VDC to which this VM Placement Policy belongs.
- vm_
group_ Sequence[str]ids - IDs of the collection of VMs with similar host requirements. Note: Either
vm_group_ids
orlogical_vm_group_ids
must be set. - vm_
placement_ strpolicy_ id
- description String
- description of VM Placement Policy.
- logical
Vm List<String>Group Ids - IDs of one or more Logical VM Groups to define this VM Placement Policy. There is an AND relationship among all the entries set in this attribute
- name String
- The name of VM Placement Policy.
- provider
Vdc StringId - The ID of the Provider VDC to which this VM Placement Policy belongs.
- vm
Group List<String>Ids - IDs of the collection of VMs with similar host requirements. Note: Either
vm_group_ids
orlogical_vm_group_ids
must be set. - vm
Placement StringPolicy Id
Package Details
- Repository
- vcd vmware/terraform-provider-vcd
- License
- Notes
- This Pulumi package is based on the
vcd
Terraform Provider.