Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module terraform-provider-delphix

go 1.17

require github.com/delphix/dct-sdk-go v1.0.0-beta4
require github.com/delphix/dct-sdk-go v1.0.0-beta5

require (
github.com/agext/levenshtein v1.2.2 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/delphix/dct-sdk-go v1.0.0-beta4 h1:+SWAh/6xbbgK/j4+ROeJTHmO6AYzbWK5VlM2jz11pLc=
github.com/delphix/dct-sdk-go v1.0.0-beta4/go.mod h1:uzV6PTpsNHM24KKvNXaUgIfd5BDbq/fKM+M+PdSZ3JQ=
github.com/delphix/dct-sdk-go v1.0.0-beta5 h1:tm4chfs13Do9Pc8MQdzmbvNTeACBGCVelz5+GmnZ5dw=
github.com/delphix/dct-sdk-go v1.0.0-beta5/go.mod h1:uzV6PTpsNHM24KKvNXaUgIfd5BDbq/fKM+M+PdSZ3JQ=
github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=
github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
Expand Down
8 changes: 4 additions & 4 deletions internal/provider/resource_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,15 +344,15 @@ func resourceEnvironmentCreate(ctx context.Context, d *schema.ResourceData, meta
}

d.SetId(apiRes.GetEnvironmentId())
job_status, job_err := PollJobStatus(*apiRes.JobId, ctx, client)
job_status, job_err := PollJobStatus(*apiRes.Job.Id, ctx, client)

if job_err != "" {
ErrorLog.Printf("Job Polling failed but continuing with env creation. Error: %v", job_err)
}

if isJobTerminalFailure(job_status) {
d.SetId("")
return diag.Errorf("[NOT OK] Env-Create %s. JobId: %s / Error: %s", job_status, *apiRes.JobId, job_err)
return diag.Errorf("[NOT OK] Env-Create %s. JobId: %s / Error: %s", job_status, *apiRes.Job.Id, job_err)
}
// Get environment info and store state.
readDiags := resourceEnvironmentRead(ctx, d, meta)
Expand Down Expand Up @@ -400,12 +400,12 @@ func resourceEnvironmentDelete(ctx context.Context, d *schema.ResourceData, meta
return diags
}

job_status, job_err := PollJobStatus(*apiRes.JobId, ctx, client)
job_status, job_err := PollJobStatus(*apiRes.Job.Id, ctx, client)
if job_err != "" {
ErrorLog.Printf("Job Polling failed but continuing with env deletion. Error: %v", job_err)
}
if isJobTerminalFailure(job_status) {
return diag.Errorf("[NOT OK] Env-Delete %s. JobId: %s / Error: %s", job_status, *apiRes.JobId, job_err)
return diag.Errorf("[NOT OK] Env-Delete %s. JobId: %s / Error: %s", job_status, *apiRes.Job.Id, job_err)
}
_, diags := PollForObjectDeletion(func() (interface{}, *http.Response, error) {
return client.EnvironmentsApi.GetEnvironmentById(ctx, envId).Execute()
Expand Down
20 changes: 10 additions & 10 deletions internal/provider/resource_vdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -639,14 +639,14 @@ func helper_provision_by_snapshot(ctx context.Context, d *schema.ResourceData, m

d.SetId(*apiRes.Vdb.Id)

job_res, job_err := PollJobStatus(*apiRes.JobId, ctx, client)
job_res, job_err := PollJobStatus(*apiRes.Job.Id, ctx, client)
if job_err != "" {
ErrorLog.Printf("Job Polling failed but continuing with provisioning. Error: %s", job_err)
}
InfoLog.Printf("Job result is %s", job_res)
if job_res == Failed || job_res == Canceled || job_res == Abandoned {
ErrorLog.Printf("Job %s %s!", job_res, apiRes.GetJobId())
return diag.Errorf("[NOT OK] Job %s %s with error %s", apiRes.GetJobId(), job_res, job_err)
ErrorLog.Printf("Job %s %s!", job_res, *apiRes.Job.Id)
return diag.Errorf("[NOT OK] Job %s %s with error %s", *apiRes.Job.Id, job_res, job_err)
}

readDiags := resourceVdbRead(ctx, d, meta)
Expand Down Expand Up @@ -862,14 +862,14 @@ func helper_provision_by_timestamp(ctx context.Context, d *schema.ResourceData,

d.SetId(*apiRes.Vdb.Id)

job_res, job_err := PollJobStatus(apiRes.GetJobId(), ctx, client)
job_res, job_err := PollJobStatus(*apiRes.Job.Id, ctx, client)
if job_err != "" {
ErrorLog.Printf("Job Polling failed but continuing with provisioning. Error: %v", job_err)
}
InfoLog.Printf("Job result is %s", job_res)
if job_res == "FAILED" {
ErrorLog.Printf("Job %s Failed!", apiRes.GetJobId())
return diag.Errorf("[NOT OK] Job %s Failed with error %s", apiRes.GetJobId(), job_err)
ErrorLog.Printf("Job %s Failed!", *apiRes.Job.Id)
return diag.Errorf("[NOT OK] Job %s Failed with error %s", *apiRes.Job.Id, job_err)
}

readDiags := resourceVdbRead(ctx, d, meta)
Expand Down Expand Up @@ -1058,13 +1058,13 @@ func resourceVdbUpdate(ctx context.Context, d *schema.ResourceData, meta interfa
return diags
}

job_status, job_err := PollJobStatus(*res.JobId, ctx, client)
job_status, job_err := PollJobStatus(*res.Job.Id, ctx, client)
if job_err != "" {
WarnLog.Printf("VDB Update Job Polling failed but continuing with update. Error :%v", job_err)
}
InfoLog.Printf("Job result is %s", job_status)
if isJobTerminalFailure(job_status) {
return diag.Errorf("[NOT OK] VDB-Update %s. JobId: %s / Error: %s", job_status, *res.JobId, job_err)
return diag.Errorf("[NOT OK] VDB-Update %s. JobId: %s / Error: %s", job_status, *res.Job.Id, job_err)
}

return diags
Expand All @@ -1084,13 +1084,13 @@ func resourceVdbDelete(ctx context.Context, d *schema.ResourceData, meta interfa
return diags
}

job_status, job_err := PollJobStatus(*res.JobId, ctx, client)
job_status, job_err := PollJobStatus(*res.Job.Id, ctx, client)
if job_err != "" {
WarnLog.Printf("Job Polling failed but continuing with deletion. Error :%v", job_err)
}
InfoLog.Printf("Job result is %s", job_status)
if isJobTerminalFailure(job_status) {
return diag.Errorf("[NOT OK] VDB-Delete %s. JobId: %s / Error: %s", job_status, *res.JobId, job_err)
return diag.Errorf("[NOT OK] VDB-Delete %s. JobId: %s / Error: %s", job_status, *res.Job.Id, job_err)
}

_, diags := PollForObjectDeletion(func() (interface{}, *http.Response, error) {
Expand Down