Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Not possible to set custom vlan id on megaport_vxc b_end #167

Open
Kostoprav19 opened this issue Oct 3, 2024 · 14 comments
Open

[BUG] Not possible to set custom vlan id on megaport_vxc b_end #167

Kostoprav19 opened this issue Oct 3, 2024 · 14 comments
Labels
bug Something isn't working

Comments

@Kostoprav19
Copy link

Kostoprav19 commented Oct 3, 2024

Describe the bug
It is not possible to set custom vlan id on megaport_vxc resource  b_end, which is connected to megaport_port. While a_end (connected to megaport_mve) vlan id can be changes without problems using "inner_vlan" variable.

Manually, in Megaport Portal, we can successfully adjust vlan id.

We have tried to use 3 variables: vlan, inner_vlan, and ordered_vlan without success.

When we tried to set using vlan, I got error message:

│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to megaport_vxc.ipxgrx[0], provider "provider[\"registry.terraform.io/megaport/megaport\"]" produced an unexpected new value: .b_end.vlan: was cty.NumberIntVal(300), but now cty.NumberIntVal(2081).
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

When using inner_vlan, and ordered_vlan - terraform reports that there are no changes to apply.

Terraform and Provider Version
terraform-provider-megaport version is v1.2.0
terraform version is v1.5.4

Terraform File and Steps to Reproduce

# Virtual Cross Connect (VXC) to IPX/GRX Port
resource "megaport_vxc" "ipxgrx" {

 product_name         = "${var.name_prefix}-IPXGRX-VXC"
 rate_limit           = 100
 contract_term_months = 1

 a_end = {
   requested_product_uid = megaport_mve.fortigate.product_uid
   vnic_index            = 1
   inner_vlan            = 100
 }

 b_end = {
   requested_product_uid = megaport_port.ipxgrx.product_uid
   odered_vlan           = 300
 }
}
@Kostoprav19 Kostoprav19 added the bug Something isn't working label Oct 3, 2024
@MegaportPhilipBrowne
Copy link
Collaborator

MegaportPhilipBrowne commented Oct 3, 2024

Hello - thanks for reaching out about this. Just to clarify, is this an issue when creating the VXC, updating the VXC, or both?

We were able to successfully create an MVE to Port VXC with a b_end vlan of 300 just now by assigning the ordered_vlan to 300.

In cases where the VLAN ID (ordered_vlan) is not available in that end configuration, our API will re-assign to an available value. We are currently working on adding improvements to the provider where we will be able to check if the requested VLAN ID is available prior to creation, and hope to have that released in the coming days.

You should be able to update a MVE to Port VXC under this configuration with no assigned b_end VLAN upon creation by adding the ordered_vlan field when updating. We just tested this with a b_end ordered_vlan of 300 on update with no issues in an MVE to Port VXC.

If possible, could you provide a little more clarification on the configuration of the port and MVE?

@Kostoprav19
Copy link
Author

Kostoprav19 commented Oct 3, 2024

Hello! Thank you quick reply.

The issue is when i do both - create and update.

Let me emphasize that in my config b_end i towards Megaport Port, not MVE. With vlan towards MVE I also have no issues.

When I create from scratch i see in plan that provider even not try to assign ordered_vlan = 300 for b_end, but for a_end inner_vlan is being assigned correctly in plan.

