Skip to content

Commit cc378d4

Browse files
authored
Merge branch 'main' into sqlserverflex-sdk-update
2 parents 5655491 + 10c344f commit cc378d4

File tree

295 files changed

+8034
-6538
lines changed

Some content is hidden

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

295 files changed

+8034
-6538
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/`

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/loadbalancer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ data "stackit_loadbalancer" "example" {
4949

5050
Optional:
5151

52-
- `server_name_indicators` (Attributes List) A list of domain names to match in order to pass TLS traffic to the target pool in the current listener (see [below for nested schema](#nestedatt--listeners--server_name_indicators))
52+
- `server_name_indicators` (Attributes List, Deprecated) A list of domain names to match in order to pass TLS traffic to the target pool in the current listener (see [below for nested schema](#nestedatt--listeners--server_name_indicators))
5353

5454
Read-Only:
5555

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)

docs/data-sources/opensearch_instance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,4 @@ Read-Only:
5959
- `sgw_acl` (String) Comma separated list of IP networks in CIDR notation which are allowed to access this instance.
6060
- `syslog` (List of String) List of syslog servers to send logs to.
6161
- `tls_ciphers` (List of String) List of TLS ciphers to use.
62-
- `tls_protocols` (String) The TLS protocol to use.
62+
- `tls_protocols` (List of String) List of TLS protocols to use.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "stackit_server_backup_enable Data Source - stackit"
4+
subcategory: ""
5+
description: |-
6+
Server backup enable datasource schema. Must have a region specified in the provider configuration.
7+
---
8+
9+
# stackit_server_backup_enable (Data Source)
10+
11+
Server backup enable datasource schema. Must have a `region` specified in the provider configuration.
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Required
19+
20+
- `project_id` (String) STACKIT Project ID to which the server backup enable is associated.
21+
- `server_id` (String) Server ID to which the server backup enable is associated.
22+
23+
### Optional
24+
25+
- `region` (String) The resource region. If not defined, the provider region is used.
26+
27+
### Read-Only
28+
29+
- `enabled` (Boolean) Set to true if the service is enabled.
30+
- `id` (String) Terraform's internal resource identifier. It is structured as "`project_id`,`server_id`,`region`".
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "stackit_server_update_enable Data Source - stackit"
4+
subcategory: ""
5+
description: |-
6+
Server update enable datasource schema. Must have a region specified in the provider configuration.
7+
---
8+
9+
# stackit_server_update_enable (Data Source)
10+
11+
Server update enable datasource schema. Must have a `region` specified in the provider configuration.
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Required
19+
20+
- `project_id` (String) STACKIT Project ID to which the server update enable is associated.
21+
- `server_id` (String) Server ID to which the server update enable is associated.
22+
23+
### Optional
24+
25+
- `region` (String) The resource region. If not defined, the provider region is used.
26+
27+
### Read-Only
28+
29+
- `enabled` (Boolean) Set to true if the service is enabled.
30+
- `id` (String) Terraform's internal resource identifier. It is structured as "`project_id`,`server_id`,`region`".

0 commit comments

Comments
 (0)