fix: remove identity from sqlserverbeta and postresflexalpha
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 6s
TF Acceptance Tests Workflow / Acceptance Tests (pull_request) Failing after 4m51s
CI Workflow / Prepare GO cache (pull_request) Successful in 6m12s
CI Workflow / Code coverage report (pull_request) Has been cancelled
CI Workflow / Test readiness for publishing provider (pull_request) Has been cancelled
CI Workflow / CI run tests (pull_request) Has been cancelled
CI Workflow / CI run build and linting (pull_request) Has been cancelled
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 6s
TF Acceptance Tests Workflow / Acceptance Tests (pull_request) Failing after 4m51s
CI Workflow / Prepare GO cache (pull_request) Successful in 6m12s
CI Workflow / Code coverage report (pull_request) Has been cancelled
CI Workflow / Test readiness for publishing provider (pull_request) Has been cancelled
CI Workflow / CI run tests (pull_request) Has been cancelled
CI Workflow / CI run build and linting (pull_request) Has been cancelled
This commit is contained in:
parent
042e8115a6
commit
746f7cdfbd
13 changed files with 1438 additions and 259 deletions
|
|
@ -10,6 +10,7 @@ import (
|
|||
"github.com/hashicorp/terraform-plugin-framework/diag"
|
||||
"github.com/hashicorp/terraform-plugin-framework/resource"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
|
||||
"tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/utils"
|
||||
|
||||
"github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex/v3beta1api"
|
||||
|
|
|
|||
|
|
@ -266,15 +266,15 @@ func (r *instanceResource) Read(ctx context.Context, req resource.ReadRequest, r
|
|||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
projectId := data.ProjectId.ValueString()
|
||||
projectID := data.ProjectId.ValueString()
|
||||
region := data.Region.ValueString()
|
||||
ctx = tflog.SetField(ctx, "project_id", projectId)
|
||||
ctx = tflog.SetField(ctx, "project_id", projectID)
|
||||
ctx = tflog.SetField(ctx, "region", region)
|
||||
|
||||
instanceId := data.InstanceId.ValueString()
|
||||
ctx = tflog.SetField(ctx, "instance_id", instanceId)
|
||||
instanceID := data.InstanceId.ValueString()
|
||||
ctx = tflog.SetField(ctx, "instance_id", instanceID)
|
||||
|
||||
instanceResp, err := r.client.DefaultAPI.GetInstanceRequest(ctx, projectId, region, instanceId).Execute()
|
||||
instanceResp, err := r.client.DefaultAPI.GetInstanceRequest(ctx, projectID, region, instanceID).Execute()
|
||||
if err != nil {
|
||||
oapiErr, ok := err.(*oapierror.GenericOpenAPIError) //nolint:errorlint //complaining that error.As should be used to catch wrapped errors, but this error should not be wrapped
|
||||
if ok && oapiErr.StatusCode == http.StatusNotFound {
|
||||
|
|
@ -319,13 +319,13 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
|
|||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
projectId := data.ProjectId.ValueString()
|
||||
projectID := data.ProjectId.ValueString()
|
||||
region := data.Region.ValueString()
|
||||
ctx = tflog.SetField(ctx, "project_id", projectId)
|
||||
ctx = tflog.SetField(ctx, "project_id", projectID)
|
||||
ctx = tflog.SetField(ctx, "region", region)
|
||||
|
||||
instanceId := data.InstanceId.ValueString()
|
||||
ctx = tflog.SetField(ctx, "instance_id", instanceId)
|
||||
instanceID := data.InstanceId.ValueString()
|
||||
ctx = tflog.SetField(ctx, "instance_id", instanceID)
|
||||
|
||||
// Generate API request body from model
|
||||
payload, err := toUpdatePayload(ctx, &data, resp)
|
||||
|
|
@ -341,9 +341,9 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
|
|||
// Update existing instance
|
||||
err = r.client.DefaultAPI.UpdateInstanceRequest(
|
||||
ctx,
|
||||
projectId,
|
||||
projectID,
|
||||
region,
|
||||
instanceId,
|
||||
instanceID,
|
||||
).UpdateInstanceRequestPayload(*payload).Execute()
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, updateInstanceError, err.Error())
|
||||
|
|
@ -353,7 +353,7 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
|
|||
ctx = core.LogResponse(ctx)
|
||||
|
||||
waitResp, err := wait.
|
||||
UpdateInstanceWaitHandler(ctx, r.client.DefaultAPI, projectId, instanceId, region).
|
||||
UpdateInstanceWaitHandler(ctx, r.client.DefaultAPI, projectID, instanceID, region).
|
||||
SetSleepBeforeWait(15 * time.Second).
|
||||
SetTimeout(45 * time.Minute).
|
||||
WaitWithContext(ctx)
|
||||
|
|
@ -399,16 +399,16 @@ func (r *instanceResource) Delete(ctx context.Context, req resource.DeleteReques
|
|||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
projectId := data.ProjectId.ValueString()
|
||||
projectID := data.ProjectId.ValueString()
|
||||
region := data.Region.ValueString()
|
||||
ctx = tflog.SetField(ctx, "project_id", projectId)
|
||||
ctx = tflog.SetField(ctx, "project_id", projectID)
|
||||
ctx = tflog.SetField(ctx, "region", region)
|
||||
|
||||
instanceId := data.InstanceId.ValueString()
|
||||
ctx = tflog.SetField(ctx, "instance_id", instanceId)
|
||||
instanceID := data.InstanceId.ValueString()
|
||||
ctx = tflog.SetField(ctx, "instance_id", instanceID)
|
||||
|
||||
// Delete existing instance
|
||||
err := r.client.DefaultAPI.DeleteInstanceRequest(ctx, projectId, region, instanceId).Execute()
|
||||
err := r.client.DefaultAPI.DeleteInstanceRequest(ctx, projectID, region, instanceID).Execute()
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting instance", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
|
|
@ -416,7 +416,7 @@ func (r *instanceResource) Delete(ctx context.Context, req resource.DeleteReques
|
|||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
delResp, err := wait.DeleteInstanceWaitHandler(ctx, r.client.DefaultAPI, projectId, instanceId, region).WaitWithContext(ctx)
|
||||
delResp, err := wait.DeleteInstanceWaitHandler(ctx, r.client.DefaultAPI, projectID, instanceID, region).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(
|
||||
ctx,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue