diff --git a/vultr/resource_vultr_bare_metal_server.go b/vultr/resource_vultr_bare_metal_server.go index d1cfe883..815024da 100644 --- a/vultr/resource_vultr_bare_metal_server.go +++ b/vultr/resource_vultr_bare_metal_server.go @@ -10,7 +10,7 @@ import ( "time" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/vultr/govultr/v3" ) @@ -461,7 +461,7 @@ func bareMetalServerOSCheck(options map[string]bool) (string, error) { func waitForBareMetalServerActiveStatus(ctx context.Context, d *schema.ResourceData, meta interface{}) (interface{}, error) { log.Printf("[INFO] Waiting for bare metal server (%s) to have status of active", d.Id()) - stateConf := &resource.StateChangeConf{ //nolint:all + stateConf := &retry.StateChangeConf{ //nolint:all Pending: []string{"pending"}, Target: []string{"active"}, Refresh: newBareMetalServerStatusStateRefresh(ctx, d, meta), @@ -475,7 +475,7 @@ func waitForBareMetalServerActiveStatus(ctx context.Context, d *schema.ResourceD return stateConf.WaitForStateContext(ctx) } -func newBareMetalServerStatusStateRefresh(ctx context.Context, d *schema.ResourceData, meta interface{}) resource.StateRefreshFunc { //nolint:all +func newBareMetalServerStatusStateRefresh(ctx context.Context, d *schema.ResourceData, meta interface{}) retry.StateRefreshFunc { //nolint:all client := meta.(*Client).govultrClient() return func() (interface{}, string, error) { diff --git a/vultr/resource_vultr_block_storage.go b/vultr/resource_vultr_block_storage.go index 433dfa57..3839aee5 100644 --- a/vultr/resource_vultr_block_storage.go +++ b/vultr/resource_vultr_block_storage.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/vultr/govultr/v3" @@ -248,7 +248,7 @@ func waitForBlockAvailable(ctx context.Context, d *schema.ResourceData, target s "[INFO] Waiting for Server (%s) to have %s of %s", d.Id(), attribute, target) - stateConf := &resource.StateChangeConf{ //nolint:all + stateConf := &retry.StateChangeConf{ //nolint:all Pending: pending, Target: []string{target}, Refresh: newBlockStateRefresh(ctx, d, meta, attribute), @@ -261,7 +261,7 @@ func waitForBlockAvailable(ctx context.Context, d *schema.ResourceData, target s return stateConf.WaitForStateContext(ctx) } -func newBlockStateRefresh(ctx context.Context, d *schema.ResourceData, meta interface{}, attr string) resource.StateRefreshFunc { //nolint:all +func newBlockStateRefresh(ctx context.Context, d *schema.ResourceData, meta interface{}, attr string) retry.StateRefreshFunc { //nolint:all client := meta.(*Client).govultrClient() return func() (interface{}, string, error) { diff --git a/vultr/resource_vultr_database.go b/vultr/resource_vultr_database.go index f7b18296..8575d8ba 100644 --- a/vultr/resource_vultr_database.go +++ b/vultr/resource_vultr_database.go @@ -8,7 +8,7 @@ import ( "time" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/vultr/govultr/v3" @@ -590,7 +590,7 @@ func waitForDatabaseAvailable(ctx context.Context, d *schema.ResourceData, targe "[INFO] Waiting for Managed Database (%s) to have %s of %s", d.Id(), attribute, target) - stateConf := &resource.StateChangeConf{ // nolint:all + stateConf := &retry.StateChangeConf{ // nolint:all Pending: pending, Target: []string{target}, Refresh: newDatabaseStateRefresh(ctx, d, meta, attribute), @@ -603,7 +603,7 @@ func waitForDatabaseAvailable(ctx context.Context, d *schema.ResourceData, targe return stateConf.WaitForStateContext(ctx) } -func newDatabaseStateRefresh(ctx context.Context, d *schema.ResourceData, meta interface{}, attr string) resource.StateRefreshFunc { // nolint:all +func newDatabaseStateRefresh(ctx context.Context, d *schema.ResourceData, meta interface{}, attr string) retry.StateRefreshFunc { // nolint:all client := meta.(*Client).govultrClient() return func() (interface{}, string, error) { log.Printf("[INFO] Creating Database") diff --git a/vultr/resource_vultr_database_replica.go b/vultr/resource_vultr_database_replica.go index ef44a1b3..51231bc9 100644 --- a/vultr/resource_vultr_database_replica.go +++ b/vultr/resource_vultr_database_replica.go @@ -8,7 +8,7 @@ import ( "time" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/vultr/govultr/v3" ) @@ -279,7 +279,7 @@ func waitForDatabaseReplicaAvailable(ctx context.Context, d *schema.ResourceData "[INFO] Waiting for Managed Database read replica (%s) to have %s of %s", d.Id(), attribute, target) - stateConf := &resource.StateChangeConf{ // nolint:all + stateConf := &retry.StateChangeConf{ // nolint:all Pending: pending, Target: []string{target}, Refresh: newDatabaseReplicaStateRefresh(ctx, d, meta, attribute), @@ -292,7 +292,7 @@ func waitForDatabaseReplicaAvailable(ctx context.Context, d *schema.ResourceData return stateConf.WaitForStateContext(ctx) } -func newDatabaseReplicaStateRefresh(ctx context.Context, d *schema.ResourceData, meta interface{}, attr string) resource.StateRefreshFunc { // nolint:all +func newDatabaseReplicaStateRefresh(ctx context.Context, d *schema.ResourceData, meta interface{}, attr string) retry.StateRefreshFunc { // nolint:all client := meta.(*Client).govultrClient() return func() (interface{}, string, error) { log.Printf("[INFO] Creating Database read replica") @@ -316,7 +316,7 @@ func waitForParentBackupAvailable(ctx context.Context, d *schema.ResourceData, t "[INFO] Waiting for parent Managed Database (%s) to have %s of %s", d.Get("database_id").(string), attribute, target) - stateConf := &resource.StateChangeConf{ // nolint:all + stateConf := &retry.StateChangeConf{ // nolint:all Pending: pending, Target: []string{target}, Refresh: parentDatabaseRefresh(ctx, d, meta, attribute), @@ -329,7 +329,7 @@ func waitForParentBackupAvailable(ctx context.Context, d *schema.ResourceData, t return stateConf.WaitForStateContext(ctx) } -func parentDatabaseRefresh(ctx context.Context, d *schema.ResourceData, meta interface{}, attr string) resource.StateRefreshFunc { // nolint:all +func parentDatabaseRefresh(ctx context.Context, d *schema.ResourceData, meta interface{}, attr string) retry.StateRefreshFunc { // nolint:all client := meta.(*Client).govultrClient() return func() (interface{}, string, error) { log.Printf("[INFO] Waiting for parent Managed Database backup status") diff --git a/vultr/resource_vultr_instance.go b/vultr/resource_vultr_instance.go index c25acf44..d29daf74 100644 --- a/vultr/resource_vultr_instance.go +++ b/vultr/resource_vultr_instance.go @@ -9,7 +9,6 @@ import ( "time" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" @@ -809,7 +808,7 @@ func waitForServerAvailable(ctx context.Context, d *schema.ResourceData, target "[INFO] Waiting for Server (%s) to have %s of %s", d.Id(), attribute, target) - stateConf := &resource.StateChangeConf{ // nolint:all + stateConf := &retry.StateChangeConf{ // nolint:all Pending: pending, Target: []string{target}, Refresh: newServerStateRefresh(ctx, d, meta, attribute), @@ -822,7 +821,7 @@ func waitForServerAvailable(ctx context.Context, d *schema.ResourceData, target return stateConf.WaitForStateContext(ctx) } -func newServerStateRefresh(ctx context.Context, d *schema.ResourceData, meta interface{}, attr string) resource.StateRefreshFunc { // nolint:all +func newServerStateRefresh(ctx context.Context, d *schema.ResourceData, meta interface{}, attr string) retry.StateRefreshFunc { // nolint:all client := meta.(*Client).govultrClient() return func() (interface{}, string, error) { @@ -849,7 +848,7 @@ func waitForUpgrade(ctx context.Context, d *schema.ResourceData, target string, "[INFO] Waiting for instance (%s) to have %s of %s", d.Id(), attribute, target) - stateConf := &resource.StateChangeConf{ // nolint:all + stateConf := &retry.StateChangeConf{ // nolint:all Pending: pending, Target: []string{target}, Refresh: newInstancePlanRefresh(ctx, d, meta, attribute), @@ -862,7 +861,7 @@ func waitForUpgrade(ctx context.Context, d *schema.ResourceData, target string, return stateConf.WaitForStateContext(ctx) } -func newInstancePlanRefresh(ctx context.Context, d *schema.ResourceData, meta interface{}, attr string) resource.StateRefreshFunc { // nolint:all +func newInstancePlanRefresh(ctx context.Context, d *schema.ResourceData, meta interface{}, attr string) retry.StateRefreshFunc { // nolint:all client := meta.(*Client).govultrClient() return func() (interface{}, string, error) { log.Printf("[INFO] Upgrading instance") diff --git a/vultr/resource_vultr_iso_private.go b/vultr/resource_vultr_iso_private.go index d8a12757..2551736b 100644 --- a/vultr/resource_vultr_iso_private.go +++ b/vultr/resource_vultr_iso_private.go @@ -12,7 +12,7 @@ import ( "github.com/vultr/govultr/v3" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -183,7 +183,7 @@ func waitForIsoAvailable(ctx context.Context, d *schema.ResourceData, target str "[INFO] Waiting for ISO (%s) to have %s of %s", d.Id(), attribute, target) - stateConf := &resource.StateChangeConf{ // nolint:all + stateConf := &retry.StateChangeConf{ // nolint:all Pending: pending, Target: []string{target}, Refresh: newIsoStateRefresh(ctx, d, meta), @@ -198,7 +198,7 @@ func waitForIsoAvailable(ctx context.Context, d *schema.ResourceData, target str } func newIsoStateRefresh(ctx context.Context, - d *schema.ResourceData, meta interface{}) resource.StateRefreshFunc { // nolint:all + d *schema.ResourceData, meta interface{}) retry.StateRefreshFunc { // nolint:all client := meta.(*Client).govultrClient() return func() (interface{}, string, error) { @@ -219,7 +219,7 @@ func waitForIsoDetached(ctx context.Context, instanceID string, target string, p "[INFO] Waiting for ISO to detach from %s", instanceID) - stateConf := &resource.StateChangeConf{ // nolint:all + stateConf := &retry.StateChangeConf{ // nolint:all Pending: pending, Target: []string{target}, Refresh: isoDetachStateRefresh(ctx, instanceID, meta, attribute), @@ -232,7 +232,7 @@ func waitForIsoDetached(ctx context.Context, instanceID string, target string, p return stateConf.WaitForStateContext(ctx) } -func isoDetachStateRefresh(ctx context.Context, instanceID string, meta interface{}, attr string) resource.StateRefreshFunc { // nolint:all +func isoDetachStateRefresh(ctx context.Context, instanceID string, meta interface{}, attr string) retry.StateRefreshFunc { // nolint:all client := meta.(*Client).govultrClient() return func() (interface{}, string, error) { diff --git a/vultr/resource_vultr_kubernetes.go b/vultr/resource_vultr_kubernetes.go index 33f42ef8..500f51c6 100644 --- a/vultr/resource_vultr_kubernetes.go +++ b/vultr/resource_vultr_kubernetes.go @@ -8,7 +8,7 @@ import ( "time" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/vultr/govultr/v3" ) @@ -342,7 +342,7 @@ func waitForVKEAvailable(ctx context.Context, d *schema.ResourceData, target str "[INFO] Waiting for kubernetes cluster (%s) to have %s of %s", d.Id(), attribute, target) - stateConf := &resource.StateChangeConf{ // nolint:all + stateConf := &retry.StateChangeConf{ // nolint:all Pending: pending, Target: []string{target}, Refresh: newVKEStateRefresh(ctx, d, meta, attribute), @@ -355,7 +355,7 @@ func waitForVKEAvailable(ctx context.Context, d *schema.ResourceData, target str return stateConf.WaitForStateContext(ctx) } -func newVKEStateRefresh(ctx context.Context, d *schema.ResourceData, meta interface{}, attr string) resource.StateRefreshFunc { // nolint:all +func newVKEStateRefresh(ctx context.Context, d *schema.ResourceData, meta interface{}, attr string) retry.StateRefreshFunc { // nolint:all client := meta.(*Client).govultrClient() return func() (interface{}, string, error) { diff --git a/vultr/resource_vultr_kubernetes_nodepools.go b/vultr/resource_vultr_kubernetes_nodepools.go index ef499100..8e7f109f 100644 --- a/vultr/resource_vultr_kubernetes_nodepools.go +++ b/vultr/resource_vultr_kubernetes_nodepools.go @@ -8,7 +8,7 @@ import ( "time" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/vultr/govultr/v3" ) @@ -159,7 +159,7 @@ func waitForNodePoolAvailable(ctx context.Context, d *schema.ResourceData, targe "[INFO] Waiting for node pool (%s) to have %s of %s", d.Id(), attribute, target) - stateConf := &resource.StateChangeConf{ // nolint:all + stateConf := &retry.StateChangeConf{ // nolint:all Pending: pending, Target: []string{target}, Refresh: newNodePoolStateRefresh(ctx, d, meta, attribute), @@ -172,7 +172,7 @@ func waitForNodePoolAvailable(ctx context.Context, d *schema.ResourceData, targe return stateConf.WaitForStateContext(ctx) } -func newNodePoolStateRefresh(ctx context.Context, d *schema.ResourceData, meta interface{}, attr string) resource.StateRefreshFunc { // nolint:all +func newNodePoolStateRefresh(ctx context.Context, d *schema.ResourceData, meta interface{}, attr string) retry.StateRefreshFunc { // nolint:all client := meta.(*Client).govultrClient() return func() (interface{}, string, error) { diff --git a/vultr/resource_vultr_object_storage.go b/vultr/resource_vultr_object_storage.go index c0000959..d67e6017 100644 --- a/vultr/resource_vultr_object_storage.go +++ b/vultr/resource_vultr_object_storage.go @@ -7,7 +7,7 @@ import ( "time" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -153,7 +153,7 @@ func waitForObjAvailable(ctx context.Context, d *schema.ResourceData, target str "[INFO] Waiting for Object Storage (%s) to have %s of %s", d.Id(), attribute, target) - stateConf := &resource.StateChangeConf{ // nolint:all + stateConf := &retry.StateChangeConf{ // nolint:all Pending: pending, Target: []string{target}, Refresh: newServerObjRefresh(ctx, d, meta, attribute), @@ -166,7 +166,7 @@ func waitForObjAvailable(ctx context.Context, d *schema.ResourceData, target str return stateConf.WaitForStateContext(ctx) } -func newServerObjRefresh(ctx context.Context, d *schema.ResourceData, meta interface{}, attr string) resource.StateRefreshFunc { // nolint:all +func newServerObjRefresh(ctx context.Context, d *schema.ResourceData, meta interface{}, attr string) retry.StateRefreshFunc { // nolint:all client := meta.(*Client).govultrClient() return func() (interface{}, string, error) { log.Printf("[INFO] Creating Object Storage") diff --git a/vultr/resource_vultr_snapshot.go b/vultr/resource_vultr_snapshot.go index 2cf77963..8b3c0f2d 100644 --- a/vultr/resource_vultr_snapshot.go +++ b/vultr/resource_vultr_snapshot.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/vultr/govultr/v3" ) @@ -135,7 +135,7 @@ func waitForSnapshot(ctx context.Context, d *schema.ResourceData, target string, "[INFO] Waiting for Snapshot (%s) to have %s of %s", d.Id(), attribute, target) - stateConf := &resource.StateChangeConf{ // nolint:all + stateConf := &retry.StateChangeConf{ // nolint:all Pending: pending, Target: []string{target}, Refresh: newSnapStateRefresh(d, meta), @@ -148,7 +148,7 @@ func waitForSnapshot(ctx context.Context, d *schema.ResourceData, target string, return stateConf.WaitForStateContext(ctx) } -func newSnapStateRefresh(d *schema.ResourceData, meta interface{}) resource.StateRefreshFunc { // nolint:all +func newSnapStateRefresh(d *schema.ResourceData, meta interface{}) retry.StateRefreshFunc { // nolint:all client := meta.(*Client).govultrClient() return func() (interface{}, string, error) {