Skip to content

Commit 9f57f8d

Browse files
Merge pull request #1205 from hashicorp/TF-28651_deprecate
TF-28651 deprecate endpoints
2 parents 93f1732 + 170a21c commit 9f57f8d

10 files changed

+6
-830
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
## Enhancements
44
* Exports the StackConfiguration UploadTarGzip receiver function[#1219](https://github.com/hashicorp/go-tfe/pull/1219)
55

6+
## Deprecations
7+
8+
* The beta `StackDeployments`, `StackPlan`, `StackPlanOperation`, and `StackSource` resources have been removed, by @sahar-azizighannad [#1205](https://github.com/hashicorp/go-tfe/pull/1205)
9+
610
# v1.92.0
711

812
## Enhancements

stack.go

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -138,21 +138,6 @@ type StackConfiguration struct {
138138
Stack *Stack `jsonapi:"relation,stack"`
139139
}
140140

141-
// StackDeployment represents a stack deployment, specified by configuration
142-
type StackDeployment struct {
143-
// Attributes
144-
ID string `jsonapi:"primary,stack-deployments"`
145-
Name string `jsonapi:"attr,name"`
146-
Status string `jsonapi:"attr,status"`
147-
DeployedAt time.Time `jsonapi:"attr,deployed-at,iso8601"`
148-
ErrorsCount int `jsonapi:"attr,errors-count"`
149-
WarningsCount int `jsonapi:"attr,warnings-count"`
150-
PausedCount int `jsonapi:"attr,paused-count"`
151-
152-
// Relationships
153-
CurrentStackState *StackState `jsonapi:"relation,current-stack-state"`
154-
}
155-
156141
// StackState represents a stack state
157142
type StackState struct {
158143
// Attributes
@@ -307,7 +292,7 @@ func (s stacks) Update(ctx context.Context, stackID string, options StackUpdateO
307292

308293
// Delete deletes a stack.
309294
func (s stacks) Delete(ctx context.Context, stackID string) error {
310-
req, err := s.client.NewRequest("POST", fmt.Sprintf("stacks/%s/delete", url.PathEscape(stackID)), nil)
295+
req, err := s.client.NewRequest("DELETE", fmt.Sprintf("stacks/%s", url.PathEscape(stackID)), nil)
311296
if err != nil {
312297
return err
313298
}
@@ -317,7 +302,7 @@ func (s stacks) Delete(ctx context.Context, stackID string) error {
317302

318303
// ForceDelete deletes a stack that still has deployments.
319304
func (s stacks) ForceDelete(ctx context.Context, stackID string) error {
320-
req, err := s.client.NewRequest("POST", fmt.Sprintf("stacks/%s/force-delete", url.PathEscape(stackID)), nil)
305+
req, err := s.client.NewRequest("DELETE", fmt.Sprintf("stacks/%s?force=true", url.PathEscape(stackID)), nil)
321306
if err != nil {
322307
return err
323308
}

stack_deployments.go

Lines changed: 0 additions & 38 deletions
This file was deleted.

stack_integration_test.go

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -353,37 +353,6 @@ func pollStackDeployments(t *testing.T, ctx context.Context, client *Client, sta
353353
return
354354
}
355355

356-
func pollStackDeploymentStatus(t *testing.T, ctx context.Context, client *Client, stackID, deploymentName, status string) {
357-
// pollStackDeployments will poll the given stack until it has deployments or the deadline is reached.
358-
ctx, cancel := context.WithDeadline(ctx, time.Now().Add(5*time.Minute))
359-
defer cancel()
360-
361-
deadline, _ := ctx.Deadline()
362-
t.Logf("Polling stack %q for deployments with deadline of %s", stackID, deadline)
363-
364-
ticker := time.NewTicker(2 * time.Second)
365-
defer ticker.Stop()
366-
367-
for finished := false; !finished; {
368-
t.Log("...")
369-
select {
370-
case <-ctx.Done():
371-
t.Fatalf("Stack deployment %s/%s did not have status %q at deadline", stackID, deploymentName, status)
372-
case <-ticker.C:
373-
var err error
374-
deployment, err := client.StackDeployments.Read(ctx, stackID, deploymentName)
375-
if err != nil {
376-
t.Fatalf("Failed to read stack deployment %s/%s: %s", stackID, deploymentName, err)
377-
}
378-
379-
t.Logf("Stack deployment %s/%s had status %q", stackID, deploymentName, deployment.Status)
380-
if deployment.Status == status {
381-
finished = true
382-
}
383-
}
384-
}
385-
}
386-
387356
func pollStackConfigurationStatus(t *testing.T, ctx context.Context, client *Client, stackConfigID, status string) (stackConfig *StackConfiguration) {
388357
// pollStackDeployments will poll the given stack until it has deployments or the deadline is reached.
389358
ctx, cancel := context.WithDeadline(ctx, time.Now().Add(5*time.Minute))
@@ -453,9 +422,5 @@ func TestStackConverged(t *testing.T) {
453422
require.ElementsMatch(t, deployments, stack.DeploymentNames)
454423
require.NotNil(t, stack.LatestStackConfiguration)
455424

456-
for _, deployment := range deployments {
457-
pollStackDeploymentStatus(t, ctx, client, stack.ID, deployment, "paused")
458-
}
459-
460425
pollStackConfigurationStatus(t, ctx, client, stack.LatestStackConfiguration.ID, "converged")
461426
}

0 commit comments

Comments
 (0)