Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
627e4ff
chore(deps): bump github.com/hashicorp/terraform-plugin-testing
dependabot[bot] Sep 3, 2025
9a3c1be
test(vpc): harden destroy checks with RetryContext
yfodil Sep 5, 2025
42b5468
Merge branch 'master' into dependabot/go_modules/github.com/hashicorp…
yfodil Sep 5, 2025
4df915d
test(ipam): harden destroy checks with RetryContext
yfodil Sep 5, 2025
e3f2b53
Merge branch 'dependabot/go_modules/github.com/hashicorp/terraform-pl…
yfodil Sep 5, 2025
6b70903
test(vpcgw): harden destroy checks with RetryContext
yfodil Sep 5, 2025
df81909
lint
yfodil Sep 5, 2025
bc2479c
test(fip): harden destroy checks with RetryContext + update cassettes
yfodil Sep 5, 2025
d92c894
test(lb): harden destroy checks with RetryContext
yfodil Sep 5, 2025
0a07e13
test(account): harden destroy checks with RetryContext
yfodil Sep 5, 2025
869a656
test(iam): harden destroy checks with RetryContext
yfodil Sep 5, 2025
9716430
test(iot): harden destroy checks with RetryContext
yfodil Sep 5, 2025
aaac6e5
test(webhosting): harden destroy checks with RetryContext
yfodil Sep 5, 2025
ccc9b72
test(inference): harden destroy checks with RetryContext
yfodil Sep 5, 2025
7ee00a3
test(cockpit): harden destroy checks with RetryContext
yfodil Sep 5, 2025
54a6f9b
test(registry): harden destroy checks with RetryContext
yfodil Sep 5, 2025
0c09058
test(redis): harden destroy checks with RetryContext
yfodil Sep 5, 2025
e85bebd
test(k8s): harden destroy checks with RetryContext
yfodil Sep 5, 2025
d94eaa1
test(baremetal): harden destroy checks with RetryContext
yfodil Sep 5, 2025
283022a
test(mongodb): harden destroy checks with RetryContext
yfodil Sep 5, 2025
31c2519
test(secret): harden destroy checks with RetryContext
yfodil Sep 5, 2025
35e8be0
test(rdb): harden destroy checks with RetryContext
yfodil Sep 8, 2025
f9759b9
lint
yfodil Sep 8, 2025
2073010
test(instance): harden destroy checks with RetryContext
yfodil Sep 8, 2025
c3e7fe5
fix
yfodil Sep 8, 2025
d1c8796
fix
yfodil Sep 8, 2025
1f2dee0
Merge branch 'master' into dependabot/go_modules/github.com/hashicorp…
remyleone Sep 8, 2025
5828bc7
replace hardcoded timeouts with DestroyWaitTimeout
yfodil Sep 8, 2025
caa3eb7
Merge branch 'dependabot/go_modules/github.com/hashicorp/terraform-pl…
yfodil Sep 8, 2025
34ae587
fix
yfodil Sep 8, 2025
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
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ require (
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/hashicorp/terraform-plugin-mux v0.20.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.37.0
github.com/hashicorp/terraform-plugin-testing v1.5.1
github.com/hashicorp/terraform-plugin-testing v1.13.3
github.com/nats-io/jwt/v2 v2.8.0
github.com/nats-io/nats.go v1.45.0
github.com/robfig/cron/v3 v3.0.1
Expand Down Expand Up @@ -149,7 +149,7 @@ require (
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
github.com/yuin/goldmark v1.7.7 // indirect
github.com/yuin/goldmark-meta v1.1.0 // indirect
github.com/zclconf/go-cty v1.16.2 // indirect
github.com/zclconf/go-cty v1.16.3 // indirect
go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,8 @@ github.com/hashicorp/terraform-plugin-mux v0.20.0 h1:3QpBnI9uCuL0Yy2Rq/kR9cOdmOF
github.com/hashicorp/terraform-plugin-mux v0.20.0/go.mod h1:wSIZwJjSYk86NOTX3fKUlThMT4EAV1XpBHz9SAvjQr4=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.37.0 h1:NFPMacTrY/IdcIcnUB+7hsore1ZaRWU9cnB6jFoBnIM=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.37.0/go.mod h1:QYmYnLfsosrxjCnGY1p9c7Zj6n9thnEE+7RObeYs3fA=
github.com/hashicorp/terraform-plugin-testing v1.5.1 h1:T4aQh9JAhmWo4+t1A7x+rnxAJHCDIYW9kXyo4sVO92c=
github.com/hashicorp/terraform-plugin-testing v1.5.1/go.mod h1:dg8clO6K59rZ8w9EshBmDp1CxTIPu3yA4iaDpX1h5u0=
github.com/hashicorp/terraform-plugin-testing v1.13.3 h1:QLi/khB8Z0a5L54AfPrHukFpnwsGL8cwwswj4RZduCo=
github.com/hashicorp/terraform-plugin-testing v1.13.3/go.mod h1:WHQ9FDdiLoneey2/QHpGM/6SAYf4A7AZazVg7230pLE=
github.com/hashicorp/terraform-registry-address v0.2.5 h1:2GTftHqmUhVOeuu9CW3kwDkRe4pcBDq0uuK5VJngU1M=
github.com/hashicorp/terraform-registry-address v0.2.5/go.mod h1:PpzXWINwB5kuVS5CA7m1+eO2f1jKb5ZDIxrOPfpnGkg=
github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ=
Expand Down Expand Up @@ -512,8 +512,8 @@ github.com/yuin/goldmark v1.7.7 h1:5m9rrB1sW3JUMToKFQfb+FGt1U7r57IHu5GrYrG2nqU=
github.com/yuin/goldmark v1.7.7/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUeiOUc=
github.com/yuin/goldmark-meta v1.1.0/go.mod h1:U4spWENafuA7Zyg+Lj5RqK/MF+ovMYtBvXi1lBb2VP0=
github.com/zclconf/go-cty v1.16.2 h1:LAJSwc3v81IRBZyUVQDUdZ7hs3SYs9jv0eZJDWHD/70=
github.com/zclconf/go-cty v1.16.2/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
github.com/zclconf/go-cty v1.16.3 h1:osr++gw2T61A8KVYHoQiFbFd1Lh3JOCXc/jFLJXKTxk=
github.com/zclconf/go-cty v1.16.3/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940 h1:4r45xpDWB6ZMSMNJFMOjqrGHynW3DIBuR2H9j0ug+Mo=
github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940/go.mod h1:CmBdvvj3nqzfzJ6nTCIwDTPZ56aVGvDrmztiO5g3qrM=
go.abhg.dev/goldmark/frontmatter v0.2.0 h1:P8kPG0YkL12+aYk2yU3xHv4tcXzeVnN+gU0tJ5JnxRw=
Expand Down
45 changes: 26 additions & 19 deletions internal/services/account/project_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package account_test

import (
"context"
"fmt"
"testing"
"time"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/hashicorp/terraform-plugin-testing/terraform"
accountSDK "github.com/scaleway/scaleway-sdk-go/api/account/v3"
Expand All @@ -12,6 +15,8 @@ import (
"github.com/scaleway/terraform-provider-scaleway/v2/internal/services/account"
)

var DestroyWaitTimeout = 3 * time.Minute

func TestAccProject_Basic(t *testing.T) {
tt := acctest.NewTestTools(t)
defer tt.Cleanup()
Expand Down Expand Up @@ -101,29 +106,31 @@ func isProjectPresent(tt *acctest.TestTools, name string) resource.TestCheckFunc
}

func isProjectDestroyed(tt *acctest.TestTools) resource.TestCheckFunc {
return func(s *terraform.State) error {
for _, rs := range s.RootModule().Resources {
if rs.Type != "scaleway_account_project" {
continue
}

accountAPI := account.NewProjectAPI(tt.Meta)
return func(state *terraform.State) error {
ctx := context.Background()
api := account.NewProjectAPI(tt.Meta)

_, err := accountAPI.GetProject(&accountSDK.ProjectAPIGetProjectRequest{
ProjectID: rs.Primary.ID,
})
return retry.RetryContext(ctx, DestroyWaitTimeout, func() *retry.RetryError {
for _, rs := range state.RootModule().Resources {
if rs.Type != "scaleway_account_project" {
continue
}

// If no error resource still exist
if err == nil {
return fmt.Errorf("resource %s(%s) still exist", rs.Type, rs.Primary.ID)
}
_, err := api.GetProject(&accountSDK.ProjectAPIGetProjectRequest{
ProjectID: rs.Primary.ID,
})

// Unexpected api error we return it
if !httperrors.Is404(err) {
return err
switch {
case err == nil:
return retry.RetryableError(fmt.Errorf("resource %s(%s) still exists", rs.Type, rs.Primary.ID))
case httperrors.Is404(err):
continue
default:
return retry.NonRetryableError(err)
}
}
}

return nil
return nil
})
}
}
Loading
Loading