* chore(examples): Add import examples for all resources Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de> * Add guide: How to import resources Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de> --------- Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de>
3.6 KiB
3.6 KiB
| page_title | subcategory | description |
|---|---|---|
| stackit_affinity_group Resource - stackit | Affinity Group schema. Must have a region specified in the provider configuration. Usage with server resource "stackit_affinity_group" "affinity-group" { project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" name = "example-key-pair" policy = "soft-affinity" } resource "stackit_server" "example-server" { project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" name = "example-server" boot_volume = { size = 64 source_type = "image" source_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" } affinity_group = stackit_affinity_group.affinity-group.affinity_group_id availability_zone = "eu01-1" machine_type = "g1.1" } Policies hard-affinity- All servers launched in this group will be hosted on the same compute node. hard-anti-affinity- All servers launched in this group will be hosted on different compute nodes. soft-affinity- All 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. soft-anti-affinity- All 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. |
stackit_affinity_group (Resource)
Affinity Group schema. Must have a region specified in the provider configuration.
Usage with server
resource "stackit_affinity_group" "affinity-group" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-key-pair"
policy = "soft-affinity"
}
resource "stackit_server" "example-server" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-server"
boot_volume = {
size = 64
source_type = "image"
source_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
affinity_group = stackit_affinity_group.affinity-group.affinity_group_id
availability_zone = "eu01-1"
machine_type = "g1.1"
}
Policies
-
hard-affinity- All servers launched in this group will be hosted on the same compute node. -
hard-anti-affinity- All servers launched in this group will be hosted on different compute nodes. -
soft-affinity- All 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. -
soft-anti-affinity- All 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.
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.affinity_group_id}"
}
Schema
Required
name(String) The name of the affinity group.policy(String) The policy of the affinity group.project_id(String) STACKIT Project ID to which the affinity group is associated.
Read-Only
affinity_group_id(String) The affinity group ID.id(String) Terraform's internal resource identifier. It is structured as "project_id,affinity_group_id".members(List of String) The servers that are part of the affinity group.