Onboarding Intake(1/3): Intake Runner#1086
Onboarding Intake(1/3): Intake Runner#1086devanshcache wants to merge 28 commits intostackitcloud:mainfrom
Conversation
89b2fc8 to
540b360
Compare
|
@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. |
|
And please check that failing CI pipeline. Maybe run a |
Yes! notice this is still in progress though |
9d5b54d to
3922287
Compare
|
Hi @rubenhoenle👋 all the feedback must have been implemented. Please notice that I reintroduced the I would be very grateful if you could check on whether the In order to test the terraform provider binary we used: |
In fact this collides with
Why can't it be changed? Feel free to answer via private chat, we don't have to discuss this here in public. |
|
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. |
|
Bot keep this open please |
|
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. |
|
This should be ready for review whenever you have time. Just pushed the new SDK with the hostname region-free. CC @rubenhoenle |
|
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. |
| "description": schema.StringAttribute{ | ||
| Description: descriptions["description"], | ||
| Optional: true, | ||
| Computed: true, |
There was a problem hiding this comment.
Why is this marked as computed? Shouldn't be needed from my perspective.
| Description: descriptions["labels"], | ||
| ElementType: types.StringType, | ||
| Optional: true, | ||
| Computed: true, |
There was a problem hiding this comment.
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" {} |
There was a problem hiding this comment.
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 |
| name = var.name | ||
| region = var.region | ||
| max_message_size_kib = 1024 | ||
| max_messages_per_hour = 1000 |
| name = var.name | ||
| region = var.region | ||
| description = "An example runner for Intake" | ||
| max_message_size_kib = 1024 |
| region = var.region | ||
| description = "An example runner for Intake" | ||
| max_message_size_kib = 1024 | ||
| max_messages_per_hour = 1100 |
| if providerData.IntakeCustomEndpoint != "" { | ||
| apiClientConfigOptions = append(apiClientConfigOptions, config.WithEndpoint(providerData.IntakeCustomEndpoint)) | ||
| } else { | ||
| apiClientConfigOptions = append(apiClientConfigOptions) |
There was a problem hiding this comment.
This line looks like a leftover to me?
There was a problem hiding this comment.
wdym? In the contribution guide is set this way no?
| var testIntakeRunnerConfigVarsMin = config.Variables{ | ||
| "project_id": config.StringVariable(testutil.ProjectId), | ||
| "name": config.StringVariable("intake-min-runner"), | ||
| "region": config.StringVariable(testutil.Region), |
There was a problem hiding this comment.
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(` |
There was a problem hiding this comment.
| 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), |
| 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" |
There was a problem hiding this comment.
| "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
There was a problem hiding this comment.
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{ |
There was a problem hiding this comment.
| 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 |
There was a problem hiding this comment.
Please make sure to write the id fields to the state before starting the wait handler as instructed in our contribution guide:
terraform-provider-stackit/.github/docs/contribution-guide/resource.go
Lines 211 to 221 in 2977dba
| } | ||
|
|
||
| // Update runner | ||
| runnerResp, err := r.client.UpdateIntakeRunner(ctx, projectId, region, runnerId).UpdateIntakeRunnerPayload(*payload).Execute() |
There was a problem hiding this comment.
After update call please add
ctx = core.LogResponse(ctx)
Description
This PR onboards the new STACKIT Intake (ticket) service into the Terraform provider.
Intake is composed of three components:
This PR contains the Intake Runners part only to make a quicker and less overwhelming review.
Checklist
make fmtexamples/directory)make generate-docs(will be checked by CI)make test(will be checked by CI)make lint(will be checked by CI)