CiscoDevNet / terraform-provider-catalystcenter

Terraform Cisco Catalyst Center Provider
https://registry.terraform.io/providers/CiscoDevNet/catalystcenter
Mozilla Public License 2.0
8 stars 5 forks source link

Configuring Port Assignments Fails - Timeout too early? #129

Open richwats opened 2 weeks ago

richwats commented 2 weeks ago

I'm trying to use TF to configurre port assigments in my lab but I'm having a few issues. Happy to have a chat/demonstrate if anyone is interested from the BU.

resource "catalystcenter_fabric_port_assignment" "edge2" {
  fabric_id         = catalystcenter_fabric_site.lab_building.id
  network_device_id = catalystcenter_fabric_device.edge2.network_device_id
  port_assignments = [
    {
      fabric_id                  = catalystcenter_fabric_site.lab_building.id
      network_device_id          = catalystcenter_fabric_device.edge2.network_device_id
      interface_name             = "GigabitEthernet1/0/3"
      connected_device_type      = "USER_DEVICE"
      data_vlan_name             = catalystcenter_anycast_gateway.lab_hosts.vlan_name
      # voice_vlan_name            = "VOICE_VLAN"
      authenticate_template_name = "No Authentication"
    }
  ]
}

I have a couple of issues

1. When I try to configure just one port it times out after 30s, however the configuration is successfully pushed (intent updated and deployed to switch). I would have expected an option (?) on whether to deploy the intent change but it seems this resource automatically deploys the configuration change.

