Skip to content

STACKITRCO-186 - Add flag: iaas API param agent#1213

Open
aeter wants to merge 1 commit intostackitcloud:mainfrom
aeter:feature/STACKITRCO-186-add-agent-api-param
Open

STACKITRCO-186 - Add flag: iaas API param agent#1213
aeter wants to merge 1 commit intostackitcloud:mainfrom
aeter:feature/STACKITRCO-186-add-agent-api-param

Conversation

@aeter
Copy link
Copy Markdown

@aeter aeter commented Jan 8, 2026

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"

Description

relates to STACKITRCO-186

Checklist

  • Issue was linked above
  • Code format was applied: make fmt
  • Examples were added / adjusted (see e.g. here)
  • Docs are up-to-date: make generate-docs (will be checked by CI)
  • Unit tests got implemented or updated
  • Unit tests are passing: make test (will be checked by CI)
  • No linter issues: make lint (will be checked by CI)

@aeter aeter requested a review from a team as a code owner January 8, 2026 09:25
aeter pushed 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 <adrian.nackov@mail.schwarz>
aeter pushed 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 <adrian.nackov@mail.schwarz>
@github-actions
Copy link
Copy Markdown

This PR was marked as stale after 7 days of inactivity and will be closed after another 7 days of further inactivity. If this PR should be kept open, just add a comment, remove the stale label or push new commits to it.

Copy link
Copy Markdown
Contributor

@cgoetz-inovex cgoetz-inovex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution, looks good, but an additional test with agent-provisioned true would be nice.

Comment thread internal/cmd/server/create/create_test.go
Copy link
Copy Markdown
Contributor

@marceljk marceljk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks overall good! Can you extend the pretty output for the describe command? So that customers can easily check with the CLI if either the Agent is enabled or disabled

