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

Unable to destroy the VPC provisioned with terraform #472

Open
ghost opened this issue Aug 2, 2020 · 4 comments
Open

Unable to destroy the VPC provisioned with terraform #472

ghost opened this issue Aug 2, 2020 · 4 comments
Labels
do-api Depends on changes to the DigitalOcean API

Comments

@ghost
Copy link

ghost commented Aug 2, 2020

Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

Terraform Version

Terraform version: 0.12.29

Affected Resource(s)

Please list the resources as a list, for example:

  • digitalocean_vpc

Terraform Configuration Files

variable "do_token" {}
variable "pub_key" {}
variable "pvt_key" {}
variable "ssh_fingerprint" {}

provider "digitalocean" {
  token = var.do_token
}

resource "digitalocean_vpc" "example" {
  name     = "example-project-network"
  region   = "nyc3"
  ip_range = "10.10.10.0/24"
}

Debug Output

https://gist.github.com/outlawvik/175648e995aff182cec080ea765499b0

Panic Output

NA

Expected Behavior

Unable to delete the VPC with the destroy command

Actual Behavior

digitalocean_vpc.example: Still destroying...

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:
Create the VPC as per the guidance in the document
https://registry.terraform.io/providers/digitalocean/digitalocean/latest/docs/resources/vpc

  1. terraform plan
  2. terraform apply
  3. terraform destroy

Note: there is no problem in resource creation, only destroy has a issue.

Important Factoids

NA

References

NA

@jonathanvansina
Copy link

See your debug output line 21:

"message": "Can not delete default VPCs",

It's just as clear as this. You can't delete the default VPC.

Beside this, I don't understand why it's not possible to delete a default VPC by the API. It's logic that you can't delete a VPC with droplets (or other resources) attached to it. But if a VPC is attached to anything, it seems logic that you can delete it, even it's the default VPC.

@ghost
Copy link
Author

ghost commented Aug 3, 2020

Thanks for the review,
I already have a default VPC, the VPC I am trying to remove is not the default one, I was aware of the context
"message": "Can not delete default VPCs"
but as it was not the default one as well as its not connected to any of the resources, due to the reason I requested the issue.

@jonathanvansina
Copy link

I just did a little test with your code and I can confirm that I'm having the same issue. But I saw what happened here.
You created your first VPC for the NYC3 region, that VPC will automatically be your default VPC. And so as I mentioned that you can't delete a default VPC, Terraform will fail here (as of the API).

I repeat the same as in my previous post.. I don't understand why you can't delete a default VPC with no resources attached to it. This is not logic in this Terraform context.

@andrewsomething andrewsomething added the do-api Depends on changes to the DigitalOcean API label Aug 3, 2020
@andrewsomething
Copy link
Member

Unfortunately, this is a restriction in the DigitalOcean API, not something imposed by Terraform. There are plans to allow changing the default VPC for a region, but currently the first one created in a region is its default and the default can not be delete. I've passed this feedback along to the VPC team at DO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-api Depends on changes to the DigitalOcean API
Projects
None yet
Development

No branches or pull requests

2 participants