...
catalystcenter_fabric_port_assignment.edge2: Creating...
catalystcenter_fabric_port_assignment.edge2: Still creating... [10s elapsed]
catalystcenter_fabric_port_assignment.edge2: Still creating... [20s elapsed]
catalystcenter_fabric_port_assignment.edge2: Still creating... [30s elapsed]
╷
│ Error: Client Error
│ 
│   with catalystcenter_fabric_port_assignment.edge2,
│   on fabric.tf line 187, in resource "catalystcenter_fabric_port_assignment" "edge2":
│  187: resource "catalystcenter_fabric_port_assignment" "edge2" {
│ 
│ Failed to configure object (POST), got error: maximum waiting time for task '01922c2d-304b-735c-b8dd-1639ed76a5a0' reached,
│ {"response":{"startTime":1727318011979,"version":1727318014797,"progress":"TASK_MODIFY_PUT","data":"workflow_id=04a05070-2f3e-4ea1-b39c-91d3d9dc896f;cfs_id=4a36c9ac-1aba-4a4d-ab46-46cd1cc9ba74;rollback_status=not_supported;rollback_taskid=0;failure_task=NA;processcfs_complete=true","lastUpdate":1727318014797,"serviceType":"NCSP","isError":false,"instanceTenantId":"650c8d0249ce15355112bd69","id":"01922c2d-304b-735c-b8dd-1639ed76a5a0"},"version":"1.0"}

2. If I try to configure multiple ports in parallel, the configuration fails as the intent database / resource version is now incorrect for the 2nd and 3rd ports etc. I have also seen this behavior when configuring fabric device roles.

catalystcenter_fabric_port_assignment.edge1: Creating...
catalystcenter_fabric_port_assignment.edge2: Creating...
catalystcenter_fabric_port_assignment.edge3: Creating...
catalystcenter_fabric_port_assignment.edge3: Still creating... [10s elapsed]
catalystcenter_fabric_port_assignment.edge3: Still creating... [20s elapsed]
catalystcenter_fabric_port_assignment.edge3: Still creating... [30s elapsed]
╷
│ Error: Client Error
│ 
│   with catalystcenter_fabric_port_assignment.edge1,
│   on fabric.tf line 168, in resource "catalystcenter_fabric_port_assignment" "edge1":
│  168: resource "catalystcenter_fabric_port_assignment" "edge1" {
│ 
│ Failed to configure object (POST), got error: task '01922c1b-b4ff-7880-839e-2670883f9152' failed: TASK_MODIFY_PUT, NCSP11051: Error occurred while processing the 'modify' request. A different version of the same user intent already exists in the database.
│ Additional info for support: taskId: '01922c1b-b4ff-7880-839e-2670883f9152'. Name: 'Global/Lab_Campus/Lab_Building_Default_LAN_Fabric'. Incoming resourceVersion: '17'. resourceVersion in the database: '18'.,
│ {"response":{"startTime":1727316866303,"endTime":1727316872477,"version":1727316872477,"progress":"TASK_MODIFY_PUT","data":"workflow_id=94623876-4716-4e30-8524-538a9c909959;cfs_id=0;rollback_status=not_supported;rollback_taskid=0;failure_task=Validation of
│ business intent:728fb09a-cb2f-4db3-bbfd-11a6aa8fcc65;processcfs_complete=false","errorCode":"NCSP11051","lastUpdate":1727316872367,"serviceType":"NCSP","isError":true,"failureReason":"NCSP11051: Error occurred while processing the 'modify' request. A different
│ version of the same user intent already exists in the database. Additional info for support: taskId: '01922c1b-b4ff-7880-839e-2670883f9152'. Name: 'Global/Lab_Campus/Lab_Building_Default_LAN_Fabric'. Incoming resourceVersion: '17'. resourceVersion in the
│ database: '18'.","instanceTenantId":"650c8d0249ce15355112bd69","id":"01922c1b-b4ff-7880-839e-2670883f9152"},"version":"1.0"}
╵
╷
│ Error: Client Error
│ 
│   with catalystcenter_fabric_port_assignment.edge2,
│   on fabric.tf line 184, in resource "catalystcenter_fabric_port_assignment" "edge2":
│  184: resource "catalystcenter_fabric_port_assignment" "edge2" {
│ 
│ Failed to configure object (POST), got error: task '01922c1b-b518-70f1-bc90-921dfa4cce8f' failed: TASK_MODIFY_PUT, NCSP11051: Error occurred while processing the 'modify' request. A different version of the same user intent already exists in the database.
│ Additional info for support: taskId: '01922c1b-b518-70f1-bc90-921dfa4cce8f'. Name: 'Global/Lab_Campus/Lab_Building_Default_LAN_Fabric'. Incoming resourceVersion: '17'. resourceVersion in the database: '18'.,
│ {"response":{"startTime":1727316866328,"endTime":1727316874642,"version":1727316874642,"progress":"TASK_MODIFY_PUT","data":"workflow_id=b2e6a409-23b9-46c8-8983-e5d7c39fef34;cfs_id=0;rollback_status=not_supported;rollback_taskid=0;failure_task=Validation of
│ business intent:cb7a06b6-ccb8-419e-a8c4-84e58688e6fb;processcfs_complete=false","errorCode":"NCSP11051","lastUpdate":1727316874591,"serviceType":"NCSP","isError":true,"failureReason":"NCSP11051: Error occurred while processing the 'modify' request. A different
│ version of the same user intent already exists in the database. Additional info for support: taskId: '01922c1b-b518-70f1-bc90-921dfa4cce8f'. Name: 'Global/Lab_Campus/Lab_Building_Default_LAN_Fabric'. Incoming resourceVersion: '17'. resourceVersion in the
│ database: '18'.","instanceTenantId":"650c8d0249ce15355112bd69","id":"01922c1b-b518-70f1-bc90-921dfa4cce8f"},"version":"1.0"}
╵
╷
│ Error: Client Error
│ 
│   with catalystcenter_fabric_port_assignment.edge3,
│   on fabric.tf line 200, in resource "catalystcenter_fabric_port_assignment" "edge3":
│  200: resource "catalystcenter_fabric_port_assignment" "edge3" {
│ 
│ Failed to configure object (POST), got error: maximum waiting time for task '01922c1b-b4a9-7d76-8822-01385bc502c1' reached,
│ {"response":{"startTime":1727316866217,"version":1727316869235,"progress":"TASK_MODIFY_PUT","data":"workflow_id=38ea52ec-2947-4631-81f8-568dcc04a426;cfs_id=4a36c9ac-1aba-4a4d-ab46-46cd1cc9ba74;rollback_status=not_supported;rollback_taskid=0;failure_task=NA;processcfs_complete=true","lastUpdate":1727316869235,"serviceType":"NCSP","isError":false,"instanceTenantId":"650c8d0249ce15355112bd69","id":"01922c1b-b4a9-7d76-8822-01385bc502c1"},"version":"1.0"}
richwats commented 2 weeks ago

Terraform v1.8.3 on darwin_arm64

danischm commented 2 weeks ago

Which version of Catalyst Center is this?

richwats commented 2 weeks ago

Sorry - Catalyst Center 2.3.7

danischm commented 2 weeks ago

I have just published v0.1.12 which changes the default timeout for asynchronous operations to 60 seconds and also makes it configurable via a provider attribute. If you have a chance please test again with the updated version.

danischm commented 1 day ago

Have you had a chance to test this with the latest release?