Skip to content

Onboarding Intake(1/3): Intake Runner#1086

Open
devanshcache wants to merge 28 commits intostackitcloud:mainfrom
stackit-intake:onboard-intake
Open

Onboarding Intake(1/3): Intake Runner#1086
devanshcache wants to merge 28 commits intostackitcloud:mainfrom
stackit-intake:onboard-intake

Conversation

@devanshcache
Copy link
Copy Markdown

Description

This PR onboards the new STACKIT Intake (ticket) service into the Terraform provider.

Intake is composed of three components:

  • Intake Runners: dedicated, isolated runtime data ingestion environment
  • Intake: a specific data stream or topic within an Intake Runner
  • Intake Users: provides secure access credentials for your applications to connect to your Intake

This PR contains the Intake Runners part only to make a quicker and less overwhelming review.

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)

@devanshcache devanshcache requested a review from a team as a code owner December 8, 2025 08:08
@devanshcache devanshcache changed the title onboarding(1/3): Intake Runner Onboarding Intake(1/3): Intake Runner Dec 8, 2025
@rubenhoenle
Copy link
Copy Markdown
Member

@yago-123 could you please resolve the comments you adressed already? I will only start with another review as soon as all open comments are resolved.

@rubenhoenle
Copy link
Copy Markdown
Member

And please check that failing CI pipeline. Maybe run a make lint and a make test before your next update of this PR 😅

@yago-123
Copy link
Copy Markdown

@yago-123 could you please resolve the comments you adressed already? I will only start with another review as soon as all open comments are resolved.

Yes! notice this is still in progress though

@yago-123 yago-123 force-pushed the onboard-intake branch 3 times, most recently from 9d5b54d to 3922287 Compare January 27, 2026 14:54
@yago-123
Copy link
Copy Markdown

Hi @rubenhoenle👋 all the feedback must have been implemented.

Please notice that I reintroduced the WithRegion(region) during client initialization that you advised against in #1086 (comment). We discussed this internally and we concluded that it's a requirement that we can't change right now. There are some networking restrictions.

I would be very grateful if you could check on whether the region argument is handled correctly because I have some doubts about it.

In order to test the terraform provider binary we used:

terraform {
  required_providers {
    stackit = {
      source = "stackitcloud/stackit"
    }
  }
}

provider "stackit" {
  default_region = "eu01"
}

variable "project_id" {
  type = string
}

resource "stackit_intake_runner" "test_runner" {
  project_id            = var.project_id
  name                  = "test-runner-cli"
  region                = "eu01"
  max_message_size_kib  = 1024
  max_messages_per_hour = 1000
}

# Implicit Region (Uses provider default)
data "stackit_intake_runner" "implicit" {
  project_id = var.project_id
  runner_id  = stackit_intake_runner.test_runner.runner_id
}

data "stackit_intake_runner" "explicit" {
  project_id = var.project_id
  runner_id  = stackit_intake_runner.test_runner.runner_id
  region     = "eu01"
}


output "implicit_read_result" {
  value = "Successfully found runner '${data.stackit_intake_runner.implicit.name}'"
}

output "explicit_read_result" { 
  value = "Successfully found runner '${data.stackit_intake_runner.explicit.name}' in region '${data.stackit_intake_runner.explicit.region}'"
}

@rubenhoenle
Copy link
Copy Markdown
Member

I would be very grateful if you could check on whether the region argument is handled correctly because I have some doubts about it.

In fact this collides with

Please notice that I reintroduced the WithRegion(region) during client initialization that you advised against in #1086 (comment). We discussed this internally and we concluded that it's a requirement that we can't change right now. There are some networking restrictions.

Why can't it be changed? Feel free to answer via private chat, we don't have to discuss this here in public.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 4, 2026

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 Mar 4, 2026
@yago-123
Copy link
Copy Markdown

yago-123 commented Mar 5, 2026

Bot keep this open please

@github-actions github-actions bot removed the Stale PR is marked as stale due to inactivity. label Mar 6, 2026
@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 Mar 13, 2026
@rubenhoenle rubenhoenle removed the Stale PR is marked as stale due to inactivity. label Mar 13, 2026
@yago-123
Copy link
Copy Markdown

This should be ready for review whenever you have time.

Just pushed the new SDK with the hostname region-free.

CC @rubenhoenle

