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

No fields of any IP ranges created with the subnet resource are read into state #273

Open
tobiasdemendonca opened this issue Feb 21, 2025 · 0 comments
Labels
bug Something isn't working triaged Triaged to be addressed in a given cycle

Comments

@tobiasdemendonca
Copy link
Contributor

Creating an IP range in the resource subnet will create IPRange resources that aren't read into state when terraform refreshes. For example, running terraform apply on the following configuration:

       terraform {
           required_providers {
               maas = {
                   source  = "registry.terraform.io/canonical/maas"
                   version = "=1.0.1"
               }
           }
       }

       provider "maas" {
           api_version = "2.0"
       }

       resource "maas_space" "tf_space" {
           name = "tf-space"
       }

       resource "maas_fabric" "tf_fabric" {
           name = "tf-fabric"
       }

       resource "maas_vlan" "tf_vlan" {
           fabric = maas_fabric.tf_fabric.id
           vid    = 14
           name   = "tf-vlan14"
           space  = maas_space.tf_space.name
       }

       resource "maas_subnet" "tf_subnet" {
           cidr       = "10.88.88.0/24"
           fabric     = maas_fabric.tf_fabric.id
           vlan       = maas_vlan.tf_vlan.vid
           name       = "tf_subnet"
           gateway_ip = "10.88.88.1"
           dns_servers = [
               "1.1.1.1",
           ]
           ip_ranges {
               type     = "reserved"
               start_ip = "10.88.88.1"
               end_ip   = "10.88.88.50"
           }
           ip_ranges {
               type     = "dynamic"
               start_ip = "10.88.88.200"
               end_ip   = "10.88.88.254"
           }
       }

will create 2 IP ranges. If any of the fields comment, start_ip, or end_ip are edited in MAAS, and terraform plan is then run, terraform will not detect a change in state and the plan will be empty.

This is likely because the read function only looks at gateway_ip and dns_servers at the time of writing

@skatsaounis skatsaounis added bug Something isn't working triaged Triaged to be addressed in a given cycle labels Feb 24, 2025
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