CiscoDevNet / terraform-provider-dcnm

Cisco DCNM Provider
https://registry.terraform.io/providers/CiscoDevNet/dcnm/latest/docs
Mozilla Public License 2.0
8 stars 16 forks source link

DHCP values cannot be removed #86

Closed ccoueffe closed 2 years ago

ccoueffe commented 2 years ago

Community Note

Terraform Version

terraform --version Terraform v1.1.6 on linux_amd64

DCNM version

Affected Resource(s)

Terraform Configuration Files

terraform {
  required_providers {
    dcnm = {
      source = "CiscoDevNet/dcnm"
    }
  }
}

provider "dcnm" {
  # cisco-dcnm/ndfc user name
  username = var.dcnm_username
  # cisco-dcnm/ndfc password
  password = var.dcnm_password
  # cisco-dcnm/ndfc url
  url      = var.dcnm_url
  insecure = true
  platform = "nd"
}

resource "dcnm_network" "net_dhcp" {
  fabric_name     = "MSD"
  name            = "Network_DHCP"
  network_id      = "30001"
  vrf_name        = "VCF"
  vlan_id         = 42
  ir_enable_flag  = true
  ipv4_gateway    = "10.0.42.1/24"
  mtu             = 1500
  dhcp_1          = "1.2.3.4"
  dhcp_vrf        = "VRF1012"
  loopback_id     = 100

  deploy = true
  attachments {
    serial_number = "XXXXXXX"
    vlan_id       = 42
    attach        = true
    switch_ports = ["Ethernet1/10"]
  }
}

Debug Output

Expected Behavior

Detect the difference and remove the DHCP configuration

Actual Behavior

When I comment the lines for DHCP and reapply the configuration to delete the config, there is not change detected and the configuration remains.

resource "dcnm_network" "net_dhcp" {
  fabric_name     = "MSD"
  name            = "Network_DHCP"
  network_id      = "30001"
  vrf_name        = "VCF"
  vlan_id         = 42
  ir_enable_flag  = true
  ipv4_gateway    = "10.0.42.1/24"
  mtu             = 1500
#  dhcp_1          = "1.2.3.4"
#  dhcp_vrf        = "VRF1012"
#  loopback_id     = 100

  deploy = true
  attachments {
    serial_number = "SAL2005Y0FJ"
    vlan_id       = 42
    attach        = true
    switch_ports = ["Ethernet1/10"]
  }
}

Steps to Reproduce

  1. Configure Network + DHCP based on the original file
  2. Comment DHCP values
  3. terraform plan
root@253eeccb421d:/ndfc# terraform plan --out myplan.tfplan
dcnm_network.net_dhcp: Refreshing state... [id=Network_DHCP]

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.
YazhRajesh commented 2 years ago

Tested it out and the values are getting updated now.