fix: fix wrong order of params (#59)
All checks were successful
Publish / Check GoReleaser config (push) Successful in 10s
Publish / Publish provider (push) Successful in 34m9s

## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] 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](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #59
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
This commit is contained in:
Marcel_Henselin 2026-02-13 14:55:36 +00:00 committed by Marcel_Henselin
parent e01ae1a920
commit b1f8c8a4d9
Signed by: tf-provider.git.onstackit.cloud
GPG key ID: 6D7E8A1ED8955A9C
3 changed files with 13 additions and 8 deletions

View file

@ -39,11 +39,14 @@ type {{.NameCamel}}Resource struct{
providerData core.ProviderData
}
// resourceModel represents the Terraform resource state
type resourceModel = {{.PackageName}}.{{.NamePascal}}Model
type {{.NamePascal}}ResourceIdentityModel struct {
ProjectID types.String `tfsdk:"project_id"`
Region types.String `tfsdk:"region"`
// TODO: implement further needed parts
{{.NamePascal}}ID types.String `tfsdk:"instance_id"`
{{.NamePascal}}ID types.String `tfsdk:"{{.NameSnake}}_id"`
}
// Metadata defines terraform resource name
@ -51,6 +54,9 @@ func (r *{{.NameCamel}}Resource) Metadata(ctx context.Context, req resource.Meta
resp.TypeName = req.ProviderTypeName + "_{{.PackageName}}_{{.NameSnake}}"
}
//go:embed planModifiers.yaml
var modifiersFileByte []byte
// Schema loads the schema from generated files and adds plan modifiers
func (r *{{.NameCamel}}Resource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
schema = {{.PackageName}}ResGen.{{.NamePascal}}ResourceSchema(ctx)
@ -82,6 +88,7 @@ func (r *instanceResource) IdentitySchema(_ context.Context, _ resource.Identity
"instance_id": identityschema.StringAttribute{
RequiredForImport: true, // can be defaulted by the provider configuration
},
// TODO: implement remaining schema parts
},
}
}
@ -160,9 +167,6 @@ func (r *{{.NameCamel}}Resource) ModifyPlan(
}
}
//go:embed planModifiers.yaml
var modifiersFileByte []byte
// Create creates a new resource
func (r *{{.NameCamel}}Resource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
var data {{.PackageName}}ResGen.{{.NamePascal}}Model
@ -180,6 +184,7 @@ func (r *{{.NameCamel}}Resource) Create(ctx context.Context, req resource.Create
region := data.Region.ValueString()
ctx = tflog.SetField(ctx, "project_id", projectId)
ctx = tflog.SetField(ctx, "region", region)
// TODO: add remaining fields
// TODO: Create API call logic
/*

View file

@ -290,7 +290,7 @@ func (r *databaseResource) Read(
ctx = core.InitProviderContext(ctx)
projectId, instanceId, region, databaseId, errExt := r.extractIdentityData(model, identityData)
projectId, region, instanceId, databaseId, errExt := r.extractIdentityData(model, identityData)
if errExt != nil {
core.LogAndAddError(
ctx,
@ -376,7 +376,7 @@ func (r *databaseResource) Update(
ctx = core.InitProviderContext(ctx)
projectId, instanceId, region, databaseId64, errExt := r.extractIdentityData(model, identityData)
projectId, region, instanceId, databaseId64, errExt := r.extractIdentityData(model, identityData)
if errExt != nil {
core.LogAndAddError(
ctx,
@ -502,7 +502,7 @@ func (r *databaseResource) Delete(
ctx = core.InitProviderContext(ctx)
projectId, instanceId, region, databaseId64, errExt := r.extractIdentityData(model, identityData)
projectId, region, instanceId, databaseId64, errExt := r.extractIdentityData(model, identityData)
if errExt != nil {
core.LogAndAddError(
ctx,

View file

@ -488,7 +488,7 @@ func (r *userResource) ImportState(
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("instance_id"), idParts[2])...)
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("user_id"), userId)...)
tflog.Info(ctx, "Postgres Flex user state imported")
tflog.Info(ctx, "SQLServer Flex user state imported")
return
}