feat: Onboard affinity groups resource and data source (#652)
* onboard affinity_groups resource and data source - add tests and descriptions - fix: server doesn't use affinity_group value for payload * Update descriptions
This commit is contained in:
parent
3642260cc4
commit
b5ce160d13
10 changed files with 846 additions and 0 deletions
35
docs/data-sources/affinity_group.md
Normal file
35
docs/data-sources/affinity_group.md
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "stackit_affinity_group Data Source - stackit"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
Affinity Group schema. Must have a region specified in the provider configuration.
|
||||
---
|
||||
|
||||
# stackit_affinity_group (Data Source)
|
||||
|
||||
Affinity Group schema. Must have a `region` specified in the provider configuration.
|
||||
|
||||
## Example Usage
|
||||
|
||||
```terraform
|
||||
data "stackit_affinity_group" "example" {
|
||||
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
||||
affinity_group_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
||||
}
|
||||
```
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `affinity_group_id` (String) The affinity group ID.
|
||||
- `project_id` (String) STACKIT Project ID to which the affinity group is associated.
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `id` (String) Terraform's internal resource identifier. It is structured as "`project_id`,`affinity_group_id`".
|
||||
- `members` (List of String) Affinity Group schema. Must have a `region` specified in the provider configuration.
|
||||
- `name` (String) The name of the affinity group.
|
||||
- `policy` (String) The policy of the affinity group.
|
||||
103
docs/resources/affinity_group.md
Normal file
103
docs/resources/affinity_group.md
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "stackit_affinity_group Resource - stackit"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
Affinity Group schema. Must have a region specified in the provider configuration.
|
||||
Usage with server
|
||||
```terraform
|
||||
resource "stackitaffinitygroup" "affinity-group" {
|
||||
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
||||
name = "example-key-pair"
|
||||
policy = "soft-affinity"
|
||||
}
|
||||
resource "stackitserver" "example-server" {
|
||||
projectid = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
||||
name = "example-server"
|
||||
bootvolume = {
|
||||
size = 64
|
||||
sourcetype = "image"
|
||||
sourceid = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
||||
}
|
||||
affinitygroup = stackitaffinitygroup.affinity-group.affinitygroupid
|
||||
availabilityzone = "eu01-1"
|
||||
machinetype = "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.
|
||||
~> This resource is in beta and may be subject to breaking changes in the future. Use with caution. See our guide https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/guides/opting_into_beta_resources for how to opt-in to use beta resources.
|
||||
---
|
||||
|
||||
# stackit_affinity_group (Resource)
|
||||
|
||||
Affinity Group schema. Must have a `region` specified in the provider configuration.
|
||||
|
||||
|
||||
|
||||
### Usage with server
|
||||
```terraform
|
||||
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.
|
||||
|
||||
|
||||
~> This resource is in beta and may be subject to breaking changes in the future. Use with caution. See our [guide](https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/guides/opting_into_beta_resources) for how to opt-in to use beta resources.
|
||||
|
||||
## Example Usage
|
||||
|
||||
```terraform
|
||||
resource "stackit_affinity_group" "example" {
|
||||
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
||||
name = "example-affinity-group-name"
|
||||
policy = "hard-anti-affinity"
|
||||
}
|
||||
```
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## 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.
|
||||
Loading…
Add table
Add a link
Reference in a new issue