Commit 3a093e8
committed
STACKITRCO-187 - Add option iaas API param agent
Adds a terraform `stackit_server` option for the iaas ( _create server_ ) API param:
`"agent": {"provisioned": true}`
ref STACKITRCO-187
ref: stackitcloud/stackit-cli#121
---
Tests:
* ran `make fmt`, `make generate-docs`
* ran unit tests
```
[~/terraform-provider-stackit] go test stackit/internal/services/iaas/server/*
ok command-line-arguments 15.005s
[~/terraform-provider-stackit] make test
...
ok github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/iaas/server 15.006s coverage: 33.0% of statements
...
[~/terraform-provider-stackit]
```
* Tested: with a locally-configured terraform - tested by adding, changing, deleting `agent`-related parts of the below main.tf
** Tested without providing agent inside main.tf (the result had `"agent" = null /* object */`)
** Tested with setting `agent = { provisioning = true }` (and then ran the `stackit-cli` command for checking if the agent was created successfully and able to run commands, `stackit -y server command create --server-id=3fdac6ea-3885-441c-b473-bc94ca570ca8 --project-id=c904f41c-2f8c-4edb-b966-e87d65f10b64 --template-name=RunShellScript --params script='echo hello'`).
** Tested when setting `agent = { provisioning = true }` and then set it to false - verified the server was deleted and recreated again with the new value.
```
[~] cat main.tf
provider "stackit" {
# Configuration options
service_account_key_path = "/home/debian/terraform_dev/.terraform_key.json"
default_region = "eu01"
}
resource "stackit_network_interface" "server_nic" {
project_id = "c904f41c-2f8c-4edb-b966-e87d65f10b64"
network_id = "97c5dde4-cb9d-49b8-be55-9cdf0c3795e1"
}
resource "stackit_server" "myserver1" {
project_id = "c904f41c-2f8c-4edb-b966-e87d65f10b64"
name = "terraformtestserver1"
boot_volume = {
size = 64
source_type = "image"
source_id = "21466190-b904-4267-8bf3-1be4323f4ffb"
delete_on_termination = true
}
availability_zone = "eu01-1"
agent = {
provisioned = true
}
machine_type = "t1.1"
network_interfaces = [ stackit_network_interface.server_nic.network_interface_id ]
}
data "stackit_server" "myserver1_data" {
project_id = "c904f41c-2f8c-4edb-b966-e87d65f10b64"
server_id = stackit_server.myserver1.server_id
}
output "server_info_from_data" {
value = data.stackit_server.myserver1_data
}
```
```
[~] terraform apply -auto-approve ## this is without `agent` set in the config
...
server_info_from_data = {
"affinity_group" = tostring(null)
"agent" = null /* object */
"availability_zone" = "eu01-1"
...
}
...
```
```
[~] terraform apply -auto-approve ## this is with `agent = { provisioned = true }` set in the config
...
server_info_from_data = {
"affinity_group" = tostring(null)
"agent" = {
"provisioned" = true
}
"availability_zone" = "eu01-1"
"boot_volume" = {
"delete_on_termination" = true
"id" = "673021e5-2a90-4482-8ffa-e0485c7588bd"
}
...
}
```
Signed-off-by: Adrian Nackov <[email protected]>1 parent 74ed4bd commit 3a093e8
File tree
6 files changed
+250
-118
lines changed- docs
- data-sources
- resources
- stackit/internal/services/iaas/server
6 files changed
+250
-118
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
51 | 60 | | |
52 | 61 | | |
53 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
| 9 | + | |
| 10 | + | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
18 | 17 | | |
19 | | - | |
20 | | - | |
| 18 | + | |
| 19 | + | |
21 | 20 | | |
22 | 21 | | |
23 | | - | |
24 | | - | |
25 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
26 | 25 | | |
27 | | - | |
28 | | - | |
| 26 | + | |
29 | 27 | | |
30 | | - | |
31 | | - | |
32 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
33 | 31 | | |
34 | | - | |
| 32 | + | |
35 | 33 | | |
36 | | - | |
37 | | - | |
| 34 | + | |
| 35 | + | |
38 | 36 | | |
39 | | - | |
40 | | - | |
41 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
42 | 40 | | |
43 | | - | |
44 | | - | |
| 41 | + | |
45 | 42 | | |
46 | | - | |
47 | | - | |
48 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
49 | 46 | | |
50 | 47 | | |
51 | 48 | | |
| |||
54 | 51 | | |
55 | 52 | | |
56 | 53 | | |
57 | | - | |
58 | | - | |
59 | | - | |
| 54 | + | |
| 55 | + | |
60 | 56 | | |
61 | | - | |
62 | | - | |
63 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
64 | 60 | | |
65 | | - | |
66 | | - | |
67 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
68 | 64 | | |
69 | | - | |
70 | | - | |
| 65 | + | |
71 | 66 | | |
72 | | - | |
73 | | - | |
74 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
75 | 70 | | |
76 | 71 | | |
77 | | - | |
| 72 | + | |
78 | 73 | | |
79 | | - | |
80 | | - | |
| 74 | + | |
81 | 75 | | |
82 | 76 | | |
83 | 77 | | |
84 | 78 | | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
89 | 82 | | |
90 | 83 | | |
91 | 84 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
97 | 89 | | |
98 | | - | |
99 | | - | |
100 | | - | |
| 90 | + | |
| 91 | + | |
101 | 92 | | |
102 | | - | |
| 93 | + | |
103 | 94 | | |
104 | | - | |
105 | | - | |
| 95 | + | |
| 96 | + | |
106 | 97 | | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
112 | 103 | | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
117 | 107 | | |
118 | | - | |
119 | | - | |
| 108 | + | |
120 | 109 | | |
121 | | - | |
122 | | - | |
123 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
124 | 113 | | |
125 | | - | |
| 114 | + | |
126 | 115 | | |
127 | | - | |
| 116 | + | |
128 | 117 | | |
129 | | - | |
130 | | - | |
131 | | - | |
| 118 | + | |
| 119 | + | |
132 | 120 | | |
133 | | - | |
| 121 | + | |
134 | 122 | | |
135 | | - | |
136 | | - | |
| 123 | + | |
| 124 | + | |
137 | 125 | | |
138 | | - | |
139 | | - | |
140 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
141 | 129 | | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
147 | 134 | | |
148 | | - | |
149 | | - | |
| 135 | + | |
150 | 136 | | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
155 | 141 | | |
156 | | - | |
157 | | - | |
| 142 | + | |
| 143 | + | |
158 | 144 | | |
159 | 145 | | |
160 | | - | |
161 | | - | |
162 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
163 | 149 | | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
168 | 153 | | |
169 | | - | |
170 | | - | |
| 154 | + | |
| 155 | + | |
171 | 156 | | |
172 | 157 | | |
173 | | - | |
174 | | - | |
175 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
176 | 161 | | |
| 162 | + | |
177 | 163 | | |
178 | 164 | | |
179 | 165 | | |
| |||
404 | 390 | | |
405 | 391 | | |
406 | 392 | | |
| 393 | + | |
407 | 394 | | |
408 | 395 | | |
409 | 396 | | |
| |||
422 | 409 | | |
423 | 410 | | |
424 | 411 | | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
425 | 420 | | |
426 | 421 | | |
427 | 422 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
55 | 60 | | |
56 | 61 | | |
57 | 62 | | |
| |||
123 | 128 | | |
124 | 129 | | |
125 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
126 | 141 | | |
127 | 142 | | |
128 | 143 | | |
| |||
304 | 319 | | |
305 | 320 | | |
306 | 321 | | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
307 | 334 | | |
308 | 335 | | |
309 | 336 | | |
| |||
0 commit comments