gmichels / terraform-provider-adguard

Terraform provider for AdGuard
https://registry.terraform.io/providers/gmichels/adguard/latest/docs
MIT License
9 stars 4 forks source link

Changing a static dhcp lease doesn't work #63

Closed jogrie closed 9 months ago

jogrie commented 9 months ago

Hi there,

thanks for your great work.

i have a problem when changing dhcp v4 leases.

When changing the name nothing happens, but terraform always says he wants to update

          ~ static_leases = [
              - {
                  - hostname = "testlease" -> null
                  - ip       = "192.168.1.251" -> null
                  - mac      = "aa:aa:aa:aa:aa:aa" -> null
                },
              + {
                  + hostname = "testlease-new"
                  + ip       = "192.168.1.251"
                  + mac      = "aa:aa:aa:aa:aa:aa"
                },

When changing the ip - same issue - nothing happens

          ~ static_leases = [
              - {
                  - hostname = "testlease" -> null
                  - ip       = "192.168.1.251" -> null
                  - mac      = "aa:aa:aa:aa:aa:aa" -> null
                },
              + {
                  + hostname = "testlease"
                  + ip       = "192.168.1.252"
                  + mac      = "aa:aa:aa:aa:aa:aa"
                },

when changing the mac and ip

          ~ static_leases = [
              - {
                  - hostname = "testlease" -> null
                  - ip       = "192.168.1.251" -> null
                  - mac      = "aa:aa:aa:aa:aa:aa" -> null
                },
              + {
                  + hostname = "testlease"
                  + ip       = "192.168.1.252"
                  + mac      = "bb:aa:aa:aa:aa:aa"
                },
 Error: Unable to Update AdGuard Home Config
│ 
│   with adguard_config.config,
│   on dhcp.tf line 1, in resource "adguard_config" "config":
│    1: resource "adguard_config" "config" {
│ 
│ status: 400, body: dhcpv4: adding static lease: adding static lease for 192.168.1.252 (bb:aa:aa:aa:aa:aa): hostname is not unique

when changing the name and the mac

     ~ dhcp             = {
          ~ static_leases = [
              - {
                  - hostname = "testlease-newmac" -> null
                  - ip       = "192.168.1.252" -> null
                  - mac      = "bb:aa:aa:aa:aa:aa" -> null
                },
              + {
                  + hostname = "testlease"
                  + ip       = "192.168.1.252"
                  + mac      = "aa:aa:aa:aa:aa:aa"
│ Error: Unable to Update AdGuard Home Config
│ 
│   with adguard_config.config,
│   on dhcp.tf line 1, in resource "adguard_config" "config":
│    1: resource "adguard_config" "config" {
│ 
│ status: 400, body: dhcpv4: adding static lease: removing dynamic leases for 192.168.247.252 (aa:aa:aa:aa:aa:aa): static lease already
│ exists