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

manually deleted resources give "insufficient permissions: " error #799

Closed
matti opened this issue Mar 23, 2021 · 2 comments · Fixed by #800
Closed

manually deleted resources give "insufficient permissions: " error #799

matti opened this issue Mar 23, 2021 · 2 comments · Fixed by #800

Comments

@matti
Copy link

matti commented Mar 23, 2021

I destroyed manually the scaleway_lb_ip

Terraform will perform the following actions:

  # scaleway_lb_ip.default will be destroyed
  - resource "scaleway_lb_ip" "default" {
      - id              = "fr-par/37cb79ed-a449-4991-aed5-b4a26f72c8f8" -> null
      - ip_address      = "51.159.113.60" -> null
      - lb_id           = "73104a4e-a220-4c4e-a9d1-1f42c499d9d6" -> null
      - organization_id = "29608e7b-6bbd-4f2a-9faa-75d85c13322c" -> null
      - project_id      = "29608e7b-6bbd-4f2a-9faa-75d85c13322c" -> null
      - region          = "fr-par" -> null
      - reverse         = "scw-paris-app-1.scw.supervisor.com" -> null
    }

Plan: 0 to add, 0 to change, 1 to destroy.

Changes to Outputs:

Do you really want to destroy all resources?
  Terraform will destroy all your managed infrastructure, as shown above.
  There is no undo. Only 'yes' will be accepted to confirm.

  Enter a value: yes

scaleway_lb_ip.default: Destroying... [id=fr-par/37cb79ed-a449-4991-aed5-b4a26f72c8f8]

Error: scaleway-sdk-go: insufficient permissions: write loadbalancer

but then,

$ terraform state rm scaleway_lb_ip.default
Removed scaleway_lb_ip.default
Successfully removed 1 resource instance(s).

and now when I create

  # scaleway_lb_ip.default will be created
  + resource "scaleway_lb_ip" "default" {
      + id              = (known after apply)
      + ip_address      = (known after apply)
      + lb_id           = (known after apply)
      + organization_id = (known after apply)
      + project_id      = (known after apply)
      + region          = (known after apply)
      + reverse         = "scw-paris-app-1.scw.supervisor.com"
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Changes to Outputs:
  + ip = (known after apply)

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

scaleway_lb_ip.default: Creating...
scaleway_lb_ip.default: Creation complete after 2s [id=fr-par/392d52fa-cf76-4e38-af23-10b0fe8fdc04]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

Outputs:

ip = "51.159.115.149"

and now

Terraform will perform the following actions:

  # scaleway_lb_ip.default will be destroyed
  - resource "scaleway_lb_ip" "default" {
      - id              = "fr-par/392d52fa-cf76-4e38-af23-10b0fe8fdc04" -> null
      - ip_address      = "51.159.115.149" -> null
      - organization_id = "29608e7b-6bbd-4f2a-9faa-75d85c13322c" -> null
      - project_id      = "29608e7b-6bbd-4f2a-9faa-75d85c13322c" -> null
      - region          = "fr-par" -> null
      - reverse         = "scw-paris-app-1.scw.supervisor.com" -> null
    }

Plan: 0 to add, 0 to change, 1 to destroy.

Changes to Outputs:
  - ip = "51.159.115.149" -> null

Do you really want to destroy all resources?
  Terraform will destroy all your managed infrastructure, as shown above.
  There is no undo. Only 'yes' will be accepted to confirm.

  Enter a value: yes

scaleway_lb_ip.default: Destroying... [id=fr-par/392d52fa-cf76-4e38-af23-10b0fe8fdc04]
scaleway_lb_ip.default: Destruction complete after 1s

Destroy complete! Resources: 1 destroyed.
@Sh4d1
Copy link
Contributor

Sh4d1 commented Mar 23, 2021

👋 It's not really a Terraform issue, since it's the behaviour of the LoadBalancer API...
We can either:

  • handle it in Terraform (treat a 403 a a 404 in this specific case)
  • check if we can modify the LB API behaviour

@remyleone @jerome-quere any thoughts?

@Sh4d1
Copy link
Contributor

Sh4d1 commented Mar 23, 2021

We already handle the Instance IPs with a !is404Error(err) && !is403Error(err) so I guess we can do the same here

@remyleone remyleone linked a pull request Mar 23, 2021 that will close this issue
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 a pull request may close this issue.

2 participants