Skip to content

Fails to create a vlan and a subnet in a single plan with DHCP_ON #53

Open
@gboutry

Description

Terraform Version

$ terraform -v
Terraform v1.4.2
on linux_amd64
+ provider registry.terraform.io/maas/maas v1.1.0

Affected Resource(s)

Please list the resources as a list, for example:

  • maas_vlan

Terraform Configuration Files

data "maas_fabric" "my_fabric" {
  name = "fabric-4"
}
resource "maas_space" "my_space" {
  name = "my-space"
}

resource "maas_vlan" "vlan1000" {
  fabric = data.maas_fabric.my_fabric.id
  vid    = 1000
  name   = "vlan-1000"
  space  = maas_space.my_space.name
  dhcp_on = true
}

resource "maas_subnet" "my_subnet" {
  cidr       = "10.244.0.0/24"
  fabric     = data.maas_fabric.my_fabric.id
  vlan       = maas_vlan.vlan1000.id
  name       = "my-subnet"
  gateway_ip = "10.244.0.1"
  dns_servers = [
    "8.8.8.8",
    "8.8.4.4"
  ]
  ip_ranges {
    type     = "dynamic"
    start_ip = "10.244.0.200"
    end_ip   = "10.244.0.254"
  }
}

Expected Behavior

Terraform's apply succeeds on the first run.

Actual Behavior

The plan fails with the following error:

│ Error: ServerError: 400 Bad Request ({"dhcp_on": ["dhcp can only be turned on when a dynamic IP range is defined."]})
│ 
│   with maas_vlan.vlan1000,
│   on main.tf line 59, in resource "maas_vlan" "vlan1000":
│   59: resource "maas_vlan" "vlan1000" {
│ 

If I set dchp_on = false, on the first apply, then to true on the second, it works.

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # maas_vlan.vlan1000 will be updated in-place
  ~ resource "maas_vlan" "vlan1000" {
      ~ dhcp_on = false -> true
        id      = "5010"
        name    = "vlan-1000"
        # (4 unchanged attributes hidden)
    }

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriagedTriaged to be addressed in a given cycle

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions