@@ -11,6 +11,16 @@ locals {
11
11
operator_replica = length (var. servers ) > 1 ? 2 : 1
12
12
}
13
13
14
+ resource "openstack_compute_servergroup_v2" "servers" {
15
+ name = " ${ var . name } -servers"
16
+ policies = [" anti-affinity" ]
17
+ }
18
+
19
+ resource "openstack_compute_servergroup_v2" "agents" {
20
+ name = " ${ var . name } -servers"
21
+ policies = [" soft-anti-affinity" ]
22
+ }
23
+
14
24
module "servers" {
15
25
source = " ./node"
16
26
@@ -33,7 +43,7 @@ module "servers" {
33
43
boot_volume_type = each. value . boot_volume_type
34
44
35
45
availability_zones = coalesce (each. value . availability_zones , [])
36
- affinity = coalesce ( each. value . affinity , " soft-anti-affinity " )
46
+ group_id = each. value . group_id != null ? each . value . group_id : openstack_compute_servergroup_v2 . servers . id
37
47
38
48
rke2_version = each. value . rke2_version
39
49
rke2_config = each. value . rke2_config
@@ -144,7 +154,7 @@ module "agents" {
144
154
boot_volume_type = each. value . boot_volume_type
145
155
146
156
availability_zones = coalesce (each. value . availability_zones , [])
147
- affinity = coalesce ( each. value . affinity , " soft-anti-affinity " )
157
+ group_id = each. value . group_id != null ? each . value . group_id : openstack_compute_servergroup_v2 . agents . id
148
158
149
159
rke2_version = each. value . rke2_version
150
160
rke2_config = each. value . rke2_config
0 commit comments