@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 Mar 27, 2026
@rubenhoenle rubenhoenle removed the Stale PR is marked as stale due to inactivity. label Mar 27, 2026
"description": schema.StringAttribute{
Description: descriptions["description"],
Optional: true,
Computed: true,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is this marked as computed? Shouldn't be needed from my perspective.

Description: descriptions["labels"],
ElementType: types.StringType,
Optional: true,
Computed: true,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same here

Copy link
Copy Markdown

@yago-123 yago-123 Mar 31, 2026

Choose a reason for hiding this comment

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

In this case, if I remove the Computed: true it retrieves the following error:

2026-03-31T17:01:18.527+0200 [ERROR] sdk.helper_resource: Unexpected error: test_name=TestAccIntakeRunnerMin test_terraform_path=/opt/homebrew/bin/terraform test_working_directory=/var/folders/4x/5xl9kvgx4d33r3xjbqd05mw80000gn/T/plugintest2512537327 test_step_number=1
  error=
  | Error running apply: exit status 1
  | 
  | Error: Provider produced inconsistent result after apply
  | 
  | When applying changes to stackit_intake_runner.example, provider
  | "provider[\"registry.terraform.io/hashicorp/stackit\"]" produced an
  | unexpected new value: .labels: was null, but now cty.MapValEmpty(cty.String).
  | 
  | This is a bug in the provider, which should be reported in the provider's own
  | issue tracker.
  
    resource_acc_test.go:62: Step 1/4 error: Error running apply: exit status 1
        
        Error: Provider produced inconsistent result after apply
        
        When applying changes to stackit_intake_runner.example, provider
        "provider[\"registry.terraform.io/hashicorp/stackit\"]" produced an
        unexpected new value: .labels: was null, but now cty.MapValEmpty(cty.String).
        
        This is a bug in the provider, which should be reported in the provider's own
        issue tracker.

To me this looks like we default to null, but the labels later are retrieved as {} making a difference after the apply (notice this only happens for min test).

An alternative to this would be to modify the mapFields to cover this case...


variable "project_id" {}
variable "name" {}
variable "region" {}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since region is optional, it shouldn't be part of the Min acc test. Only the required fields should be included here.

project_id = var.project_id
name = var.name
region = var.region
max_message_size_kib = 1024
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

use a variable here please

name = var.name
region = var.region
max_message_size_kib = 1024
max_messages_per_hour = 1000
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same here

name = var.name
region = var.region
description = "An example runner for Intake"
max_message_size_kib = 1024
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same here

region = var.region
description = "An example runner for Intake"
max_message_size_kib = 1024
max_messages_per_hour = 1100
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same here

if providerData.IntakeCustomEndpoint != "" {
apiClientConfigOptions = append(apiClientConfigOptions, config.WithEndpoint(providerData.IntakeCustomEndpoint))
} else {
apiClientConfigOptions = append(apiClientConfigOptions)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This line looks like a leftover to me?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

wdym? In the contribution guide is set this way no?

if providerData.FooCustomEndpoint != "" {

var testIntakeRunnerConfigVarsMin = config.Variables{
"project_id": config.StringVariable(testutil.ProjectId),
"name": config.StringVariable("intake-min-runner"),
"region": config.StringVariable(testutil.Region),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same here, region should not be part of the min test since it's optional

// Data source check: creates config that includes resource and data source
{
ConfigVariables: testIntakeRunnerConfigVarsMin,
Config: fmt.Sprintf(`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
Config: fmt.Sprintf(`
fmt.Sprintf(`
%s
%s
data "stackit_intake_runner" "example" {
project_id = %s.project_id
runner_id = %s.runner_id
region = %s.region
}`, testutil.IntakeProviderConfig(), resourceIntakeRunnerMin, intakeRunnerResource, intakeRunnerResource, intakeRunnerResource),

You're already using Sprintf, why use string concatenation here?

data "stackit_intake_runner" "example" {
project_id = %s.project_id
runner_id = %s.runner_id
}`, testutil.IntakeProviderConfig()+"\n"+resourceIntakeRunnerMax, intakeRunnerResource, intakeRunnerResource),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same here

intakeUtils "github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/intake/utils"
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"

"github.com/stackitcloud/stackit-sdk-go/services/intake"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
"github.com/stackitcloud/stackit-sdk-go/services/intake"
intake "github.com/stackitcloud/stackit-sdk-go/services/intake/v1betaapi"

Please use the new SDK structure so we don't introduce new tech-debt here: stackitcloud/stackit-sdk-go#5062

https://github.com/stackitcloud/stackit-sdk-go/blob/52b1898bf973372aa2906175c60cd3a69bf015d3/services/intake/CHANGELOG.md

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Applies to the whole implementation. Ping me via DM if you have any further questions 😅

return
}

utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]any{
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]any{
ctx = utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]any{

}
ctx = core.LogResponse(ctx)

// Wait for creation of intake runner
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please make sure to write the id fields to the state before starting the wait handler as instructed in our contribution guide:

// only in case the create bar API call is asynchronous (Make sure to include *ALL* fields which are part of the
// internal terraform resource id! And please include the comment below in your code):
// Write id attributes to state before polling via the wait handler - just in case anything goes wrong during the wait handler
ctx = utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]interface{}{
"project_id": projectId,
"region": region,
"bar_id": resp.BarId,
})
if resp.Diagnostics.HasError() {
return
}

}

// Update runner
runnerResp, err := r.client.UpdateIntakeRunner(ctx, projectId, region, runnerId).UpdateIntakeRunnerPayload(*payload).Execute()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

After update call please add

ctx = core.LogResponse(ctx)

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