megaport / terraform-provider-megaport

Terraform Provider for Megaport Network
Mozilla Public License 2.0
29 stars 16 forks source link

[BUG] Private VXC | Trouble Configuring Advanced MCR Settings #156

Closed efettero closed 1 week ago

efettero commented 1 week ago

Describe the bug

We are able to get a port, MCR, and private VXC between them deployed just fine. The problem comes when we try to configure b_end_partner_config for the private VXC. I receive the following error:

Error: Error creating VXC
│ 
│   with megaport_vxc.port_to_mcr,
│   on private-vxc.tf line 1, in resource "megaport_vxc" "port_to_mcr":
│    1: resource "megaport_vxc" "port_to_mcr" {
│ 
│ Could not create VXC with name port_to_mcr: GET https://api-staging.megaport.com/v2/product/mcr2/<mcr-product-uid>/prefixLists?: 400 (trace_id
│ "a76eb6217f5781c8e3db9c19da7ab6de") Not supported service type

Terraform and Provider Version

Terraform File and Steps to Reproduce

  1. Apply the configuration below and provide values for var.MEGAPORT_ACCESS_KEY and var.MEGAPORT_SECRET_KEY. This is pointing to the Megaport Staging environment.
terraform {
  required_version = "~> 1.0"
  required_providers {
    megaport = {
      source  = "megaport/megaport"
      version = "~> 1.0"
    }
  }
}

provider "megaport" {
  environment           = "staging"
  access_key            = var.MEGAPORT_ACCESS_KEY
  secret_key            = var.MEGAPORT_SECRET_KEY
  accept_purchase_terms = true
}

variable "MEGAPORT_ACCESS_KEY" {
  type = string
}

variable "MEGAPORT_SECRET_KEY" {
  type = string
}

resource "megaport_port" "this" {
  product_name           = "wonka_industries-vfo-port-01"
  port_speed             = 10000
  location_id            = data.megaport_location.vfo.id
  contract_term_months   = 1
  marketplace_visibility = false
}

resource "megaport_mcr" "this" {
  product_name         = "wonka_industries-eqdc4-mcr-01"
  port_speed           = 10000
  location_id          = data.megaport_location.eqdc4.id
  contract_term_months = 1
  asn                  = 65010

  prefix_filter_lists = [ {
    description = "Prefix filter list"
    address_family = "IPv4"
    entries = [
      {
        action = "permit"
        prefix = "10.191.0.25/29"
        ge = 29
        le = 29
      }
    ]
  }]
}

resource "megaport_vxc" "port_to_mcr" {
  product_name         = "port_to_mcr"
  rate_limit           = 500
  contract_term_months = 1

  a_end = {
    requested_product_uid = megaport_port.this.product_uid
    ordered_vlan          = 300
  }

  b_end = {
    requested_product_uid = megaport_mcr.this.product_uid
  }

  b_end_partner_config = {
    partner = "vrouter"
    vrouter_config = {
      interfaces = [
        {
          vlan         = 300
          ip_addresses = ["10.191.0.25/29"]

          bfd = {
            tx_interval = 300
            rx_interval = 300
            multiplier  = 3
          }

          bgp_connections = [
            {
              peer_asn         = "62512"
              local_ip_address = "10.191.0.25"
              peer_ip_address  = "10.191.0.26"
              password         = "cnn6eaeaETSjvjvjvjv"
              shutdown         = false
              description      = "BGP with MED and BFD enabled"
              med_in           = 100
              med_out          = 100
              bfd_enabled      = true
              import_whitelist = null
              import_blacklist = null
              export_whitelist = null
              export_blacklist = null
              export_policy    = null
              deny_export_to   = []
              permit_export_to = []
            }
          ]

          ip_routes = [
            {
              description = "test static route 1"
              next_hop    = "10.191.0.26"
              prefix      = "10.0.0.0/24"
            }
          ]

          nat_ip_addresses = []
        }
      ]
    }
  }
}

Additional context

mega-alex commented 1 week ago

Mind giving this a shot with the latest release 1.1.8?

efettero commented 1 week ago

Hey @mega-alex, thank you once again for your quick response and work on this. 😄 I was able to get this deployed into staging successfully this morning!