Skip to content

Commit 21c2c2b

Browse files
Merge branch 'main' into feat/STACKITTPR-399_sfs-error-messages
2 parents 5cfc72a + 5c52e10 commit 21c2c2b

File tree

272 files changed

+7570
-4628
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

272 files changed

+7570
-4628
lines changed

.github/docs/contribution-guide/resource.go

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"fmt"
66
"strings"
77

8+
"github.com/hashicorp/terraform-plugin-framework-timeouts/resource/timeouts"
89
"github.com/hashicorp/terraform-plugin-framework/resource"
910
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
1011
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
@@ -16,6 +17,7 @@ import (
1617
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
1718
fooUtils "github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/foo/utils"
1819
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/utils"
20+
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
1921

2022
"github.com/stackitcloud/stackit-sdk-go/services/foo" // Import service "foo" from the STACKIT SDK for Go
2123
"github.com/stackitcloud/stackit-sdk-go/services/foo/wait" // Import service "foo" waiters from the STACKIT SDK for Go (in case the service API has asynchronous endpoints)
@@ -32,13 +34,14 @@ var (
3234

3335
// Model is the internal model of the terraform resource
3436
type Model struct {
35-
Id types.String `tfsdk:"id"` // needed by TF
36-
ProjectId types.String `tfsdk:"project_id"`
37-
BarId types.String `tfsdk:"bar_id"`
38-
Region types.String `tfsdk:"region"`
39-
MyRequiredField types.String `tfsdk:"my_required_field"`
40-
MyOptionalField types.String `tfsdk:"my_optional_field"`
41-
MyReadOnlyField types.String `tfsdk:"my_read_only_field"`
37+
Id types.String `tfsdk:"id"` // needed by TF
38+
ProjectId types.String `tfsdk:"project_id"`
39+
BarId types.String `tfsdk:"bar_id"`
40+
Region types.String `tfsdk:"region"`
41+
MyRequiredField types.String `tfsdk:"my_required_field"`
42+
MyOptionalField types.String `tfsdk:"my_optional_field"`
43+
MyReadOnlyField types.String `tfsdk:"my_read_only_field"`
44+
Timeouts timeouts.Value `tfsdk:"timeouts"`
4245
}
4346

4447
// NewBarResource is a helper function to simplify the provider implementation.
@@ -104,7 +107,7 @@ func (r *barResource) Configure(ctx context.Context, req resource.ConfigureReque
104107
}
105108

106109
// Schema defines the schema for the resource.
107-
func (r *barResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
110+
func (r *barResource) Schema(ctx context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
108111
descriptions := map[string]string{
109112
"main": "Foo bar resource schema.",
110113
"id": "Terraform's internal resource identifier. It is structured as \"`project_id`,`bar_id`\".",
@@ -173,6 +176,7 @@ func (r *barResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *
173176
Description: descriptions["my_read_only_field"],
174177
Computed: true,
175178
},
179+
"timeouts": timeouts.AttributesAll(ctx),
176180
},
177181
}
178182
}
@@ -185,6 +189,15 @@ func (r *barResource) Create(ctx context.Context, req resource.CreateRequest, re
185189
return
186190
}
187191

192+
waiterTimeout := wait.CreateBarWaitHandler(ctx, r.client, projectId, region, resp.BarId).GetTimeout()
193+
createTimeout, diags := model.Timeouts.Create(ctx, waiterTimeout+core.DefaultTimeoutMargin)
194+
resp.Diagnostics.Append(diags...)
195+
if resp.Diagnostics.HasError() {
196+
return
197+
}
198+
ctx, cancel := context.WithTimeout(ctx, createTimeout)
199+
defer cancel()
200+
188201
ctx = core.InitProviderContext(ctx)
189202

190203
projectId := model.ProjectId.ValueString()
@@ -250,6 +263,14 @@ func (r *barResource) Read(ctx context.Context, req resource.ReadRequest, resp *
250263
return
251264
}
252265

266+
readTimeout, diags := model.Timeouts.Create(ctx, core.DefaultOperationTimeout)
267+
resp.Diagnostics.Append(diags...)
268+
if resp.Diagnostics.HasError() {
269+
return
270+
}
271+
ctx, cancel := context.WithTimeout(ctx, readTimeout)
272+
defer cancel()
273+
253274
ctx = core.InitProviderContext(ctx)
254275

255276
projectId := model.ProjectId.ValueString()
@@ -296,6 +317,15 @@ func (r *barResource) Delete(ctx context.Context, req resource.DeleteRequest, re
296317
return
297318
}
298319

320+
waiterTimeout := wait.DeleteBarWaitHandler(ctx, r.client, projectId, region, barId).GetTimeout()
321+
deleteTimeout, diags := model.Timeouts.Create(ctx, waiterTimeout+core.DefaultTimeoutMargin)
322+
resp.Diagnostics.Append(diags...)
323+
if resp.Diagnostics.HasError() {
324+
return
325+
}
326+
ctx, cancel := context.WithTimeout(ctx, deleteTimeout)
327+
defer cancel()
328+
299329
ctx = core.InitProviderContext(ctx)
300330

301331
projectId := model.ProjectId.ValueString()

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
- main
99

1010
env:
11-
GO_VERSION: "1.24"
11+
GO_VERSION: "1.26"
1212
CODE_COVERAGE_FILE_NAME: "coverage.out" # must be the same as in Makefile
1313
CODE_COVERAGE_ARTIFACT_NAME: "code-coverage"
1414

CONTRIBUTION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ If you want to onboard resources of a STACKIT service `foo` that was not yet in
103103

104104
### Local development
105105

106-
To test your changes locally, you have to compile the provider (requires Go 1.24) and configure the Terraform CLI to use the local version.
106+
To test your changes locally, you have to compile the provider (requires Go 1.26) and configure the Terraform CLI to use the local version.
107107

108108
1. Clone the repository.
109109
1. Run `$ make build` to build the Terraform provider binary in `<PATH_TO_REPO>/bin/`

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,12 @@ Terraform acceptance tests are run using the command `make test-acceptance-tf`.
222222

223223
Additionally:
224224

225-
| Env var | Value | Example value | needed for Acc tests of the following services |
226-
|---------------------------------------------|---------------------------------------------------------------------------------------------------------|----------------------------------------|------------------------------------------------|
227-
| `TF_ACC_ORGANIZATION_ID` | ID of the STACKIT test organization | `5353ccfa-a984-4b96-a71d-b863dd2b7087` | `authorization`, `iaas` |
228-
| `TF_ACC_TEST_PROJECT_SERVICE_ACCOUNT_EMAIL` | Email of the STACKIT service account | `abc-serviceaccount@sa.stackit.cloud` | `authorization`, `resourcemanager` | |
229-
| `TF_ACC_TEST_PROJECT_PARENT_CONTAINER_ID` | Container ID of the project parent container (folder within an organization or the organization itself) | `organization-d2b7087` | `resourcemanager` |
230-
| `TF_ACC_TEST_PROJECT_PARENT_UUID` | UUID ID of the project parent container (folder within an organization or the organization itself) | `5353ccfa-a984-4b96-a71d-b863dd2b7087` | `resourcemanager` |
225+
| Env var | Value | Example value | needed for Acc tests of the following services |
226+
|---------------------------------------------|---------------------------------------------------------------------------------------------------------|----------------------------------------|--------------------------------------------------------------|
227+
| `TF_ACC_ORGANIZATION_ID` | ID of the STACKIT test organization | `5353ccfa-a984-4b96-a71d-b863dd2b7087` | `authorization`, `iaas` |
228+
| `TF_ACC_TEST_PROJECT_SERVICE_ACCOUNT_EMAIL` | Email of the STACKIT service account | `abc-serviceaccount@sa.stackit.cloud` | `authorization`, `iaas`, `resourcemanager`, `secretsmanager` |
229+
| `TF_ACC_TEST_PROJECT_PARENT_CONTAINER_ID` | Container ID of the project parent container (folder within an organization or the organization itself) | `organization-d2b7087` | `resourcemanager` |
230+
| `TF_ACC_TEST_PROJECT_PARENT_UUID` | UUID ID of the project parent container (folder within an organization or the organization itself) | `5353ccfa-a984-4b96-a71d-b863dd2b7087` | `resourcemanager` |
231231

232232
### Run Acceptance Tests of a single service
233233

docs/data-sources/dns_record_set.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ data "stackit_dns_record_set" "example" {
2929
- `record_set_id` (String) The rr set id.
3030
- `zone_id` (String) The zone ID to which is dns record set is associated.
3131

32+
### Optional
33+
34+
- `timeouts` (Attributes) (see [below for nested schema](#nestedatt--timeouts))
35+
3236
### Read-Only
3337

3438
- `active` (Boolean) Specifies if the record set is active or not.
@@ -41,3 +45,10 @@ data "stackit_dns_record_set" "example" {
4145
- `state` (String) Record set state.
4246
- `ttl` (Number) Time to live. E.g. 3600
4347
- `type` (String) The record set type. E.g. `A` or `CNAME`
48+
49+
<a id="nestedatt--timeouts"></a>
50+
### Nested Schema for `timeouts`
51+
52+
Optional:
53+
54+
- `read` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).

docs/data-sources/dns_zone.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ data "stackit_dns_zone" "example" {
2929
### Optional
3030

3131
- `dns_name` (String) The zone name. E.g. `example.com` (must not end with a trailing dot).
32+
- `timeouts` (Attributes) (see [below for nested schema](#nestedatt--timeouts))
3233
- `zone_id` (String) The zone ID.
3334

3435
### Read-Only
@@ -52,3 +53,10 @@ data "stackit_dns_zone" "example" {
5253
- `state` (String) Zone state.
5354
- `type` (String) Zone type.
5455
- `visibility` (String) Visibility of the zone.
56+
57+
<a id="nestedatt--timeouts"></a>
58+
### Nested Schema for `timeouts`
59+
60+
Optional:
61+
62+
- `read` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).

docs/data-sources/edgecloud_plans.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,5 @@ Read-Only:
4343
- `description` (String) Description of the plan.
4444
- `id` (String) The ID of the plan.
4545
- `max_edge_hosts` (Number) Maximum number of Edge Cloud hosts that can be used.
46+
- `min_edge_hosts` (Number) Minimum number of Edge Cloud hosts charged.
4647
- `name` (String) The name of the plan.

docs/data-sources/objectstorage_bucket.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@ data "stackit_objectstorage_bucket" "example" {
3434
### Read-Only
3535

3636
- `id` (String) Terraform's internal data source identifier. It is structured as "`project_id`,`region`,`name`".
37+
- `object_lock` (Boolean) Enable Object Lock on this bucket. Can only be set at creation time. Requires an active project-level compliance lock.
3738
- `url_path_style` (String)
3839
- `url_virtual_hosted_style` (String)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "stackit_objectstorage_compliance_lock Data Source - stackit"
4+
subcategory: ""
5+
description: |-
6+
ObjectStorage compliance lock resource schema. Must have a region specified in the provider configuration.
7+
---
8+
9+
# stackit_objectstorage_compliance_lock (Data Source)
10+
11+
ObjectStorage compliance lock resource schema. Must have a `region` specified in the provider configuration.
12+
13+
## Example Usage
14+
15+
```terraform
16+
data "stackit_objectstorage_compliance_lock" "example" {
17+
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
18+
}
19+
```
20+
21+
<!-- schema generated by tfplugindocs -->
22+
## Schema
23+
24+
### Required
25+
26+
- `project_id` (String) STACKIT Project ID to which the compliance lock is associated.
27+
28+
### Optional
29+
30+
- `region` (String) The resource region. If not defined, the provider region is used.
31+
32+
### Read-Only
33+
34+
- `id` (String) Terraform's internal resource identifier. It is structured as "`project_id`,`region`".
35+
- `max_retention_days` (Number) Maximum retention period in days.

docs/data-sources/secretsmanager_instance.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,15 @@ data "stackit_secretsmanager_instance" "example" {
3131

3232
- `acls` (Set of String) The access control list for this instance. Each entry is an IP or IP range that is permitted to access, in CIDR notation
3333
- `id` (String) Terraform's internal resource ID. It is structured as "`project_id`,`instance_id`".
34+
- `kms_key` (Attributes) The STACKIT-KMS key for secret encryption and decryption. (see [below for nested schema](#nestedatt--kms_key))
3435
- `name` (String) Instance name.
36+
37+
<a id="nestedatt--kms_key"></a>
38+
### Nested Schema for `kms_key`
39+
40+
Read-Only:
41+
42+
- `key_id` (String) UUID of the key within the STACKIT-KMS to use for the encryption.
43+
- `key_ring_id` (String) UUID of the keyring where the key is located within the STACKTI-KMS.
44+
- `key_version` (Number) Version of the key within the STACKIT-KMS to use for the encryption.
45+
- `service_account_email` (String) Service-Account linked to the Key within the STACKIT-KMS.

0 commit comments

Comments
 (0)