Skip to content

Resouce dcnm_interface wrongly identifies difference in the VPC members freefrom configuration #117

@jgomezve

Description

@jgomezve

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

  • v1.3.1

DCNM version

  • V 12.1.1e

Affected Resource(s)

  • dcnm_interface

Terraform Configuration Files

resource "dcnm_interface" "vpc" {
  policy                  = "int_vpc_trunk_host"
  type                    = "vpc"
  name                    = "vPC222"
  admin_state             = false
  fabric_name             = "MyFabric"
  switch_name_1           = "LF121"
  switch_name_2           = "LF122"
  vpc_peer1_id            = "222"
  vpc_peer2_id            = "222"
  mode                    = "active"
  bpdu_guard_flag         = "true"
  mtu                     = "jumbo"
  vpc_peer1_allowed_vlans = "none"
  vpc_peer2_allowed_vlans = "none"
  vpc_peer1_access_vlans  = "10"
  vpc_peer2_access_vlans  = "10"
  vpc_peer1_interface     = ["e1/5", "eth1/7"]
  vpc_peer2_interface     = ["e1/5", "eth1/7"]
  vpc_peer1_conf          = "lacp vpc-convergence\nno lacp suspend-individual"
  vpc_peer2_conf          = "lacp vpc-convergence\nno lacp suspend-individual"
}

Debug Output

The first terraform apply correctly configures the object on the NDFC. However, after executing terraform apply again, Terraform identifies a difference between the TF Execution plan and the NDFC configuration. The difference lies on the special character \n.

$ terraform apply
dcnm_interface.second: Refreshing state... [id=vPC222]

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:

  # dcnm_interface.second will be updated in-place
  ~ resource "dcnm_interface" "second" {
        id                      = "vPC222"
        name                    = "vpc222"
      ~ vpc_peer1_conf          = <<-EOT
          - lacp vpc-convergence\nno lacp suspend-individual
          + lacp vpc-convergence
          + no lacp suspend-individual
        EOT
      ~ vpc_peer2_conf          = <<-EOT
          - lacp vpc-convergence\nno lacp suspend-individual
          + lacp vpc-convergence
          + no lacp suspend-individual
        EOT
        # (21 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

This unnecessary update triggers the re-deployment of the interface, which results in an error from the NDFC API, as the interface object did not change (It is already In-Sync)

Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

dcnm_interface.second: Modifying... [id=vPC222]
╷
│ Error: interface is created but failed to deploy with error :  In-Sync In-Sync
│ 
│   with dcnm_interface.second,
│   on test.tf line 34, in resource "dcnm_interface" "second":34: resource "dcnm_interface" "second" {
│ 
╵

Expected Behavior

The second execution of the terraform apply command should not produce any change in the infrastructure

Actual Behavior

The second execution of the terraform apply command triggers an unnecessary update of the interface object

Steps to Reproduce

  1. terraform apply
  2. terraform apply

Important Factoids

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions