Skip to content

Commit 6a9cc25

Browse files
author
Yago Carlos Fernandez Gou
committed
Remove region field
1 parent f5c1434 commit 6a9cc25

File tree

4 files changed

+9
-16
lines changed

4 files changed

+9
-16
lines changed

docs/data-sources/intake_runner.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Datasource for STACKIT Intake Runner.
1818
### Required
1919

2020
- `project_id` (String) STACKIT Project ID to which the runner is associated.
21-
- `region` (String) The resource region.
2221
- `runner_id` (String) The runner ID.
2322

2423
### Read-Only

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ Note: AWS specific checks must be skipped as they do not work on STACKIT. For de
163163
- `experiments` (List of String) Enables experiments. These are unstable features without official support. More information can be found in the README. Available Experiments: iam, routing-tables, network
164164
- `git_custom_endpoint` (String) Custom endpoint for the Git service
165165
- `iaas_custom_endpoint` (String) Custom endpoint for the IaaS service
166-
- `intake_custom_endpoint` (String)
166+
- `intake_custom_endpoint` (String) Custom endpoint for the Intake service
167167
- `kms_custom_endpoint` (String) Custom endpoint for the KMS service
168168
- `loadbalancer_custom_endpoint` (String) Custom endpoint for the Load Balancer service
169169
- `logme_custom_endpoint` (String) Custom endpoint for the LogMe service

stackit/internal/services/intake/runner/data_source.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func (r *runnerDataSource) Configure(ctx context.Context, req datasource.Configu
4545
return
4646
}
4747

48-
r.client := intakeUtils.ConfigureClient(ctx, &providerData, &resp.Diagnostics)
48+
apiClient := intakeUtils.ConfigureClient(ctx, &providerData, &resp.Diagnostics)
4949
if resp.Diagnostics.HasError() {
5050
return
5151
}
@@ -61,7 +61,6 @@ func (r *runnerDataSource) Schema(_ context.Context, _ datasource.SchemaRequest,
6161
"project_id": "STACKIT Project ID to which the runner is associated.",
6262
"runner_id": "The runner ID.",
6363
"name": "The name of the runner.",
64-
"region": "The resource region.",
6564
"description": "The description of the runner.",
6665
"labels": "User-defined labels.",
6766
"max_message_size_kib": "The maximum message size in KiB.",
@@ -91,10 +90,6 @@ func (r *runnerDataSource) Schema(_ context.Context, _ datasource.SchemaRequest,
9190
validate.NoSeparator(),
9291
},
9392
},
94-
"region": schema.StringAttribute{
95-
Description: descriptions["region"],
96-
Required: true,
97-
},
9893
"name": schema.StringAttribute{
9994
Description: descriptions["name"],
10095
Computed: true,

stackit/internal/services/intake/runner/resource_acc_test.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ func TestAccIntakeRunner(t *testing.T) {
2929
Check: resource.ComposeTestCheckFunc(
3030
resource.TestCheckResourceAttr(intakeRunnerResource, "project_id", testutil.ProjectId),
3131
resource.TestCheckResourceAttr(intakeRunnerResource, "name", "example-runner-minimal"),
32-
resource.TestCheckResourceAttr(intakeRunnerResource, "region", "eu01"),
3332
resource.TestCheckResourceAttrSet(intakeRunnerResource, "runner_id"),
3433
resource.TestCheckResourceAttr(intakeRunnerResource, "description", ""),
3534
resource.TestCheckResourceAttr(intakeRunnerResource, "labels.%", "0"),
@@ -74,7 +73,6 @@ func testAccIntakeRunnerConfigMinimal(name string) string {
7473
resource "stackit_intake_runner" "example" {
7574
project_id = "%s"
7675
name = "%s"
77-
region = "eu01"
7876
max_message_size_kib = 1024
7977
max_messages_per_hour = 1000
8078
}
@@ -96,7 +94,6 @@ func testAccIntakeRunnerConfigFull(name, description string, maxKib, maxPerHour
9694
"created_by" = "terraform-provider-stackit"
9795
"env" = "development"
9896
}
99-
region = "eu01"
10097
}
10198
`,
10299
testutil.ProjectId,
@@ -116,7 +113,6 @@ func testAccIntakeRunnerConfigUpdated(name string, maxKib, maxPerHour int) strin
116113
max_message_size_kib = %d
117114
max_messages_per_hour = %d
118115
labels = {}
119-
region = "eu01"
120116
}
121117
`,
122118
testutil.ProjectId,
@@ -131,9 +127,7 @@ func testAccCheckIntakeRunnerDestroy(s *terraform.State) error {
131127
var client *intake.APIClient
132128
var err error
133129
if testutil.IntakeCustomEndpoint == "" {
134-
client, err = intake.NewAPIClient(
135-
sdkConfig.WithRegion("eu01"),
136-
)
130+
client, err = intake.NewAPIClient()
137131
} else {
138132
client, err = intake.NewAPIClient(sdkConfig.WithEndpoint(testutil.IntakeCustomEndpoint))
139133
}
@@ -148,7 +142,12 @@ func testAccCheckIntakeRunnerDestroy(s *terraform.State) error {
148142
// Try to find the runner
149143
_, err := client.GetIntakeRunner(ctx, rs.Primary.Attributes["project_id"], rs.Primary.Attributes["region"], rs.Primary.Attributes["runner_id"]).Execute()
150144
if err == nil {
151-
return fmt.Errorf("intake runner with ID %s still exists", rs.Primary.ID)
145+
err = client.DeleteIntakeRunner(ctx, rs.Primary.Attributes["project_id"], rs.Primary.Attributes["region"], rs.Primary.Attributes["runner_id"]).Execute()
146+
if err != nil {
147+
return fmt.Errorf("intake runner with ID %s still existed, got an error removing", rs.Primary.ID, err)
148+
}
149+
150+
return fmt.Errorf("intake runner with ID %s still existed", rs.Primary.ID)
152151
}
153152
var oapiErr *oapierror.GenericOpenAPIError
154153
if !errors.As(err, &oapiErr) || oapiErr.StatusCode != http.StatusNotFound {

0 commit comments

Comments
 (0)