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

Cannot delete subnets with DHCP in them #167

Open
sempervictus opened this issue Apr 3, 2024 · 2 comments
Open

Cannot delete subnets with DHCP in them #167

sempervictus opened this issue Apr 3, 2024 · 2 comments
Labels
bug Something isn't working triaged Triaged to be addressed in a given cycle

Comments

@sempervictus
Copy link

│ Error: ServerError: 400 Bad Request (Cannot delete a subnet that is actively servicing a dynamic IP range. (Delete the dynamic range or disable DHCP first.))

Given that the IP ranges are embedded in the subnet resource block, seems they should be cleaned up automatically as a matter of dependency

@skatsaounis skatsaounis added bug Something isn't working triaged Triaged to be addressed in a given cycle labels Apr 11, 2024
@skatsaounis
Copy link
Collaborator

Hi @sempervictus,

Thank you for opening this one. It is a valid bug. In the meantime, could you please switch to the usage of maas_subnet_ip_range? I am recommending that for two reasons:

  1. The dependency will be managed in a better by Terraform. Plus you will workaround this bug:
resource "maas_fabric" "tf_fabric" {
  name = "tf-fabric"
}

resource "maas_subnet" "tf_subnet" {
  cidr       = "10.77.77.0/24"
  name       = "tf_subnet"
  fabric     = maas_fabric.tf_fabric.id
  gateway_ip = "10.77.77.1"
  dns_servers = [
    "1.1.1.1",
  ]
}

resource "maas_subnet_ip_range" "dynamic_ip_range" {
  subnet   = maas_subnet.tf_subnet.id
  type     = "dynamic"
  start_ip = "10.77.77.2"
  end_ip   = "10.77.77.60"
}
  1. We are thinking of removing entirely the management of ip ranges as a nested block of maas_subnet. It will be a breaking change but for a good reason. It will also help with the bug fix of: Fails to create a vlan and a subnet in a single plan with DHCP_ON #53. Finally, if you follow the maas_subnet_ip_range you will be better prepared for this change.

What are your thoughts? Can you give it a try and let me know if it helped you workaround the issue you are facing?

@sempervictus
Copy link
Author

The maas subnet ip range thing seems to work except for the fact that a VLAN needs to first be created with DHCP enabled then have the subnet with which the ip range associates bound afterward (like in a separate TF run) - MaaS API's oddities seem to confuse TF's perception of state between actions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triaged Triaged to be addressed in a given cycle
Projects
None yet
Development

No branches or pull requests

2 participants