-
Notifications
You must be signed in to change notification settings - Fork 31
STACKITRCO-186 - Add flag: iaas API param agent #1213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
aeter
wants to merge
1
commit into
stackitcloud:main
Choose a base branch
from
aeter:feature/STACKITRCO-186-add-agent-api-param
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
STACKITRCO-186 - Add flag: iaas API param agent #1213
aeter
wants to merge
1
commit into
stackitcloud:main
from
aeter:feature/STACKITRCO-186-add-agent-api-param
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Adds a cli flag for the iaas ( _create server_ ) API param:
`"agent": {"provisioned": true}`
ref STACKITRCO-186
---
Tests:
* ran `make fmt`, `make generate-docs`
* unit tests
```
[~/stackit-cli] go test internal/cmd/server/create/*
ok command-line-arguments 0.006s
[~/stackit-cli]
[~/stackit-cli] make test
>> Running tests for the CLI application
...
ok github.com/stackitcloud/stackit-cli/internal/cmd/server/create 0.006s coverage: 69.7% of statements
...
```
* ran without specifying the new flag (default is agent-provisioned=false) - no change, same behavior as before
```
[~/stackit-cli] stackit -y --project-id c904f41c-2f8c-4edb-b966-e87d65f10b64 server create --name server1 --machine-type t1.1 --network-id 97c5dde4-cb9d-49b8-be55-9cdf0c3795e1 --boot-volume-source-type image --boot-volume-source-id 21466190-b904-4267-8bf3-1be4323f4ffb --boot-volume-size 20 --boot-volume-delete-on-termination=true
...
Server ID: 71785201-d749-4449-99b2-6dc23f406133
[~/stackit-cli] stackit -y server command create --server-id=71785201-d749-4449-99b2-6dc23f406133 --project-id=c904f41c-2f8c-4edb-b966-e87d65f10b64 --template-name=RunShellScript --params script='echo hello'
Error: create Server Command: 404 Not Found, status code 404, Body: {"status":"Not Found","message":"agent not found"}
[~/stackit-cli] stackit -y --project-id c904f41c-2f8c-4edb-b966-e87d65f10b64 server delete 71785201-d749-4449-99b2-6dc23f406133
Deleting server ✓
Deleted server "server1"
```
* ran with specifying flag agent-provisioned=true - the server was created with a provisioned agent, it was possible to set commands
```
[~/stackit-cli] stackit -y --project-id c904f41c-2f8c-4edb-b966-e87d65f10b64 server create --name server1 --machine-type t1.1 --network-id 97c5dde4-cb9d-49b8-be55-9cdf0c3795e1 --boot-volume-source-type image --boot-volume-source-id 21466190-b904-4267-8bf3-1be4323f4ffb --boot-volume-size 20 --boot-volume-delete-on-termination=true --agent-provisioned=true
...
Server ID: ed3086ff-a1ef-44ec-b2f7-08775611dc4e
[~/stackit-cli] stackit -y server command create --server-id=ed3086ff-a1ef-44ec-b2f7-08775611dc4e --project-id=c904f41c-2f8c-4edb-b966-e87d65f10b64 --template-name=RunShellScript --params script='echo hello'
Created server command for server server1. Command ID: 263667
[~/stackit-cli] stackit -y --project-id c904f41c-2f8c-4edb-b966-e87d65f10b64 server delete ed3086ff-a1ef-44ec-b2f7-08775611dc4e
Deleting server ✓
Deleted server "server1"
```
Signed-off-by: Adrian Nackov <[email protected]>
8 tasks
aeter
added a commit
to aeter/terraform-provider-stackit
that referenced
this pull request
Jan 8, 2026
Adds a terraform `stackit_server` option for the iaas ( _create server_ ) API param:
`"agent": {"provisioned": true}`
ref STACKITRCO-187
ref: stackitcloud/stackit-cli#1213
---
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]>
aeter
added a commit
to aeter/terraform-provider-stackit
that referenced
this pull request
Jan 9, 2026
Adds a terraform `stackit_server` option for the iaas ( _create server_ ) API param:
`"agent": {"provisioned": true}`
ref STACKITRCO-187
ref: stackitcloud/stackit-cli#1213
---
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]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a cli flag for the iaas ( create server ) API param:
"agent": {"provisioned": true}ref STACKITRCO-186
Tests:
ran
make fmt,make generate-docsunit tests
Description
relates to STACKITRCO-186
Checklist
make fmtmake generate-docs(will be checked by CI)make test(will be checked by CI)make lint(will be checked by CI)