# megaport_vxc.ipxgrx[0] will be created
  + resource "megaport_vxc" "ipxgrx" {
      + a_end                = {
          + current_product_uid   = (known after apply)
          + inner_vlan            = 200               <------------------- OK
          + location              = (known after apply)
          + location_id           = (known after apply)
          + ordered_vlan          = (known after apply)
          + owner_uid             = (known after apply)
          + product_name          = (known after apply)
          + requested_product_uid = (known after apply)
          + secondary_name        = (known after apply)
          + vlan                  = (known after apply)
          + vnic_index            = 1
        }
      + admin_locked         = (known after apply)
      + attribute_tags       = (known after apply)
      + b_end                = {
          + current_product_uid   = (known after apply)
          + inner_vlan            = (known after apply)
          + location              = (known after apply)
          + location_id           = (known after apply)
          + ordered_vlan          = (known after apply)     <------------- Not even tried
          + owner_uid             = (known after apply)
          + product_name          = (known after apply)
          + requested_product_uid = (known after apply)
          + secondary_name        = (known after apply)
          + vlan                  = (known after apply)
          + vnic_index            = (known after apply)
        }
      + cancelable           = (known after apply)
      + company_name         = (known after apply)
      + company_uid          = (known after apply)
      + contract_end_date    = (known after apply)
      + contract_start_date  = (known after apply)
      + contract_term_months = 1
      + cost_centre          = "A-1019-2024-GER -230-1012"
      + create_date          = (known after apply)
      + created_by           = (known after apply)
      + csp_connections      = (known after apply)
      + distance_band        = (known after apply)
      + last_updated         = (known after apply)
      + live_date            = (known after apply)
      + locked               = (known after apply)
      + product_id           = (known after apply)
      + product_name         = "TEST-LBO-EU-Frankfurt-ICSS-IPXGRX-VXC"
      + product_type         = (known after apply)
      + product_uid          = (known after apply)
      + provisioning_status  = (known after apply)
      + rate_limit           = 100
      + secondary_name       = (known after apply)
      + service_id           = (known after apply)
      + shutdown             = (known after apply)
      + usage_algorithm      = (known after apply)

Code:

# Virtual Cross Connect (VXC) to IPX/GRX Port
resource "megaport_vxc" "ipxgrx" {

 product_name         = "${var.name_prefix}-IPXGRX-VXC"
 rate_limit           = 100
 contract_term_months = 1

 a_end = {
   requested_product_uid = megaport_mve.fortigate.product_uid
   vnic_index            = 1
   inner_vlan            = 100
 }

 b_end = {
   requested_product_uid = megaport_port.ipxgrx.product_uid  <----
   odered_vlan           = 300  <----
 }
}

@MegaportPhilipBrowne
Copy link
Collaborator

Thanks for this - could you please also provide a little more info on the port you are attempting to assign the VLAN to in the VXC?

@MegaportPhilipBrowne
Copy link
Collaborator

Just a heads up - in the example you provided, the b_end config has odered_vlan instead of ordered_vlan which may be the reason that the provider is not attempting to set the b_end vlan. Could you try checking if fixing this resolves the issue? We just deployed a MVE to Port VXC on our end with the b_end ordered_vlan of 300 on the port side with no problems.

@Kostoprav19
Copy link
Author

Thank you, my fault! Now everything works fine

@MegaportPhilipBrowne
Copy link
Collaborator

No problem, glad everything works and thanks for reaching out!

@Kostoprav19
Copy link
Author

Kostoprav19 commented Oct 4, 2024

Hi, Sorry for reopening this issue. Despite successful test on Staging, in Production environment I have issues to update b_end ordered_vlan for VXC plugged to Megaport Port.

Can you take a look. VXC ID = 1ddbdae4

Terraform plan:

Terraform will perform the following actions:
  # module.megaport-lbo.megaport_vxc.ipxgrx[0] will be updated in-place
  ~ resource "megaport_vxc" "ipxgrx" {
      ~ a_end                = {
          ~ current_product_uid   = "9bcebf3c-2d3a-43a2-9bd3-21fb588ceda6" -> (known after apply)
          ~ location              = "Equinix PA2/3" -> (known after apply)
          ~ location_id           = 515 -> (known after apply)
          + ordered_vlan          = (known after apply)
          ~ product_name          = "LBO-EU-Paris-ICSS-MVE" -> (known after apply)
          ~ vlan                  = 821 -> (known after apply)
            # (5 unchanged attributes hidden)
        }
      ~ b_end                = {
          ~ current_product_uid   = "91a9f364-46d1-404d-b459-b459e3e2cfa1" -> (known after apply)
          + inner_vlan            = (known after apply)
          ~ location              = "Equinix PA2/3" -> (known after apply)
          ~ location_id           = 515 -> (known after apply)
          + ordered_vlan          = [100](https://gitlab.com/1nce-tech/platform/base-services/infra/terraform/external-network/megaport/-/jobs/7992762747#L100)
          ~ product_name          = "LBO-EU-Paris-ICSS-Port" -> (known after apply)
          ~ vlan                  = 100 -> (known after apply)
            # (4 unchanged attributes hidden)
        }
      ~ contract_end_date    = "Saturday, 26-Oct-24 14:00:00 UTC" -> (known after apply)
      ~ contract_start_date  = "Thursday, 26-Sep-24 14:22:30 UTC" -> (known after apply)
      ~ create_date          = "Thursday, 26-Sep-24 14:10:34 UTC" -> (known after apply)
      + csp_connections      = (known after apply)
      ~ last_updated         = "Friday, 04-Oct-24 07:38:02 UTC" -> (known after apply)
      ~ live_date            = "Thursday, 26-Sep-24 14:22:30 UTC" -> (known after apply)
      ~ provisioning_status  = "LIVE" -> (known after apply)
        # (19 unchanged attributes hidden)
    }
Plan: 0 to add, 1 to change, 0 to destroy.

Terraform apply:

module.megaport-lbo.megaport_vxc.ipxgrx[0]: Still modifying... [30s elapsed]
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to module.megaport-lbo.megaport_vxc.ipxgrx[0],
│ provider
│ "module.megaport-lbo.provider[\"registry.terraform.io/megaport/megaport\"]"
│ produced an unexpected new value: .b_end.ordered_vlan: was
│ cty.NumberIntVal(100), but now null.
│ 
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.
╵

@MegaportPhilipBrowne
Copy link
Collaborator

Just to clarify - what is the initial configuration and desired configuration upon update for this VXC update? Are you attempting to change the b_end ordered_vlan from something unspecified to a specified value?

@mega-alex
Copy link
Collaborator

+ ordered_vlan          = [100](https://gitlab.com/1nce-tech/platform/base-services/infra/terraform/external-network/megaport/-/jobs/7992762747#L100)

Could we also get some clarification on how this is being set?

@Kostoprav19
Copy link
Author

Hi!

Regarding the plan issue - not sure where it comes from. Most likely copy paste issue. I have rerun plan and now I don't have it.

Regarding your question - yes I am trying to change b_end ordered_vlan from unspecified (in previous Terraform code version) to a specified value. But in Megaport portal I already did changed that value. So I expected to see "No changes" situation.

Plan:

Terraform will perform the following actions:
  # module.megaport-lbo.megaport_vxc.ipxgrx[0] will be updated in-place
  ~ resource "megaport_vxc" "ipxgrx" {
      ~ a_end                = {
          ~ current_product_uid   = "9bcebf3c-2d3a-43a2-9bd3-21fb588ceda6" -> (known after apply)
          ~ location              = "Equinix PA2/3" -> (known after apply)
          ~ location_id           = 515 -> (known after apply)
          + ordered_vlan          = (known after apply)
          ~ product_name          = "LBO-EU-Paris-ICSS-MVE" -> (known after apply)
          ~ vlan                  = 821 -> (known after apply)
            # (5 unchanged attributes hidden)
        }
      ~ b_end                = {
          ~ current_product_uid   = "[91](https://gitlab.com/1nce-tech/platform/base-services/infra/terraform/external-network/megaport/-/jobs/8024269503#L91)a9f364-46d1-404d-b459-b459e3e2cfa1" -> (known after apply)
          + inner_vlan            = (known after apply)
          ~ location              = "Equinix PA2/3" -> (known after apply)
          ~ location_id           = 515 -> (known after apply)
          + ordered_vlan          = 100
          ~ product_name          = "LBO-EU-Paris-ICSS-Port" -> (known after apply)
          ~ vlan                  = [100](https://gitlab.com/1nce-tech/platform/base-services/infra/terraform/external-network/megaport/-/jobs/8024269503#L100) -> (known after apply)
            # (4 unchanged attributes hidden)
        }
      ~ contract_end_date    = "Saturday, 26-Oct-24 14:00:00 UTC" -> (known after apply)
      ~ contract_start_date  = "Thursday, 26-Sep-24 14:22:30 UTC" -> (known after apply)
      ~ create_date          = "Thursday, 26-Sep-24 14:10:34 UTC" -> (known after apply)
      + csp_connections      = (known after apply)
      ~ last_updated         = "Friday, 04-Oct-24 07:40:27 UTC" -> (known after apply)
      ~ live_date            = "Thursday, 26-Sep-24 14:22:30 UTC" -> (known after apply)
      ~ provisioning_status  = "LIVE" -> (known after apply)
        # (19 unchanged attributes hidden)
    }
Plan: 0 to add, 1 to change, 0 to destroy.

Apply

$ terraform apply -input=false tf.plan
module.megaport-lbo.megaport_vxc.ipxgrx[0]: Modifying...
module.megaport-lbo.megaport_vxc.ipxgrx[0]: Still modifying... [10s elapsed]
module.megaport-lbo.megaport_vxc.ipxgrx[0]: Still modifying... [20s elapsed]
module.megaport-lbo.megaport_vxc.ipxgrx[0]: Still modifying... [30s elapsed]
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to module.megaport-lbo.megaport_vxc.ipxgrx[0],
│ provider
│ "module.megaport-lbo.provider[\"registry.terraform.io/megaport/megaport\"]"
│ produced an unexpected new value: .b_end.ordered_vlan: was
│ cty.NumberIntVal(100), but now null.
│ 
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.

@MegaportPhilipBrowne
Copy link
Collaborator

Thanks for pointing this out, we're working on a fix.

@Kostoprav19
Copy link
Author

Hello! Any ETA for the fix?

@MegaportPhilipBrowne
Copy link
Collaborator

We're hoping to get a release out that addresses this issue hopefully within the next several days. Thank you for your patience!

@Kostoprav19
Copy link
Author

Hello! Is v1.2.1 is intended to fix this issue? I have just tested and see littlebit different issue

Plan:

Terraform will perform the following actions:
  # module.megaport-lbo.megaport_vxc.aws[0] will be updated in-place
  ~ resource "megaport_vxc" "aws" {
      ~ a_end                = {
          ~ current_product_uid   = "0a6f30e9-80ea-4dff-9d71-c874d3757067" -> (known after apply)
          ~ location              = "Digital Realty Interxion FRA6" -> (known after apply)
          ~ location_id           = 130 -> (known after apply)
          + ordered_vlan          = (known after apply)
          ~ product_name          = "LBO-EU-Frankfurt-ICSS-MVE" -> (known after apply)
          ~ vlan                  = 2640 -> (known after apply)
            # (5 unchanged attributes hidden)
        }
      ~ b_end                = {
          ~ current_product_uid   = "4348e355-5e76-470b-988b-ac245c4[86](https://gitlab.com/1nce-tech/platform/base-services/infra/terraform/external-network/megaport/-/jobs/8292582675#L86)63b" -> (known after apply)
          + inner_vlan            = (known after apply)
          ~ location              = "Digital Realty Interxion FRA6" -> (known after apply)
          ~ location_id           = 130 -> (known after apply)
          + ordered_vlan          = (known after apply)
          ~ product_name          = "EU (Frankfurt) (eu-central-1)" -> (known after apply)
          ~ requested_product_uid = "4348e355-5e76-470b-988b-ac245c48663b" -> "5ec445b7-6e15-4638-a2d7-8b9ab6ab0e62"
          ~ vlan                  = 2640 -> (known after apply)
            # (3 unchanged attributes hidden)
        }
      ~ contract_end_date    = "Friday, 30-Aug-24 14:00:00 UTC" -> (known after apply)
      ~ contract_start_date  = "Wednesday, 31-Jul-24 09:19:24 UTC" -> (known after apply)
      ~ create_date          = "Wednesday, 31-Jul-24 09:17:45 UTC" -> (known after apply)
      ~ last_updated         = "Wednesday, 31-Jul-24 09:19:48 UTC" -> (known after apply)
      ~ live_date            = "Wednesday, 31-Jul-24 09:19:24 UTC" -> (known after apply)
      ~ provisioning_status  = "LIVE" -> (known after apply)
        # (20 unchanged attributes hidden)
    }
  # module.megaport-lbo.megaport_vxc.ipxgrx[0] will be updated in-place
  ~ resource "megaport_vxc" "ipxgrx" {
      ~ a_end                = {
          ~ current_product_uid   = "0a6f30e9-80ea-4dff-9d71-c[87](https://gitlab.com/1nce-tech/platform/base-services/infra/terraform/external-network/megaport/-/jobs/8292582675#L87)4d3757067" -> (known after apply)
          ~ location              = "Digital Realty Interxion FRA6" -> (known after apply)
          ~ location_id           = 130 -> (known after apply)
          ~ product_name          = "LBO-EU-Frankfurt-ICSS-MVE" -> (known after apply)
          ~ vlan                  = 996 -> (known after apply)
            # (6 unchanged attributes hidden)
        }
      ~ b_end                = {
          ~ current_product_uid   = "fcda5cfe-c42f-4abb-8bab-2da65624e4ff" -> (known after apply)
          + inner_vlan            = (known after apply)
          ~ location              = "Digital Realty Interxion FRA6" -> (known after apply)
          ~ location_id           = 130 -> (known after apply)
          ~ ordered_vlan          = 0 -> [100](https://gitlab.com/1nce-tech/platform/base-services/infra/terraform/external-network/megaport/-/jobs/8292582675#L100)
          ~ product_name          = "LBO-EU-Frankfurt-ICSS-Port" -> (known after apply)
          ~ vlan                  = 100 -> (known after apply)
            # (4 unchanged attributes hidden)
        }
      ~ contract_end_date    = "Friday, 19-Jul-24 14:00:00 UTC" -> (known after apply)
      ~ contract_start_date  = "Thursday, 04-Jul-24 16:05:00 UTC" -> (known after apply)
      ~ create_date          = "Thursday, 20-Jun-24 10:26:33 UTC" -> (known after apply)
      + csp_connections      = (known after apply)
      ~ last_updated         = "Thursday, 20-Jun-24 10:28:06 UTC" -> (known after apply)
      ~ live_date            = "Thursday, 22-Aug-24 14:22:36 UTC" -> (known after apply)
      ~ provisioning_status  = "LIVE" -> (known after apply)
        # (19 unchanged attributes hidden)
    }
Plan: 0 to add, 2 to change, 0 to destroy.

Apply:

module.megaport-lbo.megaport_vxc.aws[0]: Modifying...
╷
│ Error: Error Updating VXC
│ 
│   with module.megaport-lbo.megaport_vxc.ipxgrx[0],
│   on .terraform/modules/megaport-lbo/main.tf line 67, in resource "megaport_vxc" "ipxgrx":
│   67: resource "megaport_vxc" "ipxgrx" {
│ 
│ Could not update VXC with ID 49a7be28-2148-4887-924b-9e089d007bb4: PUT
│ https://api.megaport.com/v3/product/vxc/49a7be28-2148-4887-924b-9e089d007bb4:
│ 400 (trace_id "b43de0b44f25615362f1e736a0d384b8") VRouter: VXC VLAN does
│ not match any vNIC, Validation of csp_request failed 
╵
╷
│ Error: Error Updating VXC
│ 
│   with module.megaport-lbo.megaport_vxc.aws[0],
│   on .terraform/modules/megaport-lbo/main.tf line 89, in resource "megaport_vxc" "aws":
│   89: resource "megaport_vxc" "aws" {
│ 
│ Could not update VXC with ID 94d49d6e-c166-423f-a5f0-59[72](https://gitlab.com/1nce-tech/platform/base-services/infra/terraform/external-network/megaport/-/jobs/8292582678#L72)b15cda6c: PUT
│ https://api.megaport.com/v3/product/vxc/94d49d6e-c166-423f-a5f0-5972b15cda6c:
│ 400 (trace_id "90fdd0ef5d5b620084bb8d97e5860309") AWSHC: cannot move to
│ this port 
╵

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants