Skip to content

STACKITRCO-187 - Add option iaas API param agent#1113

Open
aeter wants to merge 1 commit intostackitcloud:mainfrom
aeter:feature/STACKITRCO-187-iaas-create-server-agent-param
Open

STACKITRCO-187 - Add option iaas API param agent#1113
aeter wants to merge 1 commit intostackitcloud:mainfrom
aeter:feature/STACKITRCO-187-iaas-create-server-agent-param

Conversation

@aeter
Copy link
Copy Markdown

@aeter aeter commented 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, 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.

Description

relates to STACKITRCO-187

Checklist

  • Issue was linked above
  • Code format was applied: make fmt
  • Examples were added / adjusted (see examples/ directory)
  • Docs are up-to-date: make generate-docs (will be checked by CI)
  • Unit tests got implemented or updated
  • Acceptance tests got implemented or updated (see e.g. here)
  • 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 17:58
@aeter aeter force-pushed the feature/STACKITRCO-187-iaas-create-server-agent-param branch 2 times, most recently from 44c1522 to 699af50 Compare January 9, 2026 07:06
@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 PR is marked as stale due to inactivity. label Jan 16, 2026
@marceljk marceljk added has internal tracking issue ignore-stale and removed Stale PR is marked as stale due to inactivity. labels Jan 16, 2026
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.

lgtm besides the docs

Comment thread docs/resources/server.md Outdated
Comment thread stackit/internal/services/iaas/server/datasource.go
Comment thread stackit/internal/services/iaas/server/datasource.go
@aeter aeter force-pushed the feature/STACKITRCO-187-iaas-create-server-agent-param branch from d208dba to 91a621b Compare January 21, 2026 11:51
@rubenhoenle rubenhoenle marked this pull request as draft April 14, 2026 08:40
@aeter aeter force-pushed the feature/STACKITRCO-187-iaas-create-server-agent-param branch from 91a621b to 7c34d59 Compare April 20, 2026 05:23
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 updated the code as requested - added provisioning_policy. Retested. I ran the acc tests, they failed with unrelated to my code failures.


acceptance tests

[~/terraform-provider-stackit] TF_ACC=1 TF_ACC_PROJECT_ID=c904f41c-2f8c-4edb-b966-e87d65f10b64 STACKIT_SERVICE_ACCOUNT_KEY_PATH=~/terraform_dev/.terraform_key.json TF_ACC_REGION=eu01 go test -timeout=60m -v ./stackit/internal/services/iaas/... -run "TestAccServer(Min|Max)"

A server created without sending 'provisioning' flag via the CLI - and then imported into terraform:

[~/terraform_dev] STACKIT_TF_ENABLE_BETA_RESOURCES=true TF_LOG_PROVIDER=DEBUG terraform import stackit_server.imported_server c904f41c-2f8c-4edb-b966-e87d65f10b64,eu01,7359173a-b476-4c3c-9cd4-35c7984114e2
[~/terraform_dev] terraform show
Outputs:

imported_server = {
   agent             = {
       provisioning_policy = "INHERIT"
   }
   id                = "c904f41c-2f8c-4edb-b966-e87d65f10b64,eu01,7359173a-b476-4c3c-9cd4-35c7984114e2"
}

A server created in terraform with defaults (no 'agent' block):

server_info_from_data = {
 "agent" = {
   "provisioned" = tobool(null)
   "provisioning_policy" = "INHERIT"
 }
 "id" = "c904f41c-2f8c-4edb-b966-e87d65f10b64,eu01,b4e69af2-a8a6-407b-81e5-b32df3041719"

A server created in terraform like this. Note the ALWAYS->INHERIT in datasource, which can/should be fixed when the API is fixed one day:

//------------ main.tf
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 = "nackovterraform1"
   boot_volume = {
       size = 64
       source_type = "image"
       source_id = "21466190-b904-4267-8bf3-1be4323f4ffb"
       delete_on_termination = true
   }
   availability_zone = "eu01-1"
   agent = {
       provisioning_policy = "ALWAYS"
   }
   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
}

output "server_info_from_resource" {
  value = stackit_server.myserver1.agent
}
//------------

####### output from make apply
server_info_from_data = {
 "affinity_group" = tostring(null)
 "agent" = {
   "provisioned" = true
   "provisioning_policy" = "INHERIT"
 }
}
server_info_from_resource = {
  "provisioned" = true
  "provisioning_policy" = "ALWAYS"
}

@aeter aeter marked this pull request as ready for review April 20, 2026 05:35
Comment thread stackit/internal/services/iaas/server/datasource.go Outdated
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 force-pushed the feature/STACKITRCO-187-iaas-create-server-agent-param branch from 7c34d59 to 8942b1e Compare April 20, 2026 10:04
Comment thread stackit/internal/services/iaas/server/resource_test.go Outdated
Comment thread stackit/internal/services/iaas/server/resource_test.go Outdated
Comment thread stackit/internal/services/iaas/server/resource_test.go Outdated
Comment thread stackit/internal/services/iaas/server/datasource.go Outdated
Comment thread stackit/internal/services/iaas/server/resource.go Outdated
Comment thread stackit/internal/services/iaas/server/resource.go Outdated
Comment thread stackit/internal/services/iaas/iaas_acc_test.go Outdated
Comment thread stackit/internal/services/iaas/testdata/resource-server-max.tf Outdated
Comment thread stackit/internal/services/iaas/iaas_acc_test.go Outdated
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 force-pushed the feature/STACKITRCO-187-iaas-create-server-agent-param branch from 8942b1e to be8d15a Compare April 20, 2026 17:33
@aeter
Copy link
Copy Markdown
Author

aeter commented Apr 20, 2026

updated per review

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