Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore block storage detach error when already detached #393

Conversation

kobajagi
Copy link
Contributor

@kobajagi kobajagi commented Nov 11, 2024

Description

Fixes a bug when block storage volume is manually detached.

Checklist

(For exoscale contributors)

  • Changelog updated (under Unreleased block)
  • Acceptance tests OK
  • For a new resource, datasource or new attributes: acceptance test added/updated

Testing

Before this change detach would throw following error:

Error: failed to detach block storage: DetachBlockStorageVolume: http response: Bad Request: Volume not attached

Now action succeeds with INFO level message notice:

2024-12-10T14:00:35.744Z [INFO]  provider.terraform-provider-exoscale: volume not attached: tf_provider_addr=registry.terraform.io/exoscale/exoscale tf_req_id=d378d4aa-41c9-48ad-6002-0ecbc3
8e3df4 tf_resource_type=exoscale_compute_instance @caller=/home/user/src/github.com/exoscale/terraform-provider-exoscale/pkg/resources/instance/resource.go:623 @module=exoscale t
f_mux_provider=tf5to6server.v5tov6Server tf_rpc=ApplyResourceChange timestamp=2024-12-10T14:00:35.744Z 

Tests are passing:

$ TF_ACC=1 go test ./... -run '^TestBlock'
?       github.com/exoscale/terraform-provider-exoscale [no test files]
?       github.com/exoscale/terraform-provider-exoscale/pkg/config      [no test files]
?       github.com/exoscale/terraform-provider-exoscale/pkg/general     [no test files]
ok      github.com/exoscale/terraform-provider-exoscale/exoscale        0.018s [no tests to run]
ok      github.com/exoscale/terraform-provider-exoscale/pkg/filter      0.005s [no tests to run]
?       github.com/exoscale/terraform-provider-exoscale/pkg/provider    [no test files]
?       github.com/exoscale/terraform-provider-exoscale/pkg/provider/config     [no test files]
ok      github.com/exoscale/terraform-provider-exoscale/pkg/list        0.025s [no tests to run]
ok      github.com/exoscale/terraform-provider-exoscale/pkg/resources/anti_affinity_group       0.033s [no tests to run]
?       github.com/exoscale/terraform-provider-exoscale/pkg/resources/zones     [no test files]
?       github.com/exoscale/terraform-provider-exoscale/pkg/sos [no test files]
?       github.com/exoscale/terraform-provider-exoscale/pkg/testutils   [no test files]
?       github.com/exoscale/terraform-provider-exoscale/pkg/utils       [no test files]
?       github.com/exoscale/terraform-provider-exoscale/pkg/validators  [no test files]
?       github.com/exoscale/terraform-provider-exoscale/pkg/version     [no test files]
?       github.com/exoscale/terraform-provider-exoscale/version [no test files]
ok      github.com/exoscale/terraform-provider-exoscale/pkg/resources/block_storage     117.245s
ok      github.com/exoscale/terraform-provider-exoscale/pkg/resources/database  0.027s [no tests to run]
ok      github.com/exoscale/terraform-provider-exoscale/pkg/resources/iam       0.023s [no tests to run]
ok      github.com/exoscale/terraform-provider-exoscale/pkg/resources/instance  0.021s [no tests to run]
ok      github.com/exoscale/terraform-provider-exoscale/pkg/resources/instance_pool     0.021s [no tests to run]
ok      github.com/exoscale/terraform-provider-exoscale/pkg/resources/nlb_service       0.024s [no tests to run]
ok      github.com/exoscale/terraform-provider-exoscale/pkg/resources/sos_bucket_policy 0.014s [no tests to run]

@kobajagi kobajagi force-pushed the predrag/sc-109157/terraform-blockstorage-volumes-are-not-refreshed branch from b76f9fe to bce4735 Compare December 10, 2024 11:27
@kobajagi kobajagi marked this pull request as ready for review December 10, 2024 14:29
Copy link
Member

@Fumesover Fumesover left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

Copy link
Member

@sauterp sauterp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks~

@kobajagi kobajagi merged commit fd3d75e into master Dec 12, 2024
2 checks passed
@kobajagi kobajagi deleted the predrag/sc-109157/terraform-blockstorage-volumes-are-not-refreshed branch December 12, 2024 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants