chore: adjust pagination for postgres database and flavor listing (#20)

* feat: implement pagination for database listing

* fix: change database_id attribute type from string to int64

* refactor: rename getDatabase to getDatabaseById for clarity

* fix: improve error handling for database not found scenario

* feat: add validation for database_id and name attributes; implement separate functions for fetching databases by ID and name

* feat: implement database client interface and update database fetching functions

* refactor: rename matcher to filter for clarity and update pagination logic

* feat: implement flavors retrieval with pagination and filtering support

* refactor: rename flavor import for consistency and clarity

* feat: add support for InstanceStatePending in wait handler logic

* refactor: simplify GetFlavorsRequest and GetFlavorsRequestExecute by removing pagination parameters

* refactor: improve readability of test cases by formatting function signatures and restructuring test runs

* refactor: remove pagination parameters from GetFlavorsRequest in test case

* refactor: simplify function signatures and improve readability in datasource and resource files

* refactor: add descriptions for user-related attributes in datasource schema

* refactor: enhance user resource schema with additional attributes and improve logging

* refactor: delete unused file

* refactor: standardize formatting and improve function naming for user resource management

* refactor: remove skip from TestMapFields and update roles initialization in resource tests

* fix: golangci lint issues

* fix: golangci lint issues again

* fix: golangci lint issues again
This commit is contained in:
Andre_Harms 2026-01-16 16:23:10 +01:00 committed by GitHub
parent 0150fea302
commit 979220be66
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 3630 additions and 2759 deletions

View file

@ -54,7 +54,8 @@ func configResources(backupSchedule string, region *string) string {
if region != nil {
regionConfig = fmt.Sprintf(`region = %q`, *region)
}
return fmt.Sprintf(`
return fmt.Sprintf(
`
%s
resource "stackit_postgresflex_instance" "instance" {
@ -108,62 +109,125 @@ func configResources(backupSchedule string, region *string) string {
}
func TestAccPostgresFlexFlexResource(t *testing.T) {
resource.Test(t, resource.TestCase{
ProtoV6ProviderFactories: testutil.TestAccProtoV6ProviderFactories,
CheckDestroy: testAccCheckPostgresFlexDestroy,
Steps: []resource.TestStep{
// Creation
{
Config: configResources(instanceResource["backup_schedule"], &testutil.Region),
Check: resource.ComposeAggregateTestCheckFunc(
// Instance
resource.TestCheckResourceAttr("stackit_postgresflex_instance.instance", "project_id", instanceResource["project_id"]),
resource.TestCheckResourceAttrSet("stackit_postgresflex_instance.instance", "instance_id"),
resource.TestCheckResourceAttr("stackit_postgresflex_instance.instance", "name", instanceResource["name"]),
resource.TestCheckResourceAttr("stackit_postgresflex_instance.instance", "acl.#", "1"),
resource.TestCheckResourceAttr("stackit_postgresflex_instance.instance", "acl.0", instanceResource["acl"]),
resource.TestCheckResourceAttrSet("stackit_postgresflex_instance.instance", "flavor.id"),
resource.TestCheckResourceAttrSet("stackit_postgresflex_instance.instance", "flavor.description"),
resource.TestCheckResourceAttr("stackit_postgresflex_instance.instance", "backup_schedule", instanceResource["backup_schedule"]),
resource.TestCheckResourceAttr("stackit_postgresflex_instance.instance", "flavor.cpu", instanceResource["flavor_cpu"]),
resource.TestCheckResourceAttr("stackit_postgresflex_instance.instance", "flavor.ram", instanceResource["flavor_ram"]),
resource.TestCheckResourceAttr("stackit_postgresflex_instance.instance", "replicas", instanceResource["replicas"]),
resource.TestCheckResourceAttr("stackit_postgresflex_instance.instance", "storage.class", instanceResource["storage_class"]),
resource.TestCheckResourceAttr("stackit_postgresflex_instance.instance", "storage.size", instanceResource["storage_size"]),
resource.TestCheckResourceAttr("stackit_postgresflex_instance.instance", "version", instanceResource["version"]),
resource.TestCheckResourceAttr("stackit_postgresflex_instance.instance", "region", testutil.Region),
resource.Test(
t, resource.TestCase{
ProtoV6ProviderFactories: testutil.TestAccProtoV6ProviderFactories,
CheckDestroy: testAccCheckPostgresFlexDestroy,
Steps: []resource.TestStep{
// Creation
{
Config: configResources(instanceResource["backup_schedule"], &testutil.Region),
Check: resource.ComposeAggregateTestCheckFunc(
// Instance
resource.TestCheckResourceAttr(
"stackit_postgresflex_instance.instance",
"project_id",
instanceResource["project_id"],
),
resource.TestCheckResourceAttrSet(
"stackit_postgresflex_instance.instance",
"instance_id",
),
resource.TestCheckResourceAttr(
"stackit_postgresflex_instance.instance",
"name",
instanceResource["name"],
),
resource.TestCheckResourceAttr(
"stackit_postgresflex_instance.instance",
"acl.#",
"1",
),
resource.TestCheckResourceAttr(
"stackit_postgresflex_instance.instance",
"acl.0",
instanceResource["acl"],
),
resource.TestCheckResourceAttrSet(
"stackit_postgresflex_instance.instance",
"flavor.id",
),
resource.TestCheckResourceAttrSet(
"stackit_postgresflex_instance.instance",
"flavor.description",
),
resource.TestCheckResourceAttr(
"stackit_postgresflex_instance.instance",
"backup_schedule",
instanceResource["backup_schedule"],
),
resource.TestCheckResourceAttr(
"stackit_postgresflex_instance.instance",
"flavor.cpu",
instanceResource["flavor_cpu"],
),
resource.TestCheckResourceAttr(
"stackit_postgresflex_instance.instance",
"flavor.ram",
instanceResource["flavor_ram"],
),
resource.TestCheckResourceAttr(
"stackit_postgresflex_instance.instance",
"replicas",
instanceResource["replicas"],
),
resource.TestCheckResourceAttr(
"stackit_postgresflex_instance.instance",
"storage.class",
instanceResource["storage_class"],
),
resource.TestCheckResourceAttr(
"stackit_postgresflex_instance.instance",
"storage.size",
instanceResource["storage_size"],
),
resource.TestCheckResourceAttr(
"stackit_postgresflex_instance.instance",
"version",
instanceResource["version"],
),
resource.TestCheckResourceAttr(
"stackit_postgresflex_instance.instance",
"region",
testutil.Region,
),
// User
resource.TestCheckResourceAttrPair(
"stackit_postgresflex_user.user", "project_id",
"stackit_postgresflex_instance.instance", "project_id",
),
resource.TestCheckResourceAttrPair(
"stackit_postgresflex_user.user", "instance_id",
"stackit_postgresflex_instance.instance", "instance_id",
),
resource.TestCheckResourceAttrSet("stackit_postgresflex_user.user", "user_id"),
resource.TestCheckResourceAttrSet("stackit_postgresflex_user.user", "password"),
// User
resource.TestCheckResourceAttrPair(
"stackit_postgresflex_user.user", "project_id",
"stackit_postgresflex_instance.instance", "project_id",
),
resource.TestCheckResourceAttrPair(
"stackit_postgresflex_user.user", "instance_id",
"stackit_postgresflex_instance.instance", "instance_id",
),
resource.TestCheckResourceAttrSet("stackit_postgresflex_user.user", "user_id"),
resource.TestCheckResourceAttrSet("stackit_postgresflex_user.user", "password"),
// Database
resource.TestCheckResourceAttrPair(
"stackit_postgresflex_database.database", "project_id",
"stackit_postgresflex_instance.instance", "project_id",
// Database
resource.TestCheckResourceAttrPair(
"stackit_postgresflex_database.database", "project_id",
"stackit_postgresflex_instance.instance", "project_id",
),
resource.TestCheckResourceAttrPair(
"stackit_postgresflex_database.database", "instance_id",
"stackit_postgresflex_instance.instance", "instance_id",
),
resource.TestCheckResourceAttr(
"stackit_postgresflex_database.database",
"name",
databaseResource["name"],
),
resource.TestCheckResourceAttrPair(
"stackit_postgresflex_database.database", "owner",
"stackit_postgresflex_user.user", "username",
),
),
resource.TestCheckResourceAttrPair(
"stackit_postgresflex_database.database", "instance_id",
"stackit_postgresflex_instance.instance", "instance_id",
),
resource.TestCheckResourceAttr("stackit_postgresflex_database.database", "name", databaseResource["name"]),
resource.TestCheckResourceAttrPair(
"stackit_postgresflex_database.database", "owner",
"stackit_postgresflex_user.user", "username",
),
),
},
// data source
{
Config: fmt.Sprintf(`
},
// data source
{
Config: fmt.Sprintf(
`
%s
data "stackit_postgresflex_instance" "instance" {
@ -183,142 +247,279 @@ func TestAccPostgresFlexFlexResource(t *testing.T) {
database_id = stackit_postgresflex_database.database.database_id
}
`,
configResources(instanceResource["backup_schedule"], nil),
),
Check: resource.ComposeAggregateTestCheckFunc(
// Instance data
resource.TestCheckResourceAttr("data.stackit_postgresflex_instance.instance", "project_id", instanceResource["project_id"]),
resource.TestCheckResourceAttr("data.stackit_postgresflex_instance.instance", "name", instanceResource["name"]),
resource.TestCheckResourceAttrPair(
"data.stackit_postgresflex_instance.instance", "project_id",
"stackit_postgresflex_instance.instance", "project_id",
),
resource.TestCheckResourceAttrPair(
"data.stackit_postgresflex_instance.instance", "instance_id",
"stackit_postgresflex_instance.instance", "instance_id",
),
resource.TestCheckResourceAttrPair(
"data.stackit_postgresflex_user.user", "instance_id",
"stackit_postgresflex_user.user", "instance_id",
configResources(instanceResource["backup_schedule"], nil),
),
Check: resource.ComposeAggregateTestCheckFunc(
// Instance data
resource.TestCheckResourceAttr(
"data.stackit_postgresflex_instance.instance",
"project_id",
instanceResource["project_id"],
),
resource.TestCheckResourceAttr(
"data.stackit_postgresflex_instance.instance",
"name",
instanceResource["name"],
),
resource.TestCheckResourceAttrPair(
"data.stackit_postgresflex_instance.instance", "project_id",
"stackit_postgresflex_instance.instance", "project_id",
),
resource.TestCheckResourceAttrPair(
"data.stackit_postgresflex_instance.instance", "instance_id",
"stackit_postgresflex_instance.instance", "instance_id",
),
resource.TestCheckResourceAttrPair(
"data.stackit_postgresflex_user.user", "instance_id",
"stackit_postgresflex_user.user", "instance_id",
),
resource.TestCheckResourceAttr("data.stackit_postgresflex_instance.instance", "acl.#", "1"),
resource.TestCheckResourceAttr("data.stackit_postgresflex_instance.instance", "acl.0", instanceResource["acl"]),
resource.TestCheckResourceAttr("data.stackit_postgresflex_instance.instance", "backup_schedule", instanceResource["backup_schedule"]),
resource.TestCheckResourceAttr("data.stackit_postgresflex_instance.instance", "flavor.id", instanceResource["flavor_id"]),
resource.TestCheckResourceAttr("data.stackit_postgresflex_instance.instance", "flavor.description", instanceResource["flavor_description"]),
resource.TestCheckResourceAttr("data.stackit_postgresflex_instance.instance", "flavor.cpu", instanceResource["flavor_cpu"]),
resource.TestCheckResourceAttr("data.stackit_postgresflex_instance.instance", "flavor.ram", instanceResource["flavor_ram"]),
resource.TestCheckResourceAttr("data.stackit_postgresflex_instance.instance", "replicas", instanceResource["replicas"]),
resource.TestCheckResourceAttr(
"data.stackit_postgresflex_instance.instance",
"acl.#",
"1",
),
resource.TestCheckResourceAttr(
"data.stackit_postgresflex_instance.instance",
"acl.0",
instanceResource["acl"],
),
resource.TestCheckResourceAttr(
"data.stackit_postgresflex_instance.instance",
"backup_schedule",
instanceResource["backup_schedule"],
),
resource.TestCheckResourceAttr(
"data.stackit_postgresflex_instance.instance",
"flavor.id",
instanceResource["flavor_id"],
),
resource.TestCheckResourceAttr(
"data.stackit_postgresflex_instance.instance",
"flavor.description",
instanceResource["flavor_description"],
),
resource.TestCheckResourceAttr(
"data.stackit_postgresflex_instance.instance",
"flavor.cpu",
instanceResource["flavor_cpu"],
),
resource.TestCheckResourceAttr(
"data.stackit_postgresflex_instance.instance",
"flavor.ram",
instanceResource["flavor_ram"],
),
resource.TestCheckResourceAttr(
"data.stackit_postgresflex_instance.instance",
"replicas",
instanceResource["replicas"],
),
// User data
resource.TestCheckResourceAttr("data.stackit_postgresflex_user.user", "project_id", userResource["project_id"]),
resource.TestCheckResourceAttrSet("data.stackit_postgresflex_user.user", "user_id"),
resource.TestCheckResourceAttr("data.stackit_postgresflex_user.user", "username", userResource["username"]),
resource.TestCheckResourceAttr("data.stackit_postgresflex_user.user", "roles.#", "1"),
resource.TestCheckResourceAttr("data.stackit_postgresflex_user.user", "roles.0", userResource["role"]),
resource.TestCheckResourceAttrSet("data.stackit_postgresflex_user.user", "host"),
resource.TestCheckResourceAttrSet("data.stackit_postgresflex_user.user", "port"),
// User data
resource.TestCheckResourceAttr(
"data.stackit_postgresflex_user.user",
"project_id",
userResource["project_id"],
),
resource.TestCheckResourceAttrSet(
"data.stackit_postgresflex_user.user",
"user_id",
),
resource.TestCheckResourceAttr(
"data.stackit_postgresflex_user.user",
"username",
userResource["username"],
),
resource.TestCheckResourceAttr(
"data.stackit_postgresflex_user.user",
"roles.#",
"1",
),
resource.TestCheckResourceAttr(
"data.stackit_postgresflex_user.user",
"roles.0",
userResource["role"],
),
resource.TestCheckResourceAttrSet(
"data.stackit_postgresflex_user.user",
"host",
),
resource.TestCheckResourceAttrSet(
"data.stackit_postgresflex_user.user",
"port",
),
// Database data
resource.TestCheckResourceAttr("data.stackit_postgresflex_database.database", "project_id", instanceResource["project_id"]),
resource.TestCheckResourceAttr("data.stackit_postgresflex_database.database", "name", databaseResource["name"]),
resource.TestCheckResourceAttrPair(
"data.stackit_postgresflex_database.database", "instance_id",
"stackit_postgresflex_instance.instance", "instance_id",
// Database data
resource.TestCheckResourceAttr(
"data.stackit_postgresflex_database.database",
"project_id",
instanceResource["project_id"],
),
resource.TestCheckResourceAttr(
"data.stackit_postgresflex_database.database",
"name",
databaseResource["name"],
),
resource.TestCheckResourceAttrPair(
"data.stackit_postgresflex_database.database",
"instance_id",
"stackit_postgresflex_instance.instance",
"instance_id",
),
resource.TestCheckResourceAttrPair(
"data.stackit_postgresflex_database.database",
"owner",
"data.stackit_postgresflex_user.user",
"username",
),
),
resource.TestCheckResourceAttrPair(
"data.stackit_postgresflex_database.database", "owner",
"data.stackit_postgresflex_user.user", "username",
),
),
},
// Import
{
ResourceName: "stackit_postgresflex_instance.instance",
ImportStateIdFunc: func(s *terraform.State) (string, error) {
r, ok := s.RootModule().Resources["stackit_postgresflex_instance.instance"]
if !ok {
return "", fmt.Errorf("couldn't find resource stackit_postgresflex_instance.instance")
}
instanceId, ok := r.Primary.Attributes["instance_id"]
if !ok {
return "", fmt.Errorf("couldn't find attribute instance_id")
}
return fmt.Sprintf("%s,%s,%s", testutil.ProjectId, testutil.Region, instanceId), nil
},
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"password"},
},
{
ResourceName: "stackit_postgresflex_user.user",
ImportStateIdFunc: func(s *terraform.State) (string, error) {
r, ok := s.RootModule().Resources["stackit_postgresflex_user.user"]
if !ok {
return "", fmt.Errorf("couldn't find resource stackit_postgresflex_user.user")
}
instanceId, ok := r.Primary.Attributes["instance_id"]
if !ok {
return "", fmt.Errorf("couldn't find attribute instance_id")
}
userId, ok := r.Primary.Attributes["user_id"]
if !ok {
return "", fmt.Errorf("couldn't find attribute user_id")
}
// Import
{
ResourceName: "stackit_postgresflex_instance.instance",
ImportStateIdFunc: func(s *terraform.State) (string, error) {
r, ok := s.RootModule().Resources["stackit_postgresflex_instance.instance"]
if !ok {
return "", fmt.Errorf("couldn't find resource stackit_postgresflex_instance.instance")
}
instanceId, ok := r.Primary.Attributes["instance_id"]
if !ok {
return "", fmt.Errorf("couldn't find attribute instance_id")
}
return fmt.Sprintf("%s,%s,%s,%s", testutil.ProjectId, testutil.Region, instanceId, userId), nil
return fmt.Sprintf("%s,%s,%s", testutil.ProjectId, testutil.Region, instanceId), nil
},
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"password"},
},
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"password", "uri"},
},
{
ResourceName: "stackit_postgresflex_database.database",
ImportStateIdFunc: func(s *terraform.State) (string, error) {
r, ok := s.RootModule().Resources["stackit_postgresflex_database.database"]
if !ok {
return "", fmt.Errorf("couldn't find resource stackit_postgresflex_database.database")
}
instanceId, ok := r.Primary.Attributes["instance_id"]
if !ok {
return "", fmt.Errorf("couldn't find attribute instance_id")
}
databaseId, ok := r.Primary.Attributes["database_id"]
if !ok {
return "", fmt.Errorf("couldn't find attribute database_id")
}
{
ResourceName: "stackit_postgresflex_user.user",
ImportStateIdFunc: func(s *terraform.State) (string, error) {
r, ok := s.RootModule().Resources["stackit_postgresflex_user.user"]
if !ok {
return "", fmt.Errorf("couldn't find resource stackit_postgresflex_user.user")
}
instanceId, ok := r.Primary.Attributes["instance_id"]
if !ok {
return "", fmt.Errorf("couldn't find attribute instance_id")
}
userId, ok := r.Primary.Attributes["user_id"]
if !ok {
return "", fmt.Errorf("couldn't find attribute user_id")
}
return fmt.Sprintf("%s,%s,%s,%s", testutil.ProjectId, testutil.Region, instanceId, databaseId), nil
return fmt.Sprintf("%s,%s,%s,%s", testutil.ProjectId, testutil.Region, instanceId, userId), nil
},
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"password", "uri"},
},
ImportState: true,
ImportStateVerify: true,
{
ResourceName: "stackit_postgresflex_database.database",
ImportStateIdFunc: func(s *terraform.State) (string, error) {
r, ok := s.RootModule().Resources["stackit_postgresflex_database.database"]
if !ok {
return "", fmt.Errorf("couldn't find resource stackit_postgresflex_database.database")
}
instanceId, ok := r.Primary.Attributes["instance_id"]
if !ok {
return "", fmt.Errorf("couldn't find attribute instance_id")
}
databaseId, ok := r.Primary.Attributes["database_id"]
if !ok {
return "", fmt.Errorf("couldn't find attribute database_id")
}
return fmt.Sprintf(
"%s,%s,%s,%s",
testutil.ProjectId,
testutil.Region,
instanceId,
databaseId,
), nil
},
ImportState: true,
ImportStateVerify: true,
},
// Update
{
Config: configResources(instanceResource["backup_schedule_updated"], nil),
Check: resource.ComposeAggregateTestCheckFunc(
// Instance data
resource.TestCheckResourceAttr(
"stackit_postgresflex_instance.instance",
"project_id",
instanceResource["project_id"],
),
resource.TestCheckResourceAttrSet(
"stackit_postgresflex_instance.instance",
"instance_id",
),
resource.TestCheckResourceAttr(
"stackit_postgresflex_instance.instance",
"name",
instanceResource["name"],
),
resource.TestCheckResourceAttr(
"stackit_postgresflex_instance.instance",
"acl.#",
"1",
),
resource.TestCheckResourceAttr(
"stackit_postgresflex_instance.instance",
"acl.0",
instanceResource["acl"],
),
resource.TestCheckResourceAttr(
"stackit_postgresflex_instance.instance",
"backup_schedule",
instanceResource["backup_schedule_updated"],
),
resource.TestCheckResourceAttrSet(
"stackit_postgresflex_instance.instance",
"flavor.id",
),
resource.TestCheckResourceAttrSet(
"stackit_postgresflex_instance.instance",
"flavor.description",
),
resource.TestCheckResourceAttr(
"stackit_postgresflex_instance.instance",
"flavor.cpu",
instanceResource["flavor_cpu"],
),
resource.TestCheckResourceAttr(
"stackit_postgresflex_instance.instance",
"flavor.ram",
instanceResource["flavor_ram"],
),
resource.TestCheckResourceAttr(
"stackit_postgresflex_instance.instance",
"replicas",
instanceResource["replicas"],
),
resource.TestCheckResourceAttr(
"stackit_postgresflex_instance.instance",
"storage.class",
instanceResource["storage_class"],
),
resource.TestCheckResourceAttr(
"stackit_postgresflex_instance.instance",
"storage.size",
instanceResource["storage_size"],
),
resource.TestCheckResourceAttr(
"stackit_postgresflex_instance.instance",
"version",
instanceResource["version"],
),
),
},
// Deletion is done by the framework implicitly
},
// Update
{
Config: configResources(instanceResource["backup_schedule_updated"], nil),
Check: resource.ComposeAggregateTestCheckFunc(
// Instance data
resource.TestCheckResourceAttr("stackit_postgresflex_instance.instance", "project_id", instanceResource["project_id"]),
resource.TestCheckResourceAttrSet("stackit_postgresflex_instance.instance", "instance_id"),
resource.TestCheckResourceAttr("stackit_postgresflex_instance.instance", "name", instanceResource["name"]),
resource.TestCheckResourceAttr("stackit_postgresflex_instance.instance", "acl.#", "1"),
resource.TestCheckResourceAttr("stackit_postgresflex_instance.instance", "acl.0", instanceResource["acl"]),
resource.TestCheckResourceAttr("stackit_postgresflex_instance.instance", "backup_schedule", instanceResource["backup_schedule_updated"]),
resource.TestCheckResourceAttrSet("stackit_postgresflex_instance.instance", "flavor.id"),
resource.TestCheckResourceAttrSet("stackit_postgresflex_instance.instance", "flavor.description"),
resource.TestCheckResourceAttr("stackit_postgresflex_instance.instance", "flavor.cpu", instanceResource["flavor_cpu"]),
resource.TestCheckResourceAttr("stackit_postgresflex_instance.instance", "flavor.ram", instanceResource["flavor_ram"]),
resource.TestCheckResourceAttr("stackit_postgresflex_instance.instance", "replicas", instanceResource["replicas"]),
resource.TestCheckResourceAttr("stackit_postgresflex_instance.instance", "storage.class", instanceResource["storage_class"]),
resource.TestCheckResourceAttr("stackit_postgresflex_instance.instance", "storage.size", instanceResource["storage_size"]),
resource.TestCheckResourceAttr("stackit_postgresflex_instance.instance", "version", instanceResource["version"]),
),
},
// Deletion is done by the framework implicitly
},
})
)
}
func testAccCheckPostgresFlexDestroy(s *terraform.State) error {
@ -358,15 +559,10 @@ func testAccCheckPostgresFlexDestroy(s *terraform.State) error {
}
if utils.Contains(instancesToDestroy, *items[i].Id) {
// TODO @mhenselin - does force still exist?
// err := client.ForceDeleteInstanceExecute(ctx, testutil.ProjectId, testutil.Region, *items[i].Id)
err := client.DeleteInstanceRequestExecute(ctx, testutil.ProjectId, testutil.Region, *items[i].Id)
if err != nil {
return fmt.Errorf("deleting instance %s during CheckDestroy: %w", *items[i].Id, err)
}
//_, err = wait.DeleteInstanceWaitHandler(ctx, client, testutil.ProjectId, testutil.Region, *items[i].Id).WaitWithContext(ctx)
//if err != nil {
// return fmt.Errorf("deleting instance %s during CheckDestroy: waiting for deletion %w", *items[i].Id, err)
//}
}
}
return nil