CiscoDevNet / terraform-provider-sdwan

Terraform Cisco SD-WAN Provider
https://registry.terraform.io/providers/CiscoDevNet/sdwan
Mozilla Public License 2.0
19 stars 12 forks source link

[UX2.0] sdwan_transport_routing_bgp_profile_parcel fails with StatusCode 400 #235

Closed tzarski0 closed 5 months ago

tzarski0 commented 6 months ago

The following resource:

resource "sdwan_transport_routing_bgp_profile_parcel" "transport_routing_bgp_profile_parcel" {
    as_number                         = 65000
    description                       = "VPN 0 BGP"
    feature_profile_id                = "2b88b3c6-f6e4-4218-90bd-4c0b24b28241"
    hold_time                         = 3
    id                                = (known after apply)
    ipv4_eibgp_maximum_paths_variable = "{{vpn0_bgp_ipv4_maximum_paths}}"
    ipv4_neighbors                    = [
        {
            address_families   = [
                {
                    family_type            = "ipv4-unicast"
                    max_number_of_prefixes = 100
                    policy_type            = "warning-only"
                  },
              ]
            address_variable   = "{{vpn1_bgp_ipv4_neighbor1_address}}"
            next_hop_self      = false
            password_variable  = "{{vpn1_bgp_ipv4_neighbor1_password}}"
            remote_as_variable = "{{vpn1_bgp_ipv4_neighbor1_remote_as}}"
            shutdown_variable  = "{{vpn1_bgp_ipv4_neighbor1_shutdown}}"
          },
      ]
    ipv4_originate                    = false
    ipv4_redistributes                = [
        {
            protocol = "connected"
          },
        {
            protocol_variable = "{{vpn0_bgp_redistributes_protocol_name}}"
          },
      ]
    keepalive_time                    = 1
    name                              = "transport_bgp"
    version                           = (known after apply)
  }

fails to configure with:

│ Error: Client Error
│ 
│  500: resource "sdwan_transport_routing_bgp_profile_parcel" "transport_routing_bgp_profile_parcel" {
│ 
│ Failed to configure object (POST), got error: HTTP Request failed: StatusCode 400,
│ {"error":{"message":"Invalid Json Payload Input","code":"SCHVALID0001","details":"{\"Validation
│ Errors\":{\"Required But Missing
│ Attributes\":[\"data.neighbor[0].addressFamily[0].maxPrefixConfig.restartInterval\",\"data.neighbor[0].addressFamily[0].maxPrefixConfig.threshold\"],\"Not
│ Defined In Schema
│ Attributes\":[\"data.neighbor[0].addressFamily[0].maxPrefixConfig.prefixNum\"],\"Invalid Format
│ Attributes\":[\"data.neighbor[0].addressFamily[0].maxPrefixConfig.policyType\"]}}","type":"error"}}
seconroy commented 6 months ago

Untitled

It seems that when policy_type is equal to warning-only a threshold value is needed. We will need to figure out a way to make this more clear in the documentation as this oneOf list containing different property options was new with UX2.0 and occurs in a couple of profile parcels (mainly the transport but also some security).

tzarski0 commented 6 months ago

The UI allows for the configuration that I've shown in resource so I'm not sure why it fails in terraform:

Screenshot 2024-05-08 at 11 10 02
tzarski0 commented 5 months ago

This does not happen any more so closing it. However we have other issues with BGP parcel: https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/267 https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/233