1. Packages
  2. OpenStack
  3. API Docs
  4. compute
  5. ServerGroup
OpenStack v3.15.1 published on Thursday, Feb 1, 2024 by Pulumi

openstack.compute.ServerGroup

Explore with Pulumi AI

openstack logo
OpenStack v3.15.1 published on Thursday, Feb 1, 2024 by Pulumi

    Manages a V2 Server Group resource within OpenStack.

    Policies

    • affinity - All instances/servers launched in this group will be hosted on the same compute node.

    • anti-affinity - All instances/servers launched in this group will be hosted on different compute nodes.

    • soft-affinity - All instances/servers launched in this group will be hosted on the same compute node if possible, but if not possible they still will be scheduled instead of failure. To use this policy your OpenStack environment should support Compute service API 2.15 or above.

    • soft-anti-affinity - All instances/servers launched in this group will be hosted on different compute nodes if possible, but if not possible they still will be scheduled instead of failure. To use this policy your OpenStack environment should support Compute service API 2.15 or above.

    Example Usage

    Compute service API version 2.63 or below:

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using OpenStack = Pulumi.OpenStack;
    
    return await Deployment.RunAsync(() => 
    {
        var test_sg = new OpenStack.Compute.ServerGroup("test-sg", new()
        {
            Policies = new[]
            {
                "anti-affinity",
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-openstack/sdk/v3/go/openstack/compute"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := compute.NewServerGroup(ctx, "test-sg", &compute.ServerGroupArgs{
    			Policies: pulumi.StringArray{
    				pulumi.String("anti-affinity"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.openstack.compute.ServerGroup;
    import com.pulumi.openstack.compute.ServerGroupArgs;
    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 test_sg = new ServerGroup("test-sg", ServerGroupArgs.builder()        
                .policies("anti-affinity")
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_openstack as openstack
    
    test_sg = openstack.compute.ServerGroup("test-sg", policies=["anti-affinity"])
    
    import * as pulumi from "@pulumi/pulumi";
    import * as openstack from "@pulumi/openstack";
    
    const test_sg = new openstack.compute.ServerGroup("test-sg", {policies: ["anti-affinity"]});
    
    resources:
      test-sg:
        type: openstack:compute:ServerGroup
        properties:
          policies:
            - anti-affinity
    

    Compute service API version 2.64 or above:

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using OpenStack = Pulumi.OpenStack;
    
    return await Deployment.RunAsync(() => 
    {
        var test_sg = new OpenStack.Compute.ServerGroup("test-sg", new()
        {
            Policies = new[]
            {
                "anti-affinity",
            },
            Rules = new OpenStack.Compute.Inputs.ServerGroupRulesArgs
            {
                MaxServerPerHost = 3,
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-openstack/sdk/v3/go/openstack/compute"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := compute.NewServerGroup(ctx, "test-sg", &compute.ServerGroupArgs{
    			Policies: pulumi.StringArray{
    				pulumi.String("anti-affinity"),
    			},
    			Rules: &compute.ServerGroupRulesArgs{
    				MaxServerPerHost: pulumi.Int(3),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.openstack.compute.ServerGroup;
    import com.pulumi.openstack.compute.ServerGroupArgs;
    import com.pulumi.openstack.compute.inputs.ServerGroupRulesArgs;
    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 test_sg = new ServerGroup("test-sg", ServerGroupArgs.builder()        
                .policies("anti-affinity")
                .rules(ServerGroupRulesArgs.builder()
                    .maxServerPerHost(3)
                    .build())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_openstack as openstack
    
    test_sg = openstack.compute.ServerGroup("test-sg",
        policies=["anti-affinity"],
        rules=openstack.compute.ServerGroupRulesArgs(
            max_server_per_host=3,
        ))
    
    import * as pulumi from "@pulumi/pulumi";
    import * as openstack from "@pulumi/openstack";
    
    const test_sg = new openstack.compute.ServerGroup("test-sg", {
        policies: ["anti-affinity"],
        rules: {
            maxServerPerHost: 3,
        },
    });
    
    resources:
      test-sg:
        type: openstack:compute:ServerGroup
        properties:
          policies:
            - anti-affinity
          rules:
            maxServerPerHost: 3
    

    Create ServerGroup Resource

    new ServerGroup(name: string, args?: ServerGroupArgs, opts?: CustomResourceOptions);
    @overload
    def ServerGroup(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    name: Optional[str] = None,
                    policies: Optional[Sequence[str]] = None,
                    region: Optional[str] = None,
                    rules: Optional[ServerGroupRulesArgs] = None,
                    value_specs: Optional[Mapping[str, Any]] = None)
    @overload
    def ServerGroup(resource_name: str,
                    args: Optional[ServerGroupArgs] = None,
                    opts: Optional[ResourceOptions] = None)
    func NewServerGroup(ctx *Context, name string, args *ServerGroupArgs, opts ...ResourceOption) (*ServerGroup, error)
    public ServerGroup(string name, ServerGroupArgs? args = null, CustomResourceOptions? opts = null)
    public ServerGroup(String name, ServerGroupArgs args)
    public ServerGroup(String name, ServerGroupArgs args, CustomResourceOptions options)
    
    type: openstack:compute:ServerGroup
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args ServerGroupArgs
    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 ServerGroupArgs
    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 ServerGroupArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ServerGroupArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ServerGroupArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    ServerGroup Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The ServerGroup resource accepts the following input properties:

    Name string
    A unique name for the server group. Changing this creates a new server group.
    Policies List<string>
    A list of exactly one policy name to associate with the server group. See the Policies section for more information. Changing this creates a new server group.
    Region string
    The region in which to obtain the V2 Compute client. If omitted, the region argument of the provider is used. Changing this creates a new server group.
    Rules Pulumi.OpenStack.Compute.Inputs.ServerGroupRules
    The rules which are applied to specified policy. Currently, only the max_server_per_host rule is supported for the anti-affinity policy.
    ValueSpecs Dictionary<string, object>
    Map of additional options.
    Name string
    A unique name for the server group. Changing this creates a new server group.
    Policies []string
    A list of exactly one policy name to associate with the server group. See the Policies section for more information. Changing this creates a new server group.
    Region string
    The region in which to obtain the V2 Compute client. If omitted, the region argument of the provider is used. Changing this creates a new server group.
    Rules ServerGroupRulesArgs
    The rules which are applied to specified policy. Currently, only the max_server_per_host rule is supported for the anti-affinity policy.
    ValueSpecs map[string]interface{}
    Map of additional options.
    name String
    A unique name for the server group. Changing this creates a new server group.
    policies List<String>
    A list of exactly one policy name to associate with the server group. See the Policies section for more information. Changing this creates a new server group.
    region String
    The region in which to obtain the V2 Compute client. If omitted, the region argument of the provider is used. Changing this creates a new server group.
    rules ServerGroupRules
    The rules which are applied to specified policy. Currently, only the max_server_per_host rule is supported for the anti-affinity policy.
    valueSpecs Map<String,Object>
    Map of additional options.
    name string
    A unique name for the server group. Changing this creates a new server group.
    policies string[]
    A list of exactly one policy name to associate with the server group. See the Policies section for more information. Changing this creates a new server group.
    region string
    The region in which to obtain the V2 Compute client. If omitted, the region argument of the provider is used. Changing this creates a new server group.
    rules ServerGroupRules
    The rules which are applied to specified policy. Currently, only the max_server_per_host rule is supported for the anti-affinity policy.
    valueSpecs {[key: string]: any}
    Map of additional options.
    name str
    A unique name for the server group. Changing this creates a new server group.
    policies Sequence[str]
    A list of exactly one policy name to associate with the server group. See the Policies section for more information. Changing this creates a new server group.
    region str
    The region in which to obtain the V2 Compute client. If omitted, the region argument of the provider is used. Changing this creates a new server group.
    rules ServerGroupRulesArgs
    The rules which are applied to specified policy. Currently, only the max_server_per_host rule is supported for the anti-affinity policy.
    value_specs Mapping[str, Any]
    Map of additional options.
    name String
    A unique name for the server group. Changing this creates a new server group.
    policies List<String>
    A list of exactly one policy name to associate with the server group. See the Policies section for more information. Changing this creates a new server group.
    region String
    The region in which to obtain the V2 Compute client. If omitted, the region argument of the provider is used. Changing this creates a new server group.
    rules Property Map
    The rules which are applied to specified policy. Currently, only the max_server_per_host rule is supported for the anti-affinity policy.
    valueSpecs Map<Any>
    Map of additional options.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Members List<string>
    The instances that are part of this server group.
    Id string
    The provider-assigned unique ID for this managed resource.
    Members []string
    The instances that are part of this server group.
    id String
    The provider-assigned unique ID for this managed resource.
    members List<String>
    The instances that are part of this server group.
    id string
    The provider-assigned unique ID for this managed resource.
    members string[]
    The instances that are part of this server group.
    id str
    The provider-assigned unique ID for this managed resource.
    members Sequence[str]
    The instances that are part of this server group.
    id String
    The provider-assigned unique ID for this managed resource.
    members List<String>
    The instances that are part of this server group.

    Look up Existing ServerGroup Resource

    Get an existing ServerGroup 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?: ServerGroupState, opts?: CustomResourceOptions): ServerGroup
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            members: Optional[Sequence[str]] = None,
            name: Optional[str] = None,
            policies: Optional[Sequence[str]] = None,
            region: Optional[str] = None,
            rules: Optional[ServerGroupRulesArgs] = None,
            value_specs: Optional[Mapping[str, Any]] = None) -> ServerGroup
    func GetServerGroup(ctx *Context, name string, id IDInput, state *ServerGroupState, opts ...ResourceOption) (*ServerGroup, error)
    public static ServerGroup Get(string name, Input<string> id, ServerGroupState? state, CustomResourceOptions? opts = null)
    public static ServerGroup get(String name, Output<String> id, ServerGroupState 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.
    The following state arguments are supported:
    Members List<string>
    The instances that are part of this server group.
    Name string
    A unique name for the server group. Changing this creates a new server group.
    Policies List<string>
    A list of exactly one policy name to associate with the server group. See the Policies section for more information. Changing this creates a new server group.
    Region string
    The region in which to obtain the V2 Compute client. If omitted, the region argument of the provider is used. Changing this creates a new server group.
    Rules Pulumi.OpenStack.Compute.Inputs.ServerGroupRules
    The rules which are applied to specified policy. Currently, only the max_server_per_host rule is supported for the anti-affinity policy.
    ValueSpecs Dictionary<string, object>
    Map of additional options.
    Members []string
    The instances that are part of this server group.
    Name string
    A unique name for the server group. Changing this creates a new server group.
    Policies []string
    A list of exactly one policy name to associate with the server group. See the Policies section for more information. Changing this creates a new server group.
    Region string
    The region in which to obtain the V2 Compute client. If omitted, the region argument of the provider is used. Changing this creates a new server group.
    Rules ServerGroupRulesArgs
    The rules which are applied to specified policy. Currently, only the max_server_per_host rule is supported for the anti-affinity policy.
    ValueSpecs map[string]interface{}
    Map of additional options.
    members List<String>
    The instances that are part of this server group.
    name String
    A unique name for the server group. Changing this creates a new server group.
    policies List<String>
    A list of exactly one policy name to associate with the server group. See the Policies section for more information. Changing this creates a new server group.
    region String
    The region in which to obtain the V2 Compute client. If omitted, the region argument of the provider is used. Changing this creates a new server group.
    rules ServerGroupRules
    The rules which are applied to specified policy. Currently, only the max_server_per_host rule is supported for the anti-affinity policy.
    valueSpecs Map<String,Object>
    Map of additional options.
    members string[]
    The instances that are part of this server group.
    name string
    A unique name for the server group. Changing this creates a new server group.
    policies string[]
    A list of exactly one policy name to associate with the server group. See the Policies section for more information. Changing this creates a new server group.
    region string
    The region in which to obtain the V2 Compute client. If omitted, the region argument of the provider is used. Changing this creates a new server group.
    rules ServerGroupRules
    The rules which are applied to specified policy. Currently, only the max_server_per_host rule is supported for the anti-affinity policy.
    valueSpecs {[key: string]: any}
    Map of additional options.
    members Sequence[str]
    The instances that are part of this server group.
    name str
    A unique name for the server group. Changing this creates a new server group.
    policies Sequence[str]
    A list of exactly one policy name to associate with the server group. See the Policies section for more information. Changing this creates a new server group.
    region str
    The region in which to obtain the V2 Compute client. If omitted, the region argument of the provider is used. Changing this creates a new server group.
    rules ServerGroupRulesArgs
    The rules which are applied to specified policy. Currently, only the max_server_per_host rule is supported for the anti-affinity policy.
    value_specs Mapping[str, Any]
    Map of additional options.
    members List<String>
    The instances that are part of this server group.
    name String
    A unique name for the server group. Changing this creates a new server group.
    policies List<String>
    A list of exactly one policy name to associate with the server group. See the Policies section for more information. Changing this creates a new server group.
    region String
    The region in which to obtain the V2 Compute client. If omitted, the region argument of the provider is used. Changing this creates a new server group.
    rules Property Map
    The rules which are applied to specified policy. Currently, only the max_server_per_host rule is supported for the anti-affinity policy.
    valueSpecs Map<Any>
    Map of additional options.

    Supporting Types

    ServerGroupRules, ServerGroupRulesArgs

    Import

    Server Groups can be imported using the id, e.g.

     $ pulumi import openstack:compute/serverGroup:ServerGroup test-sg 1bc30ee9-9d5b-4c30-bdd5-7f1e663f5edf
    

    Package Details

    Repository
    OpenStack pulumi/pulumi-openstack
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the openstack Terraform Provider.
    openstack logo
    OpenStack v3.15.1 published on Thursday, Feb 1, 2024 by Pulumi