if server.KeypairName != nil {
table.AddRow("KEYPAIR", *server.KeypairName)
table.AddSeparator()
}
if server.MachineType != nil {
table.AddRow("MACHINE TYPE", *server.MachineType)
table.AddSeparator()
}
if server.Labels != nil && len(*server.Labels) > 0 {

Something like this should be fine

		if server.Agent != nil && server.Agent.Provisioned != nil {
			table.AddRow("AGENT", *server.Agent.Provisioned)
			table.AddSeparator()
		}

@aeter
Copy link
Copy Markdown
Author

aeter commented Jan 19, 2026

Thank you @marceljk! I've updated the PR as suggested.

  • I updated the utils pkg for the --output-format=yaml to work well with the describe command
  • currently: if the agent param is set to false, the describe output has is as false. If no param is set, the describe output has no notion of an agent param. If set to true, the output has it as true. Let me know if this is ok, or if further changes are needed
  • I pushed it as a second commit for easier review - if instead you want the commits squashed for easier merging, please let me know also
  • I tested the new code like below
[~/stackit-cli] make fmt
[~/stackit-cli] make generate-docs
>> Generating docs...
[~/stackit-cli] go test internal/cmd/server/describe/*
ok      command-line-arguments  0.006s
[~/stackit-cli] go test internal/cmd/server/create/*
ok      command-line-arguments  0.006s
[~/stackit-cli] go test internal/pkg/utils/*
ok      command-line-arguments  0.004s
[~/stackit-cli] make test
>> Running tests for the CLI application
...
[~/stackit-cli] ####################### Creating server with agent param provided, set to true
[~/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
Creating server
...
Server ID: 913cb6e2-8bef-4529-addd-4dd3fc7022b8

[~/stackit-cli] stackit --project-id c904f41c-2f8c-4edb-b966-e87d65f10b64 server describe 913cb6e2-8bef-4529-addd-4dd3fc7022b8 --output-format=json | grep agent --after=3
  "agent": {
    "provisioned": true
  },
[~/stackit-cli] stackit --project-id c904f41c-2f8c-4edb-b966-e87d65f10b64 server describe 913cb6e2-8bef-4529-addd-4dd3fc7022b8 --output-format=yaml | grep agent --after=3
agent:
  provisioned: true
[~/stackit-cli] stackit --project-id c904f41c-2f8c-4edb-b966-e87d65f10b64 server describe 913cb6e2-8bef-4529-addd-4dd3fc7022b8 | grep -i agent --after=3
 AGENT                 │ true
───────────────────────┼──────────────────────────────────────
 MACHINE TYPE          │ t1.1
───────────────────────┼───────

[~/stackit-cli] stackit -y --project-id c904f41c-2f8c-4edb-b966-e87d65f10b64 server delete 913cb6e2-8bef-4529-addd-4dd3fc7022b8
[~/stackit-cli] ########################### Creating server with no agent param provided  ##############################
[~/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
Creating server
...
Server ID: f4e6a92d-ff57-41ad-ab55-7d96f323d6f8
[~/stackit-cli] stackit --project-id c904f41c-2f8c-4edb-b966-e87d65f10b64 server describe f4e6a92d-ff57-41ad-ab55-7d96f323d6f8 --output-format=json | grep -i agent --after=3
[~/stackit-cli] stackit --project-id c904f41c-2f8c-4edb-b966-e87d65f10b64 server describe f4e6a92d-ff57-41ad-ab55-7d96f323d6f8 --output-format=yaml | grep -i agent --after=3
[~/stackit-cli] stackit --project-id c904f41c-2f8c-4edb-b966-e87d65f10b64 server describe f4e6a92d-ff57-41ad-ab55-7d96f323d6f8 | grep -i agent --after=3
[~/stackit-cli]
[~/stackit-cli] stackit -y --project-id c904f41c-2f8c-4edb-b966-e87d65f10b64 server delete f4e6a92d-ff57-41ad-ab55-7d96f323d6f8
[~/stackit-cli] ############################ Creating server with agent param provided, set to false ######################
[~/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=false
Creating server
...
Server ID: 42a7ad4e-355e-45e5-8071-dcf3a0591b55
[~/stackit-cli] stackit --project-id c904f41c-2f8c-4edb-b966-e87d65f10b64 server describe 42a7ad4e-355e-45e5-8071-dcf3a0591b55 --output-format=json | grep -i agent --after=3
  "agent": {
    "provisioned": false
  },
  "availabilityZone": "eu01-m",
[~/stackit-cli] stackit --project-id c904f41c-2f8c-4edb-b966-e87d65f10b64 server describe 42a7ad4e-355e-45e5-8071-dcf3a0591b55 --output-format=yaml | grep -i agent --after=3
agent:
  provisioned: false
[~/stackit-cli] stackit --project-id c904f41c-2f8c-4edb-b966-e87d65f10b64 server describe 42a7ad4e-355e-45e5-8071-dcf3a0591b55 | grep -i agent --after=3
 AGENT                 │ false
───────────────────────┼──────────────────────────────────────
 MACHINE TYPE          │ t1.1
───────────────────────┼──────────────────────────────────────

Comment thread internal/cmd/server/create/create.go Outdated
@cgoetz-inovex
Copy link
Copy Markdown
Contributor

Please also adjust the output of server list to include the agent param:

func outputResult(p *print.Printer, outputFormat string, servers []iaas.Server) error {

aeter pushed a commit to aeter/terraform-provider-stackit that referenced this pull request Jan 21, 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 <adrian.nackov@mail.schwarz>
@aeter
Copy link
Copy Markdown
Author

aeter commented Jan 21, 2026

@cgoetz-inovex - Thanks for the reviews! I've added the agent to the server list as well, as requested, and retested. I have not made the other requested change yet (default to explicit false), waiting for the results of a discussion for it.

Tested adding agent to the server list like below:

[~/stackit-cli] go test internal/cmd/server/list/*
ok      command-line-arguments  0.004s
[~/stackit-cli] ################### `server list` with --agent-provisioned=false ####################
[~/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=false
Creating server |
...
Server ID: 2792fa1b-5697-4515-8d4d-439f3d5ecbd6

[~/stackit-cli] stackit --project-id c904f41c-2f8c-4edb-b966-e87d65f10b64 -o yaml server list | grep agent --after 1
    agent:
      provisioned: false
[~/stackit-cli] stackit --project-id c904f41c-2f8c-4edb-b966-e87d65f10b64 server list | grep -i agent --after 4
 ID                                   │ NAME           │ STATUS │ MACHINE TYPE │ AVAILABILITY ZONES │ NIC IPV4  │ PUBLIC IPS │ AGENT
──────────────────────────────────────┼────────────────┼────────┼──────────────┼────────────────────┼───────────┼────────────┼───────
 2792fa1b-5697-4515-8d4d-439f3d5ecbd6 │ server1        │ ACTIVE │ t1.1         │ eu01-m             │ 10.1.0.67 │            │ false

[~/stackit-cli] stackit --project-id c904f41c-2f8c-4edb-b966-e87d65f10b64 -o json server list | grep -i
agent --after 2
    "agent": {
      "provisioned": false
    },
[~/stackit-cli] ################### `server list` without --agent-provisioned flag ####################
[~/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
Creating server |
...
Server ID: 3e873c85-c41c-405d-b6ab-ccc14f897fab
[~/stackit-cli] stackit --project-id c904f41c-2f8c-4edb-b966-e87d65f10b64 -o json server list | grep -i agent --after 2
[~/stackit-cli] stackit --project-id c904f41c-2f8c-4edb-b966-e87d65f10b64 -o yaml server list | grep -i agent --after 2
[~/stackit-cli] stackit --project-id c904f41c-2f8c-4edb-b966-e87d65f10b64 server list | grep -i agent --
after 2
 ID                                   │ NAME           │ STATUS │ MACHINE TYPE │ AVAILABILITY ZONES │ NIC IPV4   │ PUBLIC IPS │ AGENT
──────────────────────────────────────┼────────────────┼────────┼──────────────┼────────────────────┼────────────┼────────────┼───────
 3e873c85-c41c-405d-b6ab-ccc14f897fab │ server1        │ ACTIVE │ t1.1         │ eu01-m             │ 10.1.0.162 │            │
[~/stackit-cli]

@github-actions
Copy link
Copy Markdown

This PR was marked as stale after 7 days of inactivity and will be closed after another 7 days of further inactivity. If this PR should be kept open, just add a comment, remove the stale label or push new commits to it.

@github-actions github-actions Bot added the Stale label Jan 29, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 5, 2026

This PR was closed automatically because it has been stalled for 7 days with no activity. Feel free to re-open it at any time.

@github-actions github-actions Bot closed this Feb 5, 2026
@cgoetz-inovex cgoetz-inovex reopened this Feb 5, 2026
@rubenhoenle rubenhoenle marked this pull request as draft April 14, 2026 08:40
@aeter aeter force-pushed the feature/STACKITRCO-186-add-agent-api-param branch from d46fc9c to e5c2935 Compare April 17, 2026 07:17
aeter pushed a commit to aeter/terraform-provider-stackit that referenced this pull request Apr 20, 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

review url: stackitcloud#1113

---

Tests:
* ran `make fmt`, `make generate-docs`, `make lint`

* 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, by adding, changing, deleting `agent`-related parts of a tf config.

Signed-off-by: Adrian Nackov <adrian.nackov@digits.schwarz>
@aeter
Copy link
Copy Markdown
Author

aeter commented Apr 20, 2026

please review.

I've rebased the code and retested. At the related stackit-terraform-provider PR, I added a provisioning_policy field as requested. For the CLI code, I don't see what I can add, other than rebasing.

@aeter aeter marked this pull request as ready for review April 20, 2026 05:34
aeter pushed a commit to aeter/terraform-provider-stackit that referenced this pull request Apr 20, 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

review url: stackitcloud#1113

---

Tests:
* ran `make fmt`, `make generate-docs`, `make lint`

* 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, by adding, changing, deleting `agent`-related parts of a tf config.

Signed-off-by: Adrian Nackov <adrian.nackov@digits.schwarz>
aeter pushed a commit to aeter/terraform-provider-stackit that referenced this pull request Apr 20, 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

review url: stackitcloud#1113

---

Tests:
* ran `make fmt`, `make generate-docs`, `make lint`

* 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, by adding, changing, deleting `agent`-related parts of a tf config.

Signed-off-by: Adrian Nackov <adrian.nackov@digits.schwarz>
@aeter aeter requested review from cgoetz-inovex and marceljk April 24, 2026 14:36
Copy link
Copy Markdown
Member

@rubenhoenle rubenhoenle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get why this is marked as ready for review.

We wrote an ADR because we have the problem that a boolean field (which can represent two values) is used to represent three values by using the nil value for the third state.

The ADR said

The field will have the following possible values:

  • ALWAYS - attempt to install the agent, regardless of the server image configuration
  • NEVER - do not install the agent, regardless of the server image configuration
  • INHERIT - use the default behaviour defined in the server image configuration
    The provisioning_policy field will have a default value of INHERIT.

and later

This solution should also be applied to the CLI. The reason is that there's no user-friendly way to have a boolean flag that doesn't have a fixed default value.

I don't see this implemented here. Instead you're using a boolean flag which only represents two values (true / false).

The problem here is that the following commands have different outcomes:

  1. stackit server create ... --agent-provisioned=true - This command will provision an agent on the server.
  2. stackit server create ... --agent-provisioned=false - This command won't provision an agent on the server.
  3. stackit server create ... (note the missing agent-provisioned flag) - This command will provision an agent on the server based on the agent provisioning setting of the used image (inherit).

The problem here is the third command because our users will expect a boolean flag to behave like every other boolean flag in our STACKIT CLI. In most of our implementations the second and the third command would have the same effect.

Apart from the fact that the implementation is not done as decided in your own ADR the docs are also really helpful for our users.

TLDR: Please rework this PR to match the decision from your ADR.

@aeter aeter force-pushed the feature/STACKITRCO-186-add-agent-api-param branch 2 times, most recently from ca49803 to 00f5f0e Compare April 29, 2026 07:21
@aeter
Copy link
Copy Markdown
Author

aeter commented Apr 29, 2026

Added --agent-provisioning-policy flag as needed. For the server describe / server list, the agent value for provisioned is shown.
Retested locally with all values (INHERIT, ALWAYS, NEVER), tested omitting the flag, tested non-enumerated strings.
Reran the formatter, linter, unit tests, docs generator.
Here's how it looks at the command line

[~/stackit-cli] stackit -y --project-id c904f41c-2f8c-4edb-b966-e87d65f10b64 server list

 ID                                   │ NAME    │ STATUS │ MACHINE TYPE │ AVAILABILITY ZONES │ NIC IPV4   │ PUBLIC IPS │ AGENT
──────────────────────────────────────┼─────────┼────────┼──────────────┼────────────────────┼────────────┼────────────┼───────
 ef9d2722-1a19-456b-8a55-7211a6fb7418 │ server1 │ ACTIVE │ t1.1         │ eu01-m             │ 10.1.0.243 │            │
 81d2844a-2416-4be9-802b-c5c02fdbe2e2 │ server1 │ ACTIVE │ t1.1         │ eu01-m             │ 10.1.0.109 │            │ true
 abd47047-d834-4cb5-924e-f038113ca0aa │ server1 │ ACTIVE │ t1.1         │ eu01-m             │ 10.1.0.158 │            │ false

[~/stackit-cli] stackit -o yaml -y --project-id c904f41c-2f8c-4edb-b966-e87d65f10b64 server list | grep agent --after 2
    agent:
      provisioned: true
  - id: abd47047-d834-4cb5-924e-f038113ca0aa
--
    agent:
      provisioned: false
  - id: ef9d2722-1a19-456b-8a55-7211a6fb7418

[~/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-provisioning-policy=SOMETHING
Error: invalid argument "SOMETHING" for "--agent-provisioning-policy" flag: expected one of ["ALWAYS" "NEVER" "INHERIT"]

[~/stackit-cli] stackit server create --help | grep policy
  $ stackit server create --machine-type t1.1 --name server1 --boot-volume-source-id xxx --boot-volume-source-type image --boot-volume-size 64 --network-id yyy --agent-provisioning-policy=ALWAYS
      --agent-provisioning-policy string       Whether to provision an agent on server creation, one of ["ALWAYS" "NEVER" "INHERIT"] (default "INHERIT")

@aeter aeter requested a review from rubenhoenle April 29, 2026 07:26
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 stackit-cli with and without specifying the new flag, all seemed OK.

Signed-off-by: Adrian Nackov <adrian.nackov@digits.schwarz>
@aeter aeter force-pushed the feature/STACKITRCO-186-add-agent-api-param branch from 00f5f0e to dcde934 Compare April 29, 2026 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants