1. Packages
  2. stackit
  3. API Docs
  4. AffinityGroup
Viewing docs for stackit v0.0.4
published on Friday, Feb 20, 2026 by stackitcloud
stackit logo
Viewing docs for stackit v0.0.4
published on Friday, Feb 20, 2026 by stackitcloud

    Affinity Group schema.

    Example Usage

    resource "stackit_affinity_group" "example" {
      project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
      name       = "example-affinity-group-name"
      policy     = "hard-anti-affinity"
    }
    
    # Only use the import statement, if you want to import an existing affinity group
    import {
      to = stackit_affinity_group.import-example
      id = "${var.project_id},${var.region},${var.affinity_group_id}"
    }
    

    Create AffinityGroup Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new AffinityGroup(name: string, args: AffinityGroupArgs, opts?: CustomResourceOptions);
    @overload
    def AffinityGroup(resource_name: str,
                      args: AffinityGroupArgs,
                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def AffinityGroup(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      policy: Optional[str] = None,
                      project_id: Optional[str] = None,
                      name: Optional[str] = None,
                      region: Optional[str] = None)
    func NewAffinityGroup(ctx *Context, name string, args AffinityGroupArgs, opts ...ResourceOption) (*AffinityGroup, error)
    public AffinityGroup(string name, AffinityGroupArgs args, CustomResourceOptions? opts = null)
    public AffinityGroup(String name, AffinityGroupArgs args)
    public AffinityGroup(String name, AffinityGroupArgs args, CustomResourceOptions options)
    
    type: stackit:AffinityGroup
    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 AffinityGroupArgs
    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 AffinityGroupArgs
    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 AffinityGroupArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AffinityGroupArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AffinityGroupArgs
    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 affinityGroupResource = new Stackit.AffinityGroup("affinityGroupResource", new()
    {
        Policy = "string",
        ProjectId = "string",
        Name = "string",
        Region = "string",
    });
    
    example, err := stackit.NewAffinityGroup(ctx, "affinityGroupResource", &stackit.AffinityGroupArgs{
    	Policy:    pulumi.String("string"),
    	ProjectId: pulumi.String("string"),
    	Name:      pulumi.String("string"),
    	Region:    pulumi.String("string"),
    })
    
    var affinityGroupResource = new AffinityGroup("affinityGroupResource", AffinityGroupArgs.builder()
        .policy("string")
        .projectId("string")
        .name("string")
        .region("string")
        .build());
    
    affinity_group_resource = stackit.AffinityGroup("affinityGroupResource",
        policy="string",
        project_id="string",
        name="string",
        region="string")
    
    const affinityGroupResource = new stackit.AffinityGroup("affinityGroupResource", {
        policy: "string",
        projectId: "string",
        name: "string",
        region: "string",
    });
    
    type: stackit:AffinityGroup
    properties:
        name: string
        policy: string
        projectId: string
        region: string
    

    AffinityGroup 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 AffinityGroup resource accepts the following input properties:

    Policy string
    The policy of the affinity group.
    ProjectId string
    STACKIT Project ID to which the affinity group is associated.
    Name string
    The name of the affinity group.
    Region string
    The resource region. If not defined, the provider region is used.
    Policy string
    The policy of the affinity group.
    ProjectId string
    STACKIT Project ID to which the affinity group is associated.
    Name string
    The name of the affinity group.
    Region string
    The resource region. If not defined, the provider region is used.
    policy String
    The policy of the affinity group.
    projectId String
    STACKIT Project ID to which the affinity group is associated.
    name String
    The name of the affinity group.
    region String
    The resource region. If not defined, the provider region is used.
    policy string
    The policy of the affinity group.
    projectId string
    STACKIT Project ID to which the affinity group is associated.
    name string
    The name of the affinity group.
    region string
    The resource region. If not defined, the provider region is used.
    policy str
    The policy of the affinity group.
    project_id str
    STACKIT Project ID to which the affinity group is associated.
    name str
    The name of the affinity group.
    region str
    The resource region. If not defined, the provider region is used.
    policy String
    The policy of the affinity group.
    projectId String
    STACKIT Project ID to which the affinity group is associated.
    name String
    The name of the affinity group.
    region String
    The resource region. If not defined, the provider region is used.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the AffinityGroup resource produces the following output properties:

    AffinityGroupId string
    The affinity group ID.
    Id string
    The provider-assigned unique ID for this managed resource.
    Members List<string>
    The servers that are part of the affinity group.
    AffinityGroupId string
    The affinity group ID.
    Id string
    The provider-assigned unique ID for this managed resource.
    Members []string
    The servers that are part of the affinity group.
    affinityGroupId String
    The affinity group ID.
    id String
    The provider-assigned unique ID for this managed resource.
    members List<String>
    The servers that are part of the affinity group.
    affinityGroupId string
    The affinity group ID.
    id string
    The provider-assigned unique ID for this managed resource.
    members string[]
    The servers that are part of the affinity group.
    affinity_group_id str
    The affinity group ID.
    id str
    The provider-assigned unique ID for this managed resource.
    members Sequence[str]
    The servers that are part of the affinity group.
    affinityGroupId String
    The affinity group ID.
    id String
    The provider-assigned unique ID for this managed resource.
    members List<String>
    The servers that are part of the affinity group.

    Look up Existing AffinityGroup Resource

    Get an existing AffinityGroup 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?: AffinityGroupState, opts?: CustomResourceOptions): AffinityGroup
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            affinity_group_id: Optional[str] = None,
            members: Optional[Sequence[str]] = None,
            name: Optional[str] = None,
            policy: Optional[str] = None,
            project_id: Optional[str] = None,
            region: Optional[str] = None) -> AffinityGroup
    func GetAffinityGroup(ctx *Context, name string, id IDInput, state *AffinityGroupState, opts ...ResourceOption) (*AffinityGroup, error)
    public static AffinityGroup Get(string name, Input<string> id, AffinityGroupState? state, CustomResourceOptions? opts = null)
    public static AffinityGroup get(String name, Output<String> id, AffinityGroupState state, CustomResourceOptions options)
    resources:  _:    type: stackit:AffinityGroup    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.
    The following state arguments are supported:
    AffinityGroupId string
    The affinity group ID.
    Members List<string>
    The servers that are part of the affinity group.
    Name string
    The name of the affinity group.
    Policy string
    The policy of the affinity group.
    ProjectId string
    STACKIT Project ID to which the affinity group is associated.
    Region string
    The resource region. If not defined, the provider region is used.
    AffinityGroupId string
    The affinity group ID.
    Members []string
    The servers that are part of the affinity group.
    Name string
    The name of the affinity group.
    Policy string
    The policy of the affinity group.
    ProjectId string
    STACKIT Project ID to which the affinity group is associated.
    Region string
    The resource region. If not defined, the provider region is used.
    affinityGroupId String
    The affinity group ID.
    members List<String>
    The servers that are part of the affinity group.
    name String
    The name of the affinity group.
    policy String
    The policy of the affinity group.
    projectId String
    STACKIT Project ID to which the affinity group is associated.
    region String
    The resource region. If not defined, the provider region is used.
    affinityGroupId string
    The affinity group ID.
    members string[]
    The servers that are part of the affinity group.
    name string
    The name of the affinity group.
    policy string
    The policy of the affinity group.
    projectId string
    STACKIT Project ID to which the affinity group is associated.
    region string
    The resource region. If not defined, the provider region is used.
    affinity_group_id str
    The affinity group ID.
    members Sequence[str]
    The servers that are part of the affinity group.
    name str
    The name of the affinity group.
    policy str
    The policy of the affinity group.
    project_id str
    STACKIT Project ID to which the affinity group is associated.
    region str
    The resource region. If not defined, the provider region is used.
    affinityGroupId String
    The affinity group ID.
    members List<String>
    The servers that are part of the affinity group.
    name String
    The name of the affinity group.
    policy String
    The policy of the affinity group.
    projectId String
    STACKIT Project ID to which the affinity group is associated.
    region String
    The resource region. If not defined, the provider region is used.

    Package Details

    Repository
    stackit stackitcloud/pulumi-stackit
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the stackit Terraform Provider.
    stackit logo
    Viewing docs for stackit v0.0.4
    published on Friday, Feb 20, 2026 by stackitcloud
      Try Pulumi Cloud free. Your team will thank you.