linode.PlacementGroupAssignment
Explore with Pulumi AI
Manages a single assignment between a Linode and a Placement Group. For more information, see the Linode APIv4 docs.
To prevent update conflicts, Linodes managed through the linode.Instance
resource should specify placement_group_externally_managed
:
import * as pulumi from "@pulumi/pulumi";
import * as linode from "@pulumi/linode";
const my_instance = new linode.Instance("my-instance", {placementGroupExternallyManaged: true});
import pulumi
import pulumi_linode as linode
my_instance = linode.Instance("my-instance", placement_group_externally_managed=True)
package main
import (
"github.com/pulumi/pulumi-linode/sdk/v4/go/linode"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := linode.NewInstance(ctx, "my-instance", &linode.InstanceArgs{
PlacementGroupExternallyManaged: pulumi.Bool(true),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Linode = Pulumi.Linode;
return await Deployment.RunAsync(() =>
{
var my_instance = new Linode.Instance("my-instance", new()
{
PlacementGroupExternallyManaged = true,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.linode.Instance;
import com.pulumi.linode.InstanceArgs;
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 my_instance = new Instance("my-instance", InstanceArgs.builder()
.placementGroupExternallyManaged(true)
.build());
}
}
resources:
my-instance:
type: linode:Instance
properties:
placementGroupExternallyManaged: true
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as linode from "@pulumi/linode";
const my_pg = new linode.PlacementGroup("my-pg", {
label: "my-pg",
region: "us-east",
placementGroupType: "anti_affinity:local",
});
const my_inst = new linode.Instance("my-inst", {
label: "my-inst",
region: "us-east",
type: "g6-nanode-1",
placementGroupExternallyManaged: true,
});
const my_assignment = new linode.PlacementGroupAssignment("my-assignment", {
placementGroupId: my_pg.id,
linodeId: my_inst.id,
});
import pulumi
import pulumi_linode as linode
my_pg = linode.PlacementGroup("my-pg",
label="my-pg",
region="us-east",
placement_group_type="anti_affinity:local")
my_inst = linode.Instance("my-inst",
label="my-inst",
region="us-east",
type="g6-nanode-1",
placement_group_externally_managed=True)
my_assignment = linode.PlacementGroupAssignment("my-assignment",
placement_group_id=my_pg.id,
linode_id=my_inst.id)
package main
import (
"github.com/pulumi/pulumi-linode/sdk/v4/go/linode"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := linode.NewPlacementGroup(ctx, "my-pg", &linode.PlacementGroupArgs{
Label: pulumi.String("my-pg"),
Region: pulumi.String("us-east"),
PlacementGroupType: pulumi.String("anti_affinity:local"),
})
if err != nil {
return err
}
_, err = linode.NewInstance(ctx, "my-inst", &linode.InstanceArgs{
Label: pulumi.String("my-inst"),
Region: pulumi.String("us-east"),
Type: pulumi.String("g6-nanode-1"),
PlacementGroupExternallyManaged: pulumi.Bool(true),
})
if err != nil {
return err
}
_, err = linode.NewPlacementGroupAssignment(ctx, "my-assignment", &linode.PlacementGroupAssignmentArgs{
PlacementGroupId: my_pg.ID(),
LinodeId: my_inst.ID(),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Linode = Pulumi.Linode;
return await Deployment.RunAsync(() =>
{
var my_pg = new Linode.PlacementGroup("my-pg", new()
{
Label = "my-pg",
Region = "us-east",
PlacementGroupType = "anti_affinity:local",
});
var my_inst = new Linode.Instance("my-inst", new()
{
Label = "my-inst",
Region = "us-east",
Type = "g6-nanode-1",
PlacementGroupExternallyManaged = true,
});
var my_assignment = new Linode.PlacementGroupAssignment("my-assignment", new()
{
PlacementGroupId = my_pg.Id,
LinodeId = my_inst.Id,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.linode.PlacementGroup;
import com.pulumi.linode.PlacementGroupArgs;
import com.pulumi.linode.Instance;
import com.pulumi.linode.InstanceArgs;
import com.pulumi.linode.PlacementGroupAssignment;
import com.pulumi.linode.PlacementGroupAssignmentArgs;
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 my_pg = new PlacementGroup("my-pg", PlacementGroupArgs.builder()
.label("my-pg")
.region("us-east")
.placementGroupType("anti_affinity:local")
.build());
var my_inst = new Instance("my-inst", InstanceArgs.builder()
.label("my-inst")
.region("us-east")
.type("g6-nanode-1")
.placementGroupExternallyManaged(true)
.build());
var my_assignment = new PlacementGroupAssignment("my-assignment", PlacementGroupAssignmentArgs.builder()
.placementGroupId(my_pg.id())
.linodeId(my_inst.id())
.build());
}
}
resources:
my-assignment:
type: linode:PlacementGroupAssignment
properties:
placementGroupId: ${["my-pg"].id}
linodeId: ${["my-inst"].id}
my-pg:
type: linode:PlacementGroup
properties:
label: my-pg
region: us-east
placementGroupType: anti_affinity:local
my-inst:
type: linode:Instance
properties:
label: my-inst
region: us-east
type: g6-nanode-1
placementGroupExternallyManaged: true
Create PlacementGroupAssignment Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new PlacementGroupAssignment(name: string, args: PlacementGroupAssignmentArgs, opts?: CustomResourceOptions);
@overload
def PlacementGroupAssignment(resource_name: str,
args: PlacementGroupAssignmentArgs,
opts: Optional[ResourceOptions] = None)
@overload
def PlacementGroupAssignment(resource_name: str,
opts: Optional[ResourceOptions] = None,
linode_id: Optional[int] = None,
placement_group_id: Optional[int] = None,
compliant_only: Optional[bool] = None)
func NewPlacementGroupAssignment(ctx *Context, name string, args PlacementGroupAssignmentArgs, opts ...ResourceOption) (*PlacementGroupAssignment, error)
public PlacementGroupAssignment(string name, PlacementGroupAssignmentArgs args, CustomResourceOptions? opts = null)
public PlacementGroupAssignment(String name, PlacementGroupAssignmentArgs args)
public PlacementGroupAssignment(String name, PlacementGroupAssignmentArgs args, CustomResourceOptions options)
type: linode:PlacementGroupAssignment
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 PlacementGroupAssignmentArgs
- 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 PlacementGroupAssignmentArgs
- 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 PlacementGroupAssignmentArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args PlacementGroupAssignmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args PlacementGroupAssignmentArgs
- 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 placementGroupAssignmentResource = new Linode.PlacementGroupAssignment("placementGroupAssignmentResource", new()
{
LinodeId = 0,
PlacementGroupId = 0,
CompliantOnly = false,
});
example, err := linode.NewPlacementGroupAssignment(ctx, "placementGroupAssignmentResource", &linode.PlacementGroupAssignmentArgs{
LinodeId: pulumi.Int(0),
PlacementGroupId: pulumi.Int(0),
CompliantOnly: pulumi.Bool(false),
})
var placementGroupAssignmentResource = new PlacementGroupAssignment("placementGroupAssignmentResource", PlacementGroupAssignmentArgs.builder()
.linodeId(0)
.placementGroupId(0)
.compliantOnly(false)
.build());
placement_group_assignment_resource = linode.PlacementGroupAssignment("placementGroupAssignmentResource",
linode_id=0,
placement_group_id=0,
compliant_only=False)
const placementGroupAssignmentResource = new linode.PlacementGroupAssignment("placementGroupAssignmentResource", {
linodeId: 0,
placementGroupId: 0,
compliantOnly: false,
});
type: linode:PlacementGroupAssignment
properties:
compliantOnly: false
linodeId: 0
placementGroupId: 0
PlacementGroupAssignment 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 PlacementGroupAssignment resource accepts the following input properties:
- Linode
Id int - The unique ID of the Linode to assign.
- Placement
Group intId - The unique ID of the target Placement Group.
- Compliant
Only bool
- Linode
Id int - The unique ID of the Linode to assign.
- Placement
Group intId - The unique ID of the target Placement Group.
- Compliant
Only bool
- linode
Id Integer - The unique ID of the Linode to assign.
- placement
Group IntegerId - The unique ID of the target Placement Group.
- compliant
Only Boolean
- linode
Id number - The unique ID of the Linode to assign.
- placement
Group numberId - The unique ID of the target Placement Group.
- compliant
Only boolean
- linode_
id int - The unique ID of the Linode to assign.
- placement_
group_ intid - The unique ID of the target Placement Group.
- compliant_
only bool
- linode
Id Number - The unique ID of the Linode to assign.
- placement
Group NumberId - The unique ID of the target Placement Group.
- compliant
Only Boolean
Outputs
All input properties are implicitly available as output properties. Additionally, the PlacementGroupAssignment 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 PlacementGroupAssignment Resource
Get an existing PlacementGroupAssignment 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?: PlacementGroupAssignmentState, opts?: CustomResourceOptions): PlacementGroupAssignment
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
compliant_only: Optional[bool] = None,
linode_id: Optional[int] = None,
placement_group_id: Optional[int] = None) -> PlacementGroupAssignment
func GetPlacementGroupAssignment(ctx *Context, name string, id IDInput, state *PlacementGroupAssignmentState, opts ...ResourceOption) (*PlacementGroupAssignment, error)
public static PlacementGroupAssignment Get(string name, Input<string> id, PlacementGroupAssignmentState? state, CustomResourceOptions? opts = null)
public static PlacementGroupAssignment get(String name, Output<String> id, PlacementGroupAssignmentState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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.
- Compliant
Only bool - Linode
Id int - The unique ID of the Linode to assign.
- Placement
Group intId - The unique ID of the target Placement Group.
- Compliant
Only bool - Linode
Id int - The unique ID of the Linode to assign.
- Placement
Group intId - The unique ID of the target Placement Group.
- compliant
Only Boolean - linode
Id Integer - The unique ID of the Linode to assign.
- placement
Group IntegerId - The unique ID of the target Placement Group.
- compliant
Only boolean - linode
Id number - The unique ID of the Linode to assign.
- placement
Group numberId - The unique ID of the target Placement Group.
- compliant_
only bool - linode_
id int - The unique ID of the Linode to assign.
- placement_
group_ intid - The unique ID of the target Placement Group.
- compliant
Only Boolean - linode
Id Number - The unique ID of the Linode to assign.
- placement
Group NumberId - The unique ID of the target Placement Group.
Import
Placement Group assignments can be imported using the Placement Group’s ID followed by the Linode’s ID separated by a comma, e.g.
$ pulumi import linode:index/placementGroupAssignment:PlacementGroupAssignment my-assignment 1234567,7654321
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Linode pulumi/pulumi-linode
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
linode
Terraform Provider.