upcloud.ServerGroup
Explore with Pulumi AI
Server groups allow grouping servers and defining anti-affinity for the servers.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as upcloud from "@upcloud/pulumi-upcloud";
const main = new upcloud.ServerGroup("main", {
title: "main_group",
antiAffinityPolicy: "yes",
labels: {
key1: "val1",
key2: "val2",
key3: "val3",
},
members: [
"00b51165-fb58-4b77-bb8c-552277be1764",
"00d56575-3821-3301-9de4-2b2bc7e35pqf",
"000012dc-fe8c-a3y6-91f9-0db1215c36cf",
],
});
import pulumi
import pulumi_upcloud as upcloud
main = upcloud.ServerGroup("main",
title="main_group",
anti_affinity_policy="yes",
labels={
"key1": "val1",
"key2": "val2",
"key3": "val3",
},
members=[
"00b51165-fb58-4b77-bb8c-552277be1764",
"00d56575-3821-3301-9de4-2b2bc7e35pqf",
"000012dc-fe8c-a3y6-91f9-0db1215c36cf",
])
package main
import (
"github.com/UpCloudLtd/pulumi-upcloud/sdk/go/upcloud"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := upcloud.NewServerGroup(ctx, "main", &upcloud.ServerGroupArgs{
Title: pulumi.String("main_group"),
AntiAffinityPolicy: pulumi.String("yes"),
Labels: pulumi.StringMap{
"key1": pulumi.String("val1"),
"key2": pulumi.String("val2"),
"key3": pulumi.String("val3"),
},
Members: pulumi.StringArray{
pulumi.String("00b51165-fb58-4b77-bb8c-552277be1764"),
pulumi.String("00d56575-3821-3301-9de4-2b2bc7e35pqf"),
pulumi.String("000012dc-fe8c-a3y6-91f9-0db1215c36cf"),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using UpCloud = UpCloud.Pulumi.UpCloud;
return await Deployment.RunAsync(() =>
{
var main = new UpCloud.ServerGroup("main", new()
{
Title = "main_group",
AntiAffinityPolicy = "yes",
Labels =
{
{ "key1", "val1" },
{ "key2", "val2" },
{ "key3", "val3" },
},
Members = new[]
{
"00b51165-fb58-4b77-bb8c-552277be1764",
"00d56575-3821-3301-9de4-2b2bc7e35pqf",
"000012dc-fe8c-a3y6-91f9-0db1215c36cf",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.upcloud.ServerGroup;
import com.pulumi.upcloud.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 main = new ServerGroup("main", ServerGroupArgs.builder()
.title("main_group")
.antiAffinityPolicy("yes")
.labels(Map.ofEntries(
Map.entry("key1", "val1"),
Map.entry("key2", "val2"),
Map.entry("key3", "val3")
))
.members(
"00b51165-fb58-4b77-bb8c-552277be1764",
"00d56575-3821-3301-9de4-2b2bc7e35pqf",
"000012dc-fe8c-a3y6-91f9-0db1215c36cf")
.build());
}
}
resources:
main:
type: upcloud:ServerGroup
properties:
title: main_group
antiAffinityPolicy: yes
labels:
key1: val1
key2: val2
key3: val3
members:
- 00b51165-fb58-4b77-bb8c-552277be1764
- 00d56575-3821-3301-9de4-2b2bc7e35pqf
- 000012dc-fe8c-a3y6-91f9-0db1215c36cf
Create ServerGroup Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ServerGroup(name: string, args: ServerGroupArgs, opts?: CustomResourceOptions);
@overload
def ServerGroup(resource_name: str,
args: ServerGroupArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ServerGroup(resource_name: str,
opts: Optional[ResourceOptions] = None,
title: Optional[str] = None,
anti_affinity_policy: Optional[str] = None,
labels: Optional[Mapping[str, str]] = None,
members: Optional[Sequence[str]] = None,
track_members: Optional[bool] = None)
func NewServerGroup(ctx *Context, name string, args ServerGroupArgs, opts ...ResourceOption) (*ServerGroup, error)
public ServerGroup(string name, ServerGroupArgs args, CustomResourceOptions? opts = null)
public ServerGroup(String name, ServerGroupArgs args)
public ServerGroup(String name, ServerGroupArgs args, CustomResourceOptions options)
type: upcloud:ServerGroup
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 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var serverGroupResource = new UpCloud.ServerGroup("serverGroupResource", new()
{
Title = "string",
AntiAffinityPolicy = "string",
Labels =
{
{ "string", "string" },
},
Members = new[]
{
"string",
},
TrackMembers = false,
});
example, err := upcloud.NewServerGroup(ctx, "serverGroupResource", &upcloud.ServerGroupArgs{
Title: pulumi.String("string"),
AntiAffinityPolicy: pulumi.String("string"),
Labels: pulumi.StringMap{
"string": pulumi.String("string"),
},
Members: pulumi.StringArray{
pulumi.String("string"),
},
TrackMembers: pulumi.Bool(false),
})
var serverGroupResource = new ServerGroup("serverGroupResource", ServerGroupArgs.builder()
.title("string")
.antiAffinityPolicy("string")
.labels(Map.of("string", "string"))
.members("string")
.trackMembers(false)
.build());
server_group_resource = upcloud.ServerGroup("serverGroupResource",
title="string",
anti_affinity_policy="string",
labels={
"string": "string",
},
members=["string"],
track_members=False)
const serverGroupResource = new upcloud.ServerGroup("serverGroupResource", {
title: "string",
antiAffinityPolicy: "string",
labels: {
string: "string",
},
members: ["string"],
trackMembers: false,
});
type: upcloud:ServerGroup
properties:
antiAffinityPolicy: string
labels:
string: string
members:
- string
title: string
trackMembers: false
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The ServerGroup resource accepts the following input properties:
- Title string
- Title of your server group
- Anti
Affinity stringPolicy - Defines if a server group is an anti-affinity group. Setting this to
strict
oryes
will result in all servers in the group being placed on separate compute hosts. The value can bestrict
,yes
, orno
. *strict
policy doesn't allow servers in the same server group to be on the same host *yes
refers to best-effort policy and tries to put servers on different hosts, but this is not guaranteed *no
refers to having no policy and thus no effect on server host affinity To verify if the anti-affinity policies are met by requesting a server group details from API. For more information please see UpCloud API documentation on server groups. Plese also note that anti-affinity policies are only applied on server start. This means that if anti-affinity policies in server group are not met, you need to manually restart the servers in said group, for example via API, UpCloud Control Panel or upctl (UpCloud CLI) - Labels Dictionary<string, string>
- User defined key-value pairs to classify the server group.
- Members List<string>
- UUIDs of the servers that are members of this group. Servers can also be attached to the server group via
server_group
property ofupcloud.Server
. See alsotrack_members
property. - Track
Members bool - Controls if members of the server group are being tracked in this resource. Set to
false
when usingserver_group
property ofupcloud.Server
to attach servers to the server group to avoid delayed state updates.
- Title string
- Title of your server group
- Anti
Affinity stringPolicy - Defines if a server group is an anti-affinity group. Setting this to
strict
oryes
will result in all servers in the group being placed on separate compute hosts. The value can bestrict
,yes
, orno
. *strict
policy doesn't allow servers in the same server group to be on the same host *yes
refers to best-effort policy and tries to put servers on different hosts, but this is not guaranteed *no
refers to having no policy and thus no effect on server host affinity To verify if the anti-affinity policies are met by requesting a server group details from API. For more information please see UpCloud API documentation on server groups. Plese also note that anti-affinity policies are only applied on server start. This means that if anti-affinity policies in server group are not met, you need to manually restart the servers in said group, for example via API, UpCloud Control Panel or upctl (UpCloud CLI) - Labels map[string]string
- User defined key-value pairs to classify the server group.
- Members []string
- UUIDs of the servers that are members of this group. Servers can also be attached to the server group via
server_group
property ofupcloud.Server
. See alsotrack_members
property. - Track
Members bool - Controls if members of the server group are being tracked in this resource. Set to
false
when usingserver_group
property ofupcloud.Server
to attach servers to the server group to avoid delayed state updates.
- title String
- Title of your server group
- anti
Affinity StringPolicy - Defines if a server group is an anti-affinity group. Setting this to
strict
oryes
will result in all servers in the group being placed on separate compute hosts. The value can bestrict
,yes
, orno
. *strict
policy doesn't allow servers in the same server group to be on the same host *yes
refers to best-effort policy and tries to put servers on different hosts, but this is not guaranteed *no
refers to having no policy and thus no effect on server host affinity To verify if the anti-affinity policies are met by requesting a server group details from API. For more information please see UpCloud API documentation on server groups. Plese also note that anti-affinity policies are only applied on server start. This means that if anti-affinity policies in server group are not met, you need to manually restart the servers in said group, for example via API, UpCloud Control Panel or upctl (UpCloud CLI) - labels Map<String,String>
- User defined key-value pairs to classify the server group.
- members List<String>
- UUIDs of the servers that are members of this group. Servers can also be attached to the server group via
server_group
property ofupcloud.Server
. See alsotrack_members
property. - track
Members Boolean - Controls if members of the server group are being tracked in this resource. Set to
false
when usingserver_group
property ofupcloud.Server
to attach servers to the server group to avoid delayed state updates.
- title string
- Title of your server group
- anti
Affinity stringPolicy - Defines if a server group is an anti-affinity group. Setting this to
strict
oryes
will result in all servers in the group being placed on separate compute hosts. The value can bestrict
,yes
, orno
. *strict
policy doesn't allow servers in the same server group to be on the same host *yes
refers to best-effort policy and tries to put servers on different hosts, but this is not guaranteed *no
refers to having no policy and thus no effect on server host affinity To verify if the anti-affinity policies are met by requesting a server group details from API. For more information please see UpCloud API documentation on server groups. Plese also note that anti-affinity policies are only applied on server start. This means that if anti-affinity policies in server group are not met, you need to manually restart the servers in said group, for example via API, UpCloud Control Panel or upctl (UpCloud CLI) - labels {[key: string]: string}
- User defined key-value pairs to classify the server group.
- members string[]
- UUIDs of the servers that are members of this group. Servers can also be attached to the server group via
server_group
property ofupcloud.Server
. See alsotrack_members
property. - track
Members boolean - Controls if members of the server group are being tracked in this resource. Set to
false
when usingserver_group
property ofupcloud.Server
to attach servers to the server group to avoid delayed state updates.
- title str
- Title of your server group
- anti_
affinity_ strpolicy - Defines if a server group is an anti-affinity group. Setting this to
strict
oryes
will result in all servers in the group being placed on separate compute hosts. The value can bestrict
,yes
, orno
. *strict
policy doesn't allow servers in the same server group to be on the same host *yes
refers to best-effort policy and tries to put servers on different hosts, but this is not guaranteed *no
refers to having no policy and thus no effect on server host affinity To verify if the anti-affinity policies are met by requesting a server group details from API. For more information please see UpCloud API documentation on server groups. Plese also note that anti-affinity policies are only applied on server start. This means that if anti-affinity policies in server group are not met, you need to manually restart the servers in said group, for example via API, UpCloud Control Panel or upctl (UpCloud CLI) - labels Mapping[str, str]
- User defined key-value pairs to classify the server group.
- members Sequence[str]
- UUIDs of the servers that are members of this group. Servers can also be attached to the server group via
server_group
property ofupcloud.Server
. See alsotrack_members
property. - track_
members bool - Controls if members of the server group are being tracked in this resource. Set to
false
when usingserver_group
property ofupcloud.Server
to attach servers to the server group to avoid delayed state updates.
- title String
- Title of your server group
- anti
Affinity StringPolicy - Defines if a server group is an anti-affinity group. Setting this to
strict
oryes
will result in all servers in the group being placed on separate compute hosts. The value can bestrict
,yes
, orno
. *strict
policy doesn't allow servers in the same server group to be on the same host *yes
refers to best-effort policy and tries to put servers on different hosts, but this is not guaranteed *no
refers to having no policy and thus no effect on server host affinity To verify if the anti-affinity policies are met by requesting a server group details from API. For more information please see UpCloud API documentation on server groups. Plese also note that anti-affinity policies are only applied on server start. This means that if anti-affinity policies in server group are not met, you need to manually restart the servers in said group, for example via API, UpCloud Control Panel or upctl (UpCloud CLI) - labels Map<String>
- User defined key-value pairs to classify the server group.
- members List<String>
- UUIDs of the servers that are members of this group. Servers can also be attached to the server group via
server_group
property ofupcloud.Server
. See alsotrack_members
property. - track
Members Boolean - Controls if members of the server group are being tracked in this resource. Set to
false
when usingserver_group
property ofupcloud.Server
to attach servers to the server group to avoid delayed state updates.
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.
- 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 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,
anti_affinity_policy: Optional[str] = None,
labels: Optional[Mapping[str, str]] = None,
members: Optional[Sequence[str]] = None,
title: Optional[str] = None,
track_members: Optional[bool] = 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)
resources: _: type: upcloud:ServerGroup 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.
- Anti
Affinity stringPolicy - Defines if a server group is an anti-affinity group. Setting this to
strict
oryes
will result in all servers in the group being placed on separate compute hosts. The value can bestrict
,yes
, orno
. *strict
policy doesn't allow servers in the same server group to be on the same host *yes
refers to best-effort policy and tries to put servers on different hosts, but this is not guaranteed *no
refers to having no policy and thus no effect on server host affinity To verify if the anti-affinity policies are met by requesting a server group details from API. For more information please see UpCloud API documentation on server groups. Plese also note that anti-affinity policies are only applied on server start. This means that if anti-affinity policies in server group are not met, you need to manually restart the servers in said group, for example via API, UpCloud Control Panel or upctl (UpCloud CLI) - Labels Dictionary<string, string>
- User defined key-value pairs to classify the server group.
- Members List<string>
- UUIDs of the servers that are members of this group. Servers can also be attached to the server group via
server_group
property ofupcloud.Server
. See alsotrack_members
property. - Title string
- Title of your server group
- Track
Members bool - Controls if members of the server group are being tracked in this resource. Set to
false
when usingserver_group
property ofupcloud.Server
to attach servers to the server group to avoid delayed state updates.
- Anti
Affinity stringPolicy - Defines if a server group is an anti-affinity group. Setting this to
strict
oryes
will result in all servers in the group being placed on separate compute hosts. The value can bestrict
,yes
, orno
. *strict
policy doesn't allow servers in the same server group to be on the same host *yes
refers to best-effort policy and tries to put servers on different hosts, but this is not guaranteed *no
refers to having no policy and thus no effect on server host affinity To verify if the anti-affinity policies are met by requesting a server group details from API. For more information please see UpCloud API documentation on server groups. Plese also note that anti-affinity policies are only applied on server start. This means that if anti-affinity policies in server group are not met, you need to manually restart the servers in said group, for example via API, UpCloud Control Panel or upctl (UpCloud CLI) - Labels map[string]string
- User defined key-value pairs to classify the server group.
- Members []string
- UUIDs of the servers that are members of this group. Servers can also be attached to the server group via
server_group
property ofupcloud.Server
. See alsotrack_members
property. - Title string
- Title of your server group
- Track
Members bool - Controls if members of the server group are being tracked in this resource. Set to
false
when usingserver_group
property ofupcloud.Server
to attach servers to the server group to avoid delayed state updates.
- anti
Affinity StringPolicy - Defines if a server group is an anti-affinity group. Setting this to
strict
oryes
will result in all servers in the group being placed on separate compute hosts. The value can bestrict
,yes
, orno
. *strict
policy doesn't allow servers in the same server group to be on the same host *yes
refers to best-effort policy and tries to put servers on different hosts, but this is not guaranteed *no
refers to having no policy and thus no effect on server host affinity To verify if the anti-affinity policies are met by requesting a server group details from API. For more information please see UpCloud API documentation on server groups. Plese also note that anti-affinity policies are only applied on server start. This means that if anti-affinity policies in server group are not met, you need to manually restart the servers in said group, for example via API, UpCloud Control Panel or upctl (UpCloud CLI) - labels Map<String,String>
- User defined key-value pairs to classify the server group.
- members List<String>
- UUIDs of the servers that are members of this group. Servers can also be attached to the server group via
server_group
property ofupcloud.Server
. See alsotrack_members
property. - title String
- Title of your server group
- track
Members Boolean - Controls if members of the server group are being tracked in this resource. Set to
false
when usingserver_group
property ofupcloud.Server
to attach servers to the server group to avoid delayed state updates.
- anti
Affinity stringPolicy - Defines if a server group is an anti-affinity group. Setting this to
strict
oryes
will result in all servers in the group being placed on separate compute hosts. The value can bestrict
,yes
, orno
. *strict
policy doesn't allow servers in the same server group to be on the same host *yes
refers to best-effort policy and tries to put servers on different hosts, but this is not guaranteed *no
refers to having no policy and thus no effect on server host affinity To verify if the anti-affinity policies are met by requesting a server group details from API. For more information please see UpCloud API documentation on server groups. Plese also note that anti-affinity policies are only applied on server start. This means that if anti-affinity policies in server group are not met, you need to manually restart the servers in said group, for example via API, UpCloud Control Panel or upctl (UpCloud CLI) - labels {[key: string]: string}
- User defined key-value pairs to classify the server group.
- members string[]
- UUIDs of the servers that are members of this group. Servers can also be attached to the server group via
server_group
property ofupcloud.Server
. See alsotrack_members
property. - title string
- Title of your server group
- track
Members boolean - Controls if members of the server group are being tracked in this resource. Set to
false
when usingserver_group
property ofupcloud.Server
to attach servers to the server group to avoid delayed state updates.
- anti_
affinity_ strpolicy - Defines if a server group is an anti-affinity group. Setting this to
strict
oryes
will result in all servers in the group being placed on separate compute hosts. The value can bestrict
,yes
, orno
. *strict
policy doesn't allow servers in the same server group to be on the same host *yes
refers to best-effort policy and tries to put servers on different hosts, but this is not guaranteed *no
refers to having no policy and thus no effect on server host affinity To verify if the anti-affinity policies are met by requesting a server group details from API. For more information please see UpCloud API documentation on server groups. Plese also note that anti-affinity policies are only applied on server start. This means that if anti-affinity policies in server group are not met, you need to manually restart the servers in said group, for example via API, UpCloud Control Panel or upctl (UpCloud CLI) - labels Mapping[str, str]
- User defined key-value pairs to classify the server group.
- members Sequence[str]
- UUIDs of the servers that are members of this group. Servers can also be attached to the server group via
server_group
property ofupcloud.Server
. See alsotrack_members
property. - title str
- Title of your server group
- track_
members bool - Controls if members of the server group are being tracked in this resource. Set to
false
when usingserver_group
property ofupcloud.Server
to attach servers to the server group to avoid delayed state updates.
- anti
Affinity StringPolicy - Defines if a server group is an anti-affinity group. Setting this to
strict
oryes
will result in all servers in the group being placed on separate compute hosts. The value can bestrict
,yes
, orno
. *strict
policy doesn't allow servers in the same server group to be on the same host *yes
refers to best-effort policy and tries to put servers on different hosts, but this is not guaranteed *no
refers to having no policy and thus no effect on server host affinity To verify if the anti-affinity policies are met by requesting a server group details from API. For more information please see UpCloud API documentation on server groups. Plese also note that anti-affinity policies are only applied on server start. This means that if anti-affinity policies in server group are not met, you need to manually restart the servers in said group, for example via API, UpCloud Control Panel or upctl (UpCloud CLI) - labels Map<String>
- User defined key-value pairs to classify the server group.
- members List<String>
- UUIDs of the servers that are members of this group. Servers can also be attached to the server group via
server_group
property ofupcloud.Server
. See alsotrack_members
property. - title String
- Title of your server group
- track
Members Boolean - Controls if members of the server group are being tracked in this resource. Set to
false
when usingserver_group
property ofupcloud.Server
to attach servers to the server group to avoid delayed state updates.
Import
$ pulumi import upcloud:index/serverGroup:ServerGroup main ead4544f-10bf-42a3-b98a-a0fea2e2ad14
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- upcloud UpCloudLtd/pulumi-upcloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
upcloud
Terraform Provider.