megaport / terraform-provider-megaport

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

cost_centre value fails to apply to megaport_vxc resource #93

Closed Kostoprav19 closed 2 months ago

Kostoprav19 commented 3 months ago

Hello!

cost_centre value fails to apply to megaport_vxc with following error:


│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to megaport_vxc.ipxgrx, provider "provider[\"registry.terraform.io/megaport/megaport\"]" produced an unexpected new value: .cost_centre: was cty.StringVal("A-TST-2024-GER-TST-TST"), but now cty.StringVal("").
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to megaport_vxc.aws, provider "provider[\"registry.terraform.io/megaport/megaport\"]" produced an unexpected new value: .cost_centre: was cty.StringVal("A-TST-2024-GER-TST-TST"), but now cty.StringVal("").
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to megaport_vxc.internet, provider "provider[\"registry.terraform.io/megaport/megaport\"]" produced an unexpected new value: .cost_centre: was cty.StringVal("A-TST-2024-GER-TST-TST"), but now cty.StringVal("").
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
Kostoprav19 commented 3 months ago

Verified in v1.0.1-rc1

mega-alex commented 3 months ago

Try it with v1.0.1-rc2, the fix didn't get into rc1

Kostoprav19 commented 3 months ago

Tried with v1.0.1-rc2 to update cost_center value for all resources, but terraform apply failed with various errors. Probably there is deeper issue with resource update processing - provider tries to update everything.

After destroying all resources terraform apply wen successfully.

terraform apply -var-file test-config.tfvars
data.aws_secretsmanager_secret.megaport: Reading...
data.aws_secretsmanager_secret.megaport: Read complete after 0s [id=arn:aws:secretsmanager:eu-central-1:893677514652:secret:megaport-dev-EMVzzv]
data.aws_secretsmanager_secret_version.megaport: Reading...
data.aws_secretsmanager_secret_version.megaport: Read complete after 0s [id=arn:aws:secretsmanager:eu-central-1:893677514652:secret:megaport-dev-EMVzzv|AWSCURRENT]
data.megaport_location.this: Reading...
data.megaport_location.this: Read complete after 9s [name=Interxion FRA6]
megaport_port.ipxgrx: Refreshing state...
data.megaport_partner.internet: Reading...
data.megaport_partner.aws_port: Reading...
megaport_mve.fortigate: Refreshing state...
megaport_vxc.ipxgrx: Refreshing state...
data.megaport_partner.aws_port: Read complete after 9s
megaport_vxc.aws: Refreshing state...
data.megaport_partner.internet: Still reading... [10s elapsed]
data.megaport_partner.internet: Read complete after 11s
megaport_vxc.internet: Refreshing state...

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:

  # megaport_port.ipxgrx will be updated in-place
  ~ resource "megaport_port" "ipxgrx" {
      ~ attribute_tags         = {
          ~ terminated_service_details = {
              ~ device    = "" -> (known after apply)
              ~ interface = {
                  ~ demarcation   = "" -> (known after apply)
                  ~ loa_template  = "" -> (known after apply)
                  ~ media         = "" -> (known after apply)
                  ~ port_speed    = 0 -> (known after apply)
                  ~ resource_name = "" -> (known after apply)
                  ~ resource_type = "" -> (known after apply)
                  ~ shutdown      = false -> (known after apply)
                  ~ up            = 0 -> (known after apply)
                } -> (known after apply)
              ~ location  = {
                  ~ id        = 0 -> (known after apply)
                  ~ name      = "" -> (known after apply)
                  ~ site_code = "" -> (known after apply)
                } -> (known after apply)
            } -> (known after apply)
        } -> (known after apply)
      ~ cancelable             = true -> (known after apply)
      ~ contract_end_date      = "Thursday, 18-Jul-24 17:00:00 EEST" -> (known after apply)
      ~ contract_start_date    = "Tuesday, 18-Jun-24 17:42:46 EEST" -> (known after apply)
      ~ cost_centre            = "A-TST-2024-GER-TST-TST" -> "A-TST-2024-GER-TST-TST1"
      ~ create_date            = "Tuesday, 18-Jun-24 17:41:53 EEST" -> (known after apply)
      ~ last_updated           = "Tuesday, 18-Jun-24 17:42:26 EEST" -> (known after apply)
      ~ live_date              = "Tuesday, 18-Jun-24 17:42:46 EEST" -> (known after apply)
      ~ locked                 = false -> (known after apply)
      ~ provisioning_status    = "LIVE" -> (known after apply)
      ~ resources              = {
          ~ interface = {
              ~ demarcation   = <<-EOT
                    Interxion FRA6
                    Hanauer Landstraße 298
                    Type: Single-mode Fibre Pair
                    Port: FRA6/CPR/ODF14/HU44, port 22
                EOT -> (known after apply)
              ~ description   = "" -> (known after apply)
              ~ id            = 0 -> (known after apply)
              ~ loa_template  = "gtt" -> (known after apply)
              ~ media         = "LR" -> (known after apply)
              ~ name          = "" -> (known after apply)
              ~ port_speed    = 10000 -> (known after apply)
              ~ resource_name = "interface" -> (known after apply)
              ~ resource_type = "interface" -> (known after apply)
              ~ up            = 1 -> (known after apply)
            } -> (known after apply)
        } -> (known after apply)
      + terminate_date         = (known after apply)
      ~ usage_algorithm        = "NOT_POST_PAID" -> (known after apply)
      ~ virtual                = false -> (known after apply)
      ~ vxc_auto_approval      = false -> (known after apply)
      ~ vxc_permitted          = true -> (known after apply)
        # (12 unchanged attributes hidden)
    }

  # megaport_vxc.aws will be updated in-place
  ~ resource "megaport_vxc" "aws" {
      ~ a_end                = {
          ~ current_product_uid   = "3f05c420-6342-4c8c-ba69-abbc15b83403" -> (known after apply)
          ~ location              = "Interxion FRA6" -> (known after apply)
          ~ location_id           = 130 -> (known after apply)
          ~ ordered_vlan          = 0 -> (known after apply)
          ~ owner_uid             = "e5f088f0-15b6-44da-88a9-3ef8569b94ec" -> (known after apply)
          ~ product_name          = "TEST-Frankfurt-ICSS-MVE" -> (known after apply)
          ~ secondary_name        = "" -> (known after apply)
            # (5 unchanged attributes hidden)
        }
      ~ admin_locked         = false -> (known after apply)
      ~ attribute_tags       = {} -> (known after apply)
      ~ b_end                = {
          ~ current_product_uid   = "5ec445b7-6e15-4638-a2d7-8b9ab6ab0e62" -> (known after apply)
          ~ inner_vlan            = 0 -> (known after apply)
          ~ location              = "Interxion FRA6" -> (known after apply)
          ~ location_id           = 130 -> (known after apply)
          ~ ordered_vlan          = 0 -> (known after apply)
          ~ owner_uid             = "605cb850-dfb4-4a05-a171-8bf17757b3a2" -> (known after apply)
          ~ product_name          = "EU (Frankfurt) (eu-central-1)" -> (known after apply)
          ~ secondary_name        = "" -> (known after apply)
          ~ vnic_index            = 0 -> (known after apply)
            # (3 unchanged attributes hidden)
        }
      ~ b_end_partner_config = {
          + partner_a_end_config = (known after apply)
            # (2 unchanged attributes hidden)
        }
      ~ cancelable           = true -> (known after apply)
      ~ company_name         = "1NCE GmbH" -> (known after apply)
      ~ contract_end_date    = "Thursday, 18-Jul-24 17:00:00 EEST" -> (known after apply)
      ~ contract_start_date  = "Tuesday, 18-Jun-24 17:43:26 EEST" -> (known after apply)
      ~ cost_centre          = "A-TST-2024-GER-TST-TST" -> "A-TST-2024-GER-TST-TST1"
      ~ create_date          = "Tuesday, 18-Jun-24 17:42:34 EEST" -> (known after apply)
      ~ csp_connections      = [
          - {
              - bandwidth     = 100 -> null
              - bandwidths    = [
                  - 100,
                ] -> null
              - connect_type  = "AWSHC" -> null
              - connection_id = "" -> null
              - name          = "MEGAPORT" -> null
              - owner_account = "893677514652" -> null
              - resource_name = "b_csp_connection" -> null
              - resource_type = "csp_connection" -> null
            },
        ] -> (known after apply)
      ~ distance_band        = "METRO" -> (known after apply)
      ~ last_updated         = "Tuesday, 18-Jun-24 17:43:11 EEST" -> (known after apply)
      ~ live_date            = "Tuesday, 18-Jun-24 17:43:26 EEST" -> (known after apply)
      ~ locked               = false -> (known after apply)
      + port_interfaces      = (known after apply)
      ~ product_type         = "VXC" -> (known after apply)
      ~ provisioning_status  = "LIVE" -> (known after apply)
      + secondary_name       = (known after apply)
      ~ service_id           = 0 -> (known after apply)
      ~ shutdown             = false -> (known after apply)
      ~ usage_algorithm      = "POST_PAID_HOURLY_SPEED_METRO_VXC" -> (known after apply)
      + virtual_router       = (known after apply)
      ~ vll                  = {
          ~ a_vlan          = 2 -> (known after apply)
          ~ b_vlan          = 2 -> (known after apply)
          ~ description     = "" -> (known after apply)
          ~ id              = 0 -> (known after apply)
          ~ name            = "" -> (known after apply)
          ~ rate_limit_mbps = 100 -> (known after apply)
          ~ resource_name   = "vll" -> (known after apply)
          ~ resource_type   = "vll" -> (known after apply)
        } -> (known after apply)
      ~ vxc_approval         = {
          ~ message   = "" -> (known after apply)
          ~ new_speed = 0 -> (known after apply)
          ~ status    = "" -> (known after apply)
          ~ type      = "" -> (known after apply)
          ~ uid       = "" -> (known after apply)
        } -> (known after apply)
        # (7 unchanged attributes hidden)
    }

  # megaport_vxc.internet will be updated in-place
  ~ resource "megaport_vxc" "internet" {
      ~ a_end                = {
          ~ current_product_uid   = "3f05c420-6342-4c8c-ba69-abbc15b83403" -> (known after apply)
          ~ inner_vlan            = 0 -> (known after apply)
          ~ location              = "Interxion FRA6" -> (known after apply)
          ~ location_id           = 130 -> (known after apply)
          ~ ordered_vlan          = 0 -> (known after apply)
          ~ owner_uid             = "e5f088f0-15b6-44da-88a9-3ef8569b94ec" -> (known after apply)
          ~ product_name          = "TEST-Frankfurt-ICSS-MVE" -> (known after apply)
          ~ secondary_name        = "" -> (known after apply)
            # (4 unchanged attributes hidden)
        }
      ~ admin_locked         = false -> (known after apply)
      ~ attribute_tags       = {} -> (known after apply)
      ~ b_end                = {
          ~ current_product_uid   = "39072592-c92d-466d-bfff-8194b76987df" -> (known after apply)
          ~ inner_vlan            = 0 -> (known after apply)
          ~ location              = "Interxion FRA6" -> (known after apply)
          ~ location_id           = 130 -> (known after apply)
          ~ ordered_vlan          = 0 -> (known after apply)
          ~ owner_uid             = "2f83dc65-5d4c-4730-a66d-926db48a0326" -> (known after apply)
          ~ product_name          = "Megaport Internet" -> (known after apply)
          ~ secondary_name        = "" -> (known after apply)
          ~ vnic_index            = 0 -> (known after apply)
            # (3 unchanged attributes hidden)
        }
      ~ cancelable           = true -> (known after apply)
      ~ company_name         = "1NCE GmbH" -> (known after apply)
      ~ contract_end_date    = "Thursday, 18-Jul-24 17:00:00 EEST" -> (known after apply)
      ~ contract_start_date  = "Tuesday, 18-Jun-24 17:43:26 EEST" -> (known after apply)
      ~ cost_centre          = "A-TST-2024-GER-TST-TST" -> "A-TST-2024-GER-TST-TST1"
      ~ create_date          = "Tuesday, 18-Jun-24 17:42:31 EEST" -> (known after apply)
      ~ csp_connections      = [
          - {
              - connect_type         = "TRANSIT" -> null
              - customer_ip4_address = "162.43.146.29/31" -> null
              - customer_ip6_network = "2a0a:1800:d:e::/64" -> null
              - ipv4_gateway_address = "162.43.146.28" -> null
              - ipv6_gateway_address = "2a0a:1800:d:e::1" -> null
              - resource_name        = "b_csp_connection" -> null
              - resource_type        = "csp_connection" -> null
            },
        ] -> (known after apply)
      ~ distance_band        = "METRO" -> (known after apply)
      ~ last_updated         = "Tuesday, 18-Jun-24 17:43:07 EEST" -> (known after apply)
      ~ live_date            = "Tuesday, 18-Jun-24 17:43:26 EEST" -> (known after apply)
      ~ locked               = false -> (known after apply)
      + port_interfaces      = (known after apply)
      ~ product_type         = "VXC" -> (known after apply)
      ~ provisioning_status  = "LIVE" -> (known after apply)
      + secondary_name       = (known after apply)
      ~ service_id           = 0 -> (known after apply)
      ~ shutdown             = false -> (known after apply)
      ~ usage_algorithm      = "POST_PAID_HOURLY_NORMALISED_SPEED" -> (known after apply)
      + virtual_router       = (known after apply)
      ~ vll                  = {
          ~ a_vlan          = 2 -> (known after apply)
          ~ b_vlan          = 2 -> (known after apply)
          ~ description     = "" -> (known after apply)
          ~ id              = 0 -> (known after apply)
          ~ name            = "" -> (known after apply)
          ~ rate_limit_mbps = 100 -> (known after apply)
          ~ resource_name   = "vll" -> (known after apply)
          ~ resource_type   = "vll" -> (known after apply)
        } -> (known after apply)
      ~ vxc_approval         = {
          ~ message   = "" -> (known after apply)
          ~ new_speed = 0 -> (known after apply)
          ~ status    = "" -> (known after apply)
          ~ type      = "" -> (known after apply)
          ~ uid       = "" -> (known after apply)
        } -> (known after apply)
        # (7 unchanged attributes hidden)
    }

  # megaport_vxc.ipxgrx will be updated in-place
  ~ resource "megaport_vxc" "ipxgrx" {
      ~ a_end                = {
          ~ current_product_uid   = "3f05c420-6342-4c8c-ba69-abbc15b83403" -> (known after apply)
          ~ location              = "Interxion FRA6" -> (known after apply)
          ~ location_id           = 130 -> (known after apply)
          ~ ordered_vlan          = 0 -> (known after apply)
          ~ owner_uid             = "e5f088f0-15b6-44da-88a9-3ef8569b94ec" -> (known after apply)
          ~ product_name          = "TEST-Frankfurt-ICSS-MVE" -> (known after apply)
          ~ secondary_name        = "" -> (known after apply)
            # (5 unchanged attributes hidden)
        }
      ~ admin_locked         = false -> (known after apply)
      ~ attribute_tags       = {} -> (known after apply)
      ~ b_end                = {
          ~ current_product_uid   = "19a24a01-15c2-4228-9b42-cfb69571c595" -> (known after apply)
          ~ inner_vlan            = 0 -> (known after apply)
          ~ location              = "Interxion FRA6" -> (known after apply)
          ~ location_id           = 130 -> (known after apply)
          ~ ordered_vlan          = 0 -> (known after apply)
          ~ owner_uid             = "e5f088f0-15b6-44da-88a9-3ef8569b94ec" -> (known after apply)
          ~ product_name          = "TEST-Frankfurt-ICSS-Port" -> (known after apply)
          ~ secondary_name        = "" -> (known after apply)
          ~ vnic_index            = 0 -> (known after apply)
            # (3 unchanged attributes hidden)
        }
      ~ cancelable           = true -> (known after apply)
      ~ company_name         = "1NCE GmbH" -> (known after apply)
      ~ contract_end_date    = "Thursday, 18-Jul-24 17:00:00 EEST" -> (known after apply)
      ~ contract_start_date  = "Tuesday, 18-Jun-24 17:43:26 EEST" -> (known after apply)
      ~ cost_centre          = "A-TST-2024-GER-TST-TST" -> "A-TST-2024-GER-TST-TST1"
      ~ create_date          = "Tuesday, 18-Jun-24 17:42:31 EEST" -> (known after apply)
      + csp_connections      = (known after apply)
      ~ distance_band        = "METRO" -> (known after apply)
      ~ last_updated         = "Tuesday, 18-Jun-24 17:43:06 EEST" -> (known after apply)
      ~ live_date            = "Tuesday, 18-Jun-24 17:43:26 EEST" -> (known after apply)
      ~ locked               = false -> (known after apply)
      + port_interfaces      = (known after apply)
      ~ product_type         = "VXC" -> (known after apply)
      ~ provisioning_status  = "LIVE" -> (known after apply)
      + secondary_name       = (known after apply)
      ~ service_id           = 0 -> (known after apply)
      ~ shutdown             = false -> (known after apply)
      ~ usage_algorithm      = "POST_PAID_HOURLY_SPEED_METRO_VXC" -> (known after apply)
      + virtual_router       = (known after apply)
      ~ vll                  = {
          ~ a_vlan          = 2 -> (known after apply)
          ~ b_vlan          = 2 -> (known after apply)
          ~ description     = "" -> (known after apply)
          ~ id              = 0 -> (known after apply)
          ~ name            = "" -> (known after apply)
          ~ rate_limit_mbps = 100 -> (known after apply)
          ~ resource_name   = "vll" -> (known after apply)
          ~ resource_type   = "vll" -> (known after apply)
        } -> (known after apply)
      ~ vxc_approval         = {
          ~ message   = "" -> (known after apply)
          ~ new_speed = 0 -> (known after apply)
          ~ status    = "" -> (known after apply)
          ~ type      = "" -> (known after apply)
          ~ uid       = "" -> (known after apply)
        } -> (known after apply)
        # (7 unchanged attributes hidden)
    }

Plan: 0 to add, 4 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

megaport_port.ipxgrx: Modifying...
megaport_vxc.internet: Modifying...
megaport_vxc.aws: Modifying...
megaport_port.ipxgrx: Still modifying... [10s elapsed]
megaport_port.ipxgrx: Still modifying... [20s elapsed]
megaport_port.ipxgrx: Still modifying... [30s elapsed]
megaport_port.ipxgrx: Modifications complete after 33s
megaport_vxc.ipxgrx: Modifying...
╷
│ Error: Error Updating VXC
│ 
│   with megaport_vxc.internet,
│   on main.tf line 50, in resource "megaport_vxc" "internet":
│   50: resource "megaport_vxc" "internet" {
│ 
│ Could not update VXC with ID a3b3b399-7bcc-4d63-8fd7-11f3bd785075: PUT https://api-staging.megaport.com/v3/product/vxc/a3b3b399-7bcc-4d63-8fd7-11f3bd785075: 403 (trace_id "60b351b9b895d564e0a3137160a76b2d") Only B end owner can change B VLAN 
╵
╷
│ Error: Error Updating VXC
│ 
│   with megaport_vxc.ipxgrx,
│   on main.tf line 67, in resource "megaport_vxc" "ipxgrx":
│   67: resource "megaport_vxc" "ipxgrx" {
│ 
│ Could not update VXC with ID ac8a0136-66d1-4593-ac26-f0e99ebeb1ca: PUT https://api-staging.megaport.com/v3/product/vxc/ac8a0136-66d1-4593-ac26-f0e99ebeb1ca: 409 (trace_id "5f1eea1de66006ca6269027229f015ce") Service term cannot be extended. 
╵
╷
│ Error: Error Updating VXC
│ 
│   with megaport_vxc.aws,
│   on main.tf line 86, in resource "megaport_vxc" "aws":
│   86: resource "megaport_vxc" "aws" {
│ 
│ Could not update VXC with ID bf2d1de5-9745-4f64-baea-242e8b587004: PUT https://api-staging.megaport.com/v3/product/vxc/bf2d1de5-9745-4f64-baea-242e8b587004: 403 (trace_id "06083e58643ff1eda359c48a1d35c5d4") Only B end owner can change B VLAN 
mega-alex commented 3 months ago

So when doing a fresh terraform apply with the rc2 it is fine, but with the existing state from the rc1 release the apply didn't work? Are there issues updating the state when only using the rc2 release and having no leftover state from the rc1?

Kostoprav19 commented 3 months ago

OK, I have performed a clean tests:

Results:

│ Error: Error Updating VXC
│ 
│   with megaport_vxc.internet,
│   on main.tf line 50, in resource "megaport_vxc" "internet":
│   50: resource "megaport_vxc" "internet" {
│ 
│ Could not update VXC with ID cf7e061e-73ec-495c-92ce-3ceb9575a1df: PUT https://api-staging.megaport.com/v3/product/vxc/cf7e061e-73ec-495c-92ce-3ceb9575a1df: 403 (trace_id "d76c12acaef68e0d53afe4e34919d0d9") Only B end owner can change B VLAN 
╵
╷
│ Error: Error Updating VXC
│ 
│   with megaport_vxc.ipxgrx,
│   on main.tf line 67, in resource "megaport_vxc" "ipxgrx":
│   67: resource "megaport_vxc" "ipxgrx" {
│ 
│ Could not update VXC with ID 03922195-07c7-450d-88c1-60bae6307c03: PUT https://api-staging.megaport.com/v3/product/vxc/03922195-07c7-450d-88c1-60bae6307c03: 409 (trace_id "54abc02083727931968d462d5831328e") Service term cannot be extended. 
╵
╷
│ Error: Error Updating VXC
│ 
│   with megaport_vxc.aws,
│   on main.tf line 86, in resource "megaport_vxc" "aws":
│   86: resource "megaport_vxc" "aws" {
│ 
│ Could not update VXC with ID 0e400bb6-b1a7-4e3e-b76e-b1c139956a9c: PUT https://api-staging.megaport.com/v3/product/vxc/0e400bb6-b1a7-4e3e-b76e-b1c139956a9c: 403 (trace_id "fe1e76e735d37e324da8f55f17d072a9") Only B end owner can change B VLAN 
╵
Kostoprav19 commented 3 months ago

There is clearly issue with VXC resource modifications using terraform. It was also true in rc1.

mega-alex commented 3 months ago

This should be fixed in v1.0.1 along with a few other issues with VXC updates

Kostoprav19 commented 3 months ago

Hello! I have tested today and I can confirm that cost_center value is being updated without errors.

But provider also updates inner vlans every time, which is not desired. Confirmed this in a Staging portal after apply.

 terraform apply -var-file test-config.tfvars
data.aws_secretsmanager_secret.megaport: Reading...
data.aws_secretsmanager_secret.megaport: Read complete after 0s [id=arn:aws:secretsmanager:eu-central-1:893677514652:secret:megaport-dev-EMVzzv]
data.aws_secretsmanager_secret_version.megaport: Reading...
data.aws_secretsmanager_secret_version.megaport: Read complete after 0s [id=arn:aws:secretsmanager:eu-central-1:893677514652:secret:megaport-dev-EMVzzv|AWSCURRENT]
data.megaport_location.default: Reading...
data.megaport_location.aws[0]: Reading...
data.megaport_location.aws[0]: Read complete after 4s [name=Interxion PAR5]
data.megaport_location.default: Read complete after 4s [name=Equinix PA2/3]
megaport_port.ipxgrx: Refreshing state...
data.megaport_partner.internet: Reading...
data.megaport_partner.aws_port: Reading...
megaport_mve.fortigate: Refreshing state...
megaport_vxc.ipxgrx[0]: Refreshing state...
data.megaport_partner.internet: Read complete after 1s
megaport_vxc.internet: Refreshing state...
data.megaport_partner.aws_port: Read complete after 2s
megaport_vxc.aws[0]: Refreshing state...

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:

  # megaport_mve.fortigate will be updated in-place
  ~ resource "megaport_mve" "fortigate" {
      ~ contract_start_date    = "Wednesday, 26-Jun-24 12:13:27 EEST" -> (known after apply)
      ~ cost_centre            = "A-???-2024-GER-???-123" -> "A-123-2024-GER-123-123"
      ~ last_updated           = "Wednesday, 26-Jun-24 12:16:13 EEST" -> (known after apply)
      ~ live_date              = "Wednesday, 26-Jun-24 12:13:27 EEST" -> (known after apply)
      ~ provisioning_status    = "LIVE" -> (known after apply)
      ~ resources              = {
          + interface       = (known after apply)
          ~ virtual_machine = [
              - {
                  - cpu_count     = 4 -> null
                  - id            = 0 -> null
                  - image         = {
                      - id      = 58 -> null
                      - product = "FortiGate-VM" -> null
                      - vendor  = "Fortinet" -> null
                      - version = "7.4.3" -> null
                    } -> null
                  - resource_type = "virtual_machine" -> null
                  - up            = true -> null
                  - vnics         = [
                      - {
                          - description = "mgmt" -> null
                          - vlan        = 3905 -> null
                        },
                      - {
                          - description = "to_ipxgrx" -> null
                          - vlan        = 2730 -> null
                        },
                      - {
                          - description = "to_aws" -> null
                          - vlan        = 599 -> null
                        },
                    ] -> null
                },
            ] -> (known after apply)
        } -> (known after apply)
        # (27 unchanged attributes hidden)
    }

  # megaport_port.ipxgrx will be updated in-place
  ~ resource "megaport_port" "ipxgrx" {
      ~ attribute_tags         = {
          ~ terminated_service_details = {
              ~ device    = "" -> (known after apply)
              ~ interface = {
                  ~ demarcation   = "" -> (known after apply)
                  ~ loa_template  = "" -> (known after apply)
                  ~ media         = "" -> (known after apply)
                  ~ port_speed    = 0 -> (known after apply)
                  ~ resource_name = "" -> (known after apply)
                  ~ resource_type = "" -> (known after apply)
                  ~ shutdown      = false -> (known after apply)
                  ~ up            = 0 -> (known after apply)
                } -> (known after apply)
              ~ location  = {
                  ~ id        = 0 -> (known after apply)
                  ~ name      = "" -> (known after apply)
                  ~ site_code = "" -> (known after apply)
                } -> (known after apply)
            } -> (known after apply)
        } -> (known after apply)
      ~ cancelable             = true -> (known after apply)
      ~ contract_end_date      = "Wednesday, 25-Jun-25 17:00:00 EEST" -> (known after apply)
      ~ contract_start_date    = "Wednesday, 26-Jun-24 12:13:27 EEST" -> (known after apply)
      ~ cost_centre            = "A-???-2024-GER-???-123" -> "A-123-2024-GER-123-123"
      ~ create_date            = "Wednesday, 26-Jun-24 12:12:30 EEST" -> (known after apply)
      ~ last_updated           = "Wednesday, 26-Jun-24 12:16:13 EEST" -> (known after apply)
      ~ live_date              = "Wednesday, 26-Jun-24 12:13:27 EEST" -> (known after apply)
      ~ locked                 = false -> (known after apply)
      ~ provisioning_status    = "LIVE" -> (known after apply)
      ~ resources              = {
          ~ interface = {
              ~ demarcation   = <<-EOT
                    Equinix PA2/3
                    114 Rue Ambroise Croizat, Saint Denis
                    0210
                    Type: Single-mode Fibre Pair
                    Ports: PP:0210:1177142, ports 7+8
                    Termination: SC connector
                EOT -> (known after apply)
              ~ description   = "" -> (known after apply)
              ~ id            = 0 -> (known after apply)
              ~ loa_template  = "megaport" -> (known after apply)
              ~ media         = "LR" -> (known after apply)
              ~ name          = "" -> (known after apply)
              ~ port_speed    = 10000 -> (known after apply)
              ~ resource_name = "interface" -> (known after apply)
              ~ resource_type = "interface" -> (known after apply)
              ~ up            = 1 -> (known after apply)
            } -> (known after apply)
        } -> (known after apply)
      + terminate_date         = (known after apply)
      ~ usage_algorithm        = "NOT_POST_PAID" -> (known after apply)
      ~ virtual                = false -> (known after apply)
      ~ vxc_auto_approval      = false -> (known after apply)
      ~ vxc_permitted          = true -> (known after apply)
        # (12 unchanged attributes hidden)
    }

  # megaport_vxc.aws[0] will be updated in-place
  ~ resource "megaport_vxc" "aws" {
      ~ a_end                = {
          ~ current_product_uid   = "42f8f153-8acc-498c-b1d3-6577f93dd97f" -> (known after apply)
          ~ inner_vlan            = 1620 -> (known after apply)
          ~ location              = "Equinix PA2/3" -> (known after apply)
          ~ location_id           = 515 -> (known after apply)
          ~ ordered_vlan          = 0 -> (known after apply)
          ~ owner_uid             = "e5f088f0-15b6-44da-88a9-3ef8569b94ec" -> (known after apply)
          ~ product_name          = "LBO-EU-Paris-ICSS-MVE" -> (known after apply)
          ~ secondary_name        = "" -> (known after apply)
            # (4 unchanged attributes hidden)
        }
      ~ admin_locked         = false -> (known after apply)
      ~ attribute_tags       = {} -> (known after apply)
      ~ b_end                = {
          ~ current_product_uid   = "09e400a0-1b72-49ec-8ff0-5a71a4fc7774" -> (known after apply)
          ~ inner_vlan            = 0 -> (known after apply)
          ~ location              = "Interxion PAR5" -> (known after apply)
          ~ location_id           = 527 -> (known after apply)
          ~ ordered_vlan          = 0 -> (known after apply)
          ~ owner_uid             = "605cb850-dfb4-4a05-a171-8bf17757b3a2" -> (known after apply)
          ~ product_name          = "EU (Paris) (eu-west-3)" -> (known after apply)
          ~ secondary_name        = "" -> (known after apply)
          ~ vnic_index            = 0 -> (known after apply)
            # (3 unchanged attributes hidden)
        }
      ~ b_end_partner_config = {
          + partner_a_end_config = (known after apply)
            # (2 unchanged attributes hidden)
        }
      ~ cancelable           = true -> (known after apply)
      ~ company_name         = "1NCE GmbH" -> (known after apply)
      ~ contract_end_date    = "Thursday, 25-Jul-24 17:00:00 EEST" -> (known after apply)
      ~ contract_start_date  = "Wednesday, 26-Jun-24 12:14:07 EEST" -> (known after apply)
      ~ cost_centre          = "A-???-2024-GER-???-123" -> "A-123-2024-GER-123-123"
      ~ create_date          = "Wednesday, 26-Jun-24 12:13:08 EEST" -> (known after apply)
      ~ csp_connections      = [
          - {
              - bandwidth     = 100 -> null
              - bandwidths    = [
                  - 100,
                ] -> null
              - connect_type  = "AWSHC" -> null
              - connection_id = "" -> null
              - name          = "LBO-EU-Paris-ICSS-AWS" -> null
              - owner_account = "893677514652" -> null
              - resource_name = "b_csp_connection" -> null
              - resource_type = "csp_connection" -> null
            },
        ] -> (known after apply)
      ~ distance_band        = "METRO" -> (known after apply)
      ~ last_updated         = "Wednesday, 26-Jun-24 12:16:47 EEST" -> (known after apply)
      ~ live_date            = "Wednesday, 26-Jun-24 12:14:07 EEST" -> (known after apply)
      ~ locked               = false -> (known after apply)
      + port_interfaces      = (known after apply)
      ~ product_type         = "VXC" -> (known after apply)
      ~ provisioning_status  = "LIVE" -> (known after apply)
      + secondary_name       = (known after apply)
      ~ service_id           = 0 -> (known after apply)
      ~ shutdown             = false -> (known after apply)
      ~ usage_algorithm      = "POST_PAID_HOURLY_SPEED_METRO_VXC" -> (known after apply)
      + virtual_router       = (known after apply)
      ~ vll                  = {
          ~ a_vlan          = 599 -> (known after apply)
          ~ b_vlan          = 599 -> (known after apply)
          ~ description     = "" -> (known after apply)
          ~ id              = 0 -> (known after apply)
          ~ name            = "" -> (known after apply)
          ~ rate_limit_mbps = 100 -> (known after apply)
          ~ resource_name   = "vll" -> (known after apply)
          ~ resource_type   = "vll" -> (known after apply)
        } -> (known after apply)
      ~ vxc_approval         = {
          ~ message   = "" -> (known after apply)
          ~ new_speed = 0 -> (known after apply)
          ~ status    = "" -> (known after apply)
          ~ type      = "" -> (known after apply)
          ~ uid       = "" -> (known after apply)
        } -> (known after apply)
        # (7 unchanged attributes hidden)
    }

  # megaport_vxc.internet will be updated in-place
  ~ resource "megaport_vxc" "internet" {
      ~ a_end                = {
          ~ current_product_uid   = "42f8f153-8acc-498c-b1d3-6577f93dd97f" -> (known after apply)
          ~ inner_vlan            = 3090 -> (known after apply)
          ~ location              = "Equinix PA2/3" -> (known after apply)
          ~ location_id           = 515 -> (known after apply)
          ~ ordered_vlan          = 0 -> (known after apply)
          ~ owner_uid             = "e5f088f0-15b6-44da-88a9-3ef8569b94ec" -> (known after apply)
          ~ product_name          = "LBO-EU-Paris-ICSS-MVE" -> (known after apply)
          ~ secondary_name        = "" -> (known after apply)
            # (4 unchanged attributes hidden)
        }
      ~ admin_locked         = false -> (known after apply)
      ~ attribute_tags       = {} -> (known after apply)
      ~ b_end                = {
          ~ current_product_uid   = "52cb6573-5cc8-45cc-8af1-d21db1fe3485" -> (known after apply)
          ~ inner_vlan            = 0 -> (known after apply)
          ~ location              = "Equinix PA2/3" -> (known after apply)
          ~ location_id           = 515 -> (known after apply)
          ~ ordered_vlan          = 0 -> (known after apply)
          ~ owner_uid             = "2f83dc65-5d4c-4730-a66d-926db48a0326" -> (known after apply)
          ~ product_name          = "Megaport Internet" -> (known after apply)
          ~ secondary_name        = "" -> (known after apply)
          ~ vnic_index            = 0 -> (known after apply)
            # (3 unchanged attributes hidden)
        }
      ~ cancelable           = true -> (known after apply)
      ~ company_name         = "1NCE GmbH" -> (known after apply)
      ~ contract_end_date    = "Wednesday, 25-Jun-25 17:00:00 EEST" -> (known after apply)
      ~ contract_start_date  = "Wednesday, 26-Jun-24 12:14:07 EEST" -> (known after apply)
      ~ cost_centre          = "A-???-2024-GER-???-123" -> "A-123-2024-GER-123-123"
      ~ create_date          = "Wednesday, 26-Jun-24 12:13:06 EEST" -> (known after apply)
      ~ csp_connections      = [
          - {
              - connect_type         = "TRANSIT" -> null
              - customer_ip4_address = "162.43.161.29/31" -> null
              - customer_ip6_network = "2a0a:1800:1c:e::/64" -> null
              - ipv4_gateway_address = "162.43.161.28" -> null
              - ipv6_gateway_address = "2a0a:1800:1c:e::1" -> null
              - resource_name        = "b_csp_connection" -> null
              - resource_type        = "csp_connection" -> null
            },
        ] -> (known after apply)
      ~ distance_band        = "METRO" -> (known after apply)
      ~ last_updated         = "Wednesday, 26-Jun-24 12:16:45 EEST" -> (known after apply)
      ~ live_date            = "Wednesday, 26-Jun-24 12:14:07 EEST" -> (known after apply)
      ~ locked               = false -> (known after apply)
      + port_interfaces      = (known after apply)
      ~ product_type         = "VXC" -> (known after apply)
      ~ provisioning_status  = "LIVE" -> (known after apply)
      + secondary_name       = (known after apply)
      ~ service_id           = 0 -> (known after apply)
      ~ shutdown             = false -> (known after apply)
      ~ usage_algorithm      = "POST_PAID_HOURLY_NORMALISED_SPEED" -> (known after apply)
      + virtual_router       = (known after apply)
      ~ vll                  = {
          ~ a_vlan          = 3905 -> (known after apply)
          ~ b_vlan          = 3905 -> (known after apply)
          ~ description     = "" -> (known after apply)
          ~ id              = 0 -> (known after apply)
          ~ name            = "" -> (known after apply)
          ~ rate_limit_mbps = 100 -> (known after apply)
          ~ resource_name   = "vll" -> (known after apply)
          ~ resource_type   = "vll" -> (known after apply)
        } -> (known after apply)
      ~ vxc_approval         = {
          ~ message   = "" -> (known after apply)
          ~ new_speed = 0 -> (known after apply)
          ~ status    = "" -> (known after apply)
          ~ type      = "" -> (known after apply)
          ~ uid       = "" -> (known after apply)
        } -> (known after apply)
        # (7 unchanged attributes hidden)
    }

  # megaport_vxc.ipxgrx[0] will be updated in-place
  ~ resource "megaport_vxc" "ipxgrx" {
      ~ a_end                = {
          ~ current_product_uid   = "42f8f153-8acc-498c-b1d3-6577f93dd97f" -> (known after apply)
          ~ inner_vlan            = 498 -> (known after apply)
          ~ location              = "Equinix PA2/3" -> (known after apply)
          ~ location_id           = 515 -> (known after apply)
          ~ ordered_vlan          = 0 -> (known after apply)
          ~ owner_uid             = "e5f088f0-15b6-44da-88a9-3ef8569b94ec" -> (known after apply)
          ~ product_name          = "LBO-EU-Paris-ICSS-MVE" -> (known after apply)
          ~ secondary_name        = "" -> (known after apply)
            # (4 unchanged attributes hidden)
        }
      ~ admin_locked         = false -> (known after apply)
      ~ attribute_tags       = {} -> (known after apply)
      ~ b_end                = {
          ~ current_product_uid   = "32ec2948-7f34-4ebd-b052-97c9d0bc5cf6" -> (known after apply)
          ~ inner_vlan            = 0 -> (known after apply)
          ~ location              = "Equinix PA2/3" -> (known after apply)
          ~ location_id           = 515 -> (known after apply)
          ~ ordered_vlan          = 0 -> (known after apply)
          ~ owner_uid             = "e5f088f0-15b6-44da-88a9-3ef8569b94ec" -> (known after apply)
          ~ product_name          = "LBO-EU-Paris-ICSS-Port" -> (known after apply)
          ~ secondary_name        = "" -> (known after apply)
          ~ vnic_index            = 0 -> (known after apply)
            # (3 unchanged attributes hidden)
        }
      ~ cancelable           = true -> (known after apply)
      ~ company_name         = "1NCE GmbH" -> (known after apply)
      ~ contract_end_date    = "Thursday, 25-Jul-24 17:00:00 EEST" -> (known after apply)
      ~ contract_start_date  = "Wednesday, 26-Jun-24 12:14:07 EEST" -> (known after apply)
      ~ cost_centre          = "A-???-2024-GER-???-123" -> "A-123-2024-GER-123-123"
      ~ create_date          = "Wednesday, 26-Jun-24 12:13:06 EEST" -> (known after apply)
      + csp_connections      = (known after apply)
      ~ distance_band        = "METRO" -> (known after apply)
      ~ last_updated         = "Wednesday, 26-Jun-24 12:16:46 EEST" -> (known after apply)
      ~ live_date            = "Wednesday, 26-Jun-24 12:14:07 EEST" -> (known after apply)
      ~ locked               = false -> (known after apply)
      + port_interfaces      = (known after apply)
      ~ product_type         = "VXC" -> (known after apply)
      ~ provisioning_status  = "LIVE" -> (known after apply)
      + secondary_name       = (known after apply)
      ~ service_id           = 0 -> (known after apply)
      ~ shutdown             = false -> (known after apply)
      ~ usage_algorithm      = "POST_PAID_HOURLY_SPEED_METRO_VXC" -> (known after apply)
      + virtual_router       = (known after apply)
      ~ vll                  = {
          ~ a_vlan          = 2730 -> (known after apply)
          ~ b_vlan          = 2730 -> (known after apply)
          ~ description     = "" -> (known after apply)
          ~ id              = 0 -> (known after apply)
          ~ name            = "" -> (known after apply)
          ~ rate_limit_mbps = 100 -> (known after apply)
          ~ resource_name   = "vll" -> (known after apply)
          ~ resource_type   = "vll" -> (known after apply)
        } -> (known after apply)
      ~ vxc_approval         = {
          ~ message   = "" -> (known after apply)
          ~ new_speed = 0 -> (known after apply)
          ~ status    = "" -> (known after apply)
          ~ type      = "" -> (known after apply)
          ~ uid       = "" -> (known after apply)
        } -> (known after apply)
        # (7 unchanged attributes hidden)
    }

Plan: 0 to add, 5 to change, 0 to destroy.
╷
│ Warning: Value for undeclared variable
│ 
│ The root module does not declare a variable named "tags" but a value was found in file "test-config.tfvars". If you meant to use this value, add a "variable" block to the configuration.
│ 
│ To silence these warnings, use TF_VAR_... environment variables to provide certain "global" settings to all configurations in your organization. To reduce the verbosity of these warnings, use the -compact-warnings option.
╵

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

megaport_port.ipxgrx: Modifying...
megaport_mve.fortigate: Modifying...
megaport_port.ipxgrx: Still modifying... [10s elapsed]
megaport_mve.fortigate: Still modifying... [10s elapsed]
megaport_port.ipxgrx: Still modifying... [20s elapsed]
megaport_mve.fortigate: Still modifying... [20s elapsed]
megaport_port.ipxgrx: Still modifying... [30s elapsed]
megaport_mve.fortigate: Still modifying... [30s elapsed]
megaport_port.ipxgrx: Modifications complete after 33s
megaport_mve.fortigate: Modifications complete after 33s
megaport_vxc.ipxgrx[0]: Modifying...
megaport_vxc.internet: Modifying...
megaport_vxc.aws[0]: Modifying...
megaport_vxc.ipxgrx[0]: Still modifying... [10s elapsed]
megaport_vxc.internet: Still modifying... [10s elapsed]
megaport_vxc.aws[0]: Still modifying... [10s elapsed]
megaport_vxc.aws[0]: Still modifying... [20s elapsed]
megaport_vxc.internet: Still modifying... [20s elapsed]
megaport_vxc.ipxgrx[0]: Still modifying... [20s elapsed]
megaport_vxc.ipxgrx[0]: Still modifying... [30s elapsed]
megaport_vxc.aws[0]: Still modifying... [30s elapsed]
megaport_vxc.internet: Still modifying... [30s elapsed]
megaport_vxc.internet: Modifications complete after 33s
megaport_vxc.ipxgrx[0]: Modifications complete after 33s
megaport_vxc.aws[0]: Modifications complete after 34s

Apply complete! Resources: 0 added, 5 changed, 0 destroyed.
mega-alex commented 3 months ago

Hi there, sorry for the delay on this one. I've tried to reproduce this locally with the latest provider version, and I think I need some more clarity on what the issue with the inner_vlan changing is. Can you provide a sample .tf file and the steps that you took that caused the inner_vlan to change without your input?

Kostoprav19 commented 3 months ago

Hi! Sure,

Please find below my main.tf. it is very basic by structure -I create Port, MVE and 3 VXC's: MVE-Port, MVE-AWS, MVE-Internet.

Steps: 1) Start form scratch. I use megaport provider v1.0.1 (latest) 2) terraform apply 3) verify in Staging environment that everything is deployed. Note down vlan ID's of Port VXC (B End) 4) change value for var var.cost_centre to trigger changes 5) during terraform plan I see a lot of unwanted changes in resources (please see example in my last comment). The expected behavior is that changed will be only to value of cost_centre. For example

...
~ vll                  = {
          ~ a_vlan          = 2730 -> (known after apply)
          ~ b_vlan          = 2730 -> (known after apply)
...

6) Apply succeed, I go to Staging portal to verify that Cost center value applied and compare noted in step 3 vlan ID's of Port VXC and confirm that value is changed.

main.tf

# Megaport Port to connect with IPX/GRX provider in specified location 
resource "megaport_port" "ipxgrx" {
  product_name           = "${var.name_prefix}-Port"
  port_speed             = var.ipxgrx_config.port_speed_mbps
  location_id            = try(data.megaport_location.ipxgrx[0].id, data.megaport_location.default.id)
  contract_term_months   = var.ipxgrx_config.port_contract_term_months
  marketplace_visibility = var.marketplace_visibility
  cost_centre            = var.cost_centre
}

locals {
  vnics = var.mve_config.single_vnic ? null : [
    {
      description = var.mve_config.mgmt_vnic_name
    },
    {
      description = var.mve_config.ipxgrx_vnic_name
    },
    {
      description = var.mve_config.aws_vnic_name
    }
  ]
}

# Megaport MVE - Fortigate router
resource "megaport_mve" "fortigate" {
  product_name         = "${var.name_prefix}-MVE"
  location_id          = try(data.megaport_location.mve[0].id, data.megaport_location.default.id)
  contract_term_months = var.mve_config.contract_term_months
  cost_centre          = var.cost_centre

  vendor_config = {
    vendor         = var.mve_config.vendor
    image_id       = var.mve_config.image_id
    product_size   = var.mve_config.product_size
    ssh_public_key = jsondecode(data.aws_secretsmanager_secret_version.megaport.secret_string)["fortigate_ssh_pub_key"]
    license_data   = jsondecode(data.aws_secretsmanager_secret_version.megaport.secret_string)["fortigate_b64_encoded_licence"]
  }

  vnics = local.vnics
}

# Virtual Cross Connect (VXC) to Internet
resource "megaport_vxc" "internet" {
  product_name         = "${var.name_prefix}-Internet-VXC"
  rate_limit           = var.mve_config.internet_rate_limit_mbps
  contract_term_months = var.mve_config.contract_term_months
  cost_centre          = var.cost_centre

  a_end = {
    requested_product_uid = megaport_mve.fortigate.product_uid
    vnic_index            = 0 # always first interface
  }

  b_end = {
    requested_product_uid = data.megaport_partner.internet.product_uid
  }
}

# Virtual Cross Connect (VXC) to IPX/GRX Port
resource "megaport_vxc" "ipxgrx" {
  count = var.ipxgrx_config.vxc_enabled ? 1 : 0

  product_name         = "${var.name_prefix}-IPXGRX-VXC"
  rate_limit           = var.ipxgrx_config.vxc_rate_limit_mbps
  contract_term_months = var.ipxgrx_config.vxc_contract_term_months
  cost_centre          = var.cost_centre

  a_end = {
    requested_product_uid = megaport_mve.fortigate.product_uid
    vnic_index            = var.mve_config.single_vnic ? 0 : index(local.vnics, { description = var.mve_config.ipxgrx_vnic_name })
    inner_vlan            = var.mve_config.single_vnic ? var.mve_config.ipxgrx_vlan_id : null
  }

  b_end = {
    requested_product_uid = megaport_port.ipxgrx.product_uid
  }
}

# Virtual Cross Connect (VXC) to AWS 
resource "megaport_vxc" "aws" {
  count = var.aws_config.vxc_enabled ? 1 : 0

  product_name         = "${var.name_prefix}-AWS-VXC"
  rate_limit           = var.aws_config.vxc_rate_limit_mbps
  contract_term_months = var.aws_config.contract_term_months
  cost_centre          = var.cost_centre

  a_end = {
    requested_product_uid = megaport_mve.fortigate.product_uid
    vnic_index            = var.mve_config.single_vnic ? 0 : index(local.vnics, { description = var.mve_config.aws_vnic_name })
    inner_vlan            = var.mve_config.single_vnic ? var.mve_config.aws_vlan_id : null
  }

  b_end = {
    requested_product_uid = data.megaport_partner.aws_port.product_uid
  }

  b_end_partner_config = {
    partner = var.aws_config.partner
    aws_config = {
      name          = "${var.name_prefix}-AWS"
      asn           = var.mve_config.asn
      type          = var.aws_config.link_type
      connect_type  = var.aws_config.connect_type
      amazon_asn    = var.aws_config.amazon_asn
      owner_account = var.aws_config.account_id
    }
  }
}
MegaportPhilipBrowne commented 2 months ago

Hello there, thanks so much for your patience! We just put out a new release v1.0.2-beta - can you try running it and let us know if you are still running into the issue of inner_vlan changing unexpectedly? We fixed an issue where updating a VXC with an unspecified inner_vlan would assign a random inner VLAN value to the end configuration. One note - in your internet/transit VXC, make sure to set the b_end_partner_config partner field to "transit" eg

# Virtual Cross Connect (VXC) to Internet
resource "megaport_vxc" "internet" {
  product_name         = "${var.name_prefix}-Internet-VXC"
  rate_limit           = var.mve_config.internet_rate_limit_mbps
  contract_term_months = var.mve_config.contract_term_months
  cost_centre          = var.cost_centre

  a_end = {
    requested_product_uid = megaport_mve.fortigate.product_uid
    vnic_index            = 0 # always first interface
  }

  b_end = {
    requested_product_uid = data.megaport_partner.internet.product_uid
  }

  # Adding this field
  b_end_partner_config = {
     partner = "transit"
 }
}

One thing also worth noting, the VLL field, like all other objects in the VXC resources field are computed, read-only properties assigned by the Megaport API, and may update after the VXC is provisioned. That said, I ran some tests this week to confirm that they are NOT changing after creation/update. However, if you still encounter them changing from the initially computed values upon creation, please let us know.

As always, let us know if you have any additional issues, questions, or concerns - thanks!

Kostoprav19 commented 2 months ago

Hello! Testing with v1.0.2-beta.

Steps:

  1. Start form scratch. I use megaport provider v1.0.2-beta (updated using command terraform init -upgrade)
  2. terraform apply
  3. verify in Staging environment that everything is deployed. Note down vlan ID's of Port VXC (B End)
  4. change value for var var.cost_centre to trigger changes
  5. during terraform plan I still see a lot of unwanted changes in resources (please see example below). The expected behavior is that changed will be only to value of cost_centre variable. At this moment I really don't understand what will happen with my infra.
  6. Terraform apply went successfully -> in Staging Portal and verified Port VXC B End VLAN id = it was the same (not changed). So vlan id issue is now fixed. But I am not sure there are no other issues, and something important did not changed.

Terraform plan output:

Terraform will perform the following actions:

  # megaport_mve.fortigate will be updated in-place
  ~ resource "megaport_mve" "fortigate" {
      ~ contract_start_date    = "Monday, 15-Jul-24 11:25:58 EEST" -> (known after apply)
      ~ cost_centre            = "A-123-2024-GER-123-123" -> "A-123-2024-GER-123-124"
      ~ last_updated           = "Monday, 15-Jul-24 11:25:26 EEST" -> (known after apply)
      ~ live_date              = "Monday, 15-Jul-24 11:25:58 EEST" -> (known after apply)
      ~ provisioning_status    = "LIVE" -> (known after apply)
      ~ resources              = {
          + interface       = (known after apply)
          ~ virtual_machine = [
              - {
                  - cpu_count     = 4 -> null
                  - id            = 0 -> null
                  - image         = {
                      - id      = 58 -> null
                      - product = "FortiGate-VM" -> null
                      - vendor  = "Fortinet" -> null
                      - version = "7.4.3" -> null
                    } -> null
                  - resource_type = "virtual_machine" -> null
                  - up            = true -> null
                  - vnics         = [
                      - {
                          - description = "mgmt" -> null
                          - vlan        = 1305 -> null
                        },
                      - {
                          - description = "to_ipxgrx" -> null
                          - vlan        = 2674 -> null
                        },
                      - {
                          - description = "to_aws" -> null
                          - vlan        = 815 -> null
                        },
                    ] -> null
                },
            ] -> (known after apply)
        } -> (known after apply)
        # (27 unchanged attributes hidden)
    }

  # megaport_port.ipxgrx will be updated in-place
  ~ resource "megaport_port" "ipxgrx" {
      ~ attribute_tags         = {
          ~ terminated_service_details = {
              ~ device    = "" -> (known after apply)
              ~ interface = {
                  ~ demarcation   = "" -> (known after apply)
                  ~ loa_template  = "" -> (known after apply)
                  ~ media         = "" -> (known after apply)
                  ~ port_speed    = 0 -> (known after apply)
                  ~ resource_name = "" -> (known after apply)
                  ~ resource_type = "" -> (known after apply)
                  ~ shutdown      = false -> (known after apply)
                  ~ up            = 0 -> (known after apply)
                } -> (known after apply)
              ~ location  = {
                  ~ id        = 0 -> (known after apply)
                  ~ name      = "" -> (known after apply)
                  ~ site_code = "" -> (known after apply)
                } -> (known after apply)
            } -> (known after apply)
        } -> (known after apply)
      ~ cancelable             = true -> (known after apply)
      ~ contract_end_date      = "Monday, 14-Jul-25 17:00:00 EEST" -> (known after apply)
      ~ contract_start_date    = "Monday, 15-Jul-24 11:25:58 EEST" -> (known after apply)
      ~ cost_centre            = "A-123-2024-GER-123-123" -> "A-123-2024-GER-123-124"
      ~ create_date            = "Monday, 15-Jul-24 11:24:54 EEST" -> (known after apply)
      ~ last_updated           = "Monday, 15-Jul-24 11:25:26 EEST" -> (known after apply)
      ~ live_date              = "Monday, 15-Jul-24 11:25:58 EEST" -> (known after apply)
      ~ locked                 = false -> (known after apply)
      ~ provisioning_status    = "LIVE" -> (known after apply)
      ~ resources              = {
          ~ interface = {
              ~ demarcation   = <<-EOT
                    Equinix PA2/3
                    114 Rue Ambroise Croizat, Saint Denis
                    0210
                    Type: Single-mode Fibre Pair
                    Ports: PP:0210:1177142, ports 11+12
                    Termination: SC connector
                EOT -> (known after apply)
              ~ description   = "" -> (known after apply)
              ~ id            = 0 -> (known after apply)
              ~ loa_template  = "megaport" -> (known after apply)
              ~ media         = "LR" -> (known after apply)
              ~ name          = "" -> (known after apply)
              ~ port_speed    = 10000 -> (known after apply)
              ~ resource_name = "interface" -> (known after apply)
              ~ resource_type = "interface" -> (known after apply)
              ~ up            = 1 -> (known after apply)
            } -> (known after apply)
        } -> (known after apply)
      + terminate_date         = (known after apply)
      ~ usage_algorithm        = "NOT_POST_PAID" -> (known after apply)
      ~ virtual                = false -> (known after apply)
      ~ vxc_auto_approval      = false -> (known after apply)
      ~ vxc_permitted          = true -> (known after apply)
        # (12 unchanged attributes hidden)
    }

  # megaport_vxc.aws[0] will be updated in-place
  ~ resource "megaport_vxc" "aws" {
      ~ a_end                = {
          ~ current_product_uid   = "b2e1d8d9-90d1-4c4e-b363-7d783718df6f" -> (known after apply)
          + inner_vlan            = (known after apply)
          ~ location              = "Equinix PA2/3" -> (known after apply)
          ~ location_id           = 515 -> (known after apply)
          ~ ordered_vlan          = 0 -> (known after apply)
          ~ owner_uid             = "e5f088f0-15b6-44da-88a9-3ef8569b94ec" -> (known after apply)
          ~ product_name          = "TEST-EU-Paris-ICSS-MVE" -> (known after apply)
          ~ secondary_name        = "" -> (known after apply)
            # (4 unchanged attributes hidden)
        }
      ~ admin_locked         = false -> (known after apply)
      ~ attribute_tags       = {} -> (known after apply)
      ~ b_end                = {
          ~ current_product_uid   = "09e400a0-1b72-49ec-8ff0-5a71a4fc7774" -> (known after apply)
          + inner_vlan            = (known after apply)
          ~ location              = "Interxion PAR5" -> (known after apply)
          ~ location_id           = 527 -> (known after apply)
          ~ ordered_vlan          = 0 -> (known after apply)
          ~ owner_uid             = "605cb850-dfb4-4a05-a171-8bf17757b3a2" -> (known after apply)
          ~ product_name          = "EU (Paris) (eu-west-3)" -> (known after apply)
          ~ secondary_name        = "" -> (known after apply)
          ~ vnic_index            = 0 -> (known after apply)
            # (3 unchanged attributes hidden)
        }
      ~ b_end_partner_config = {
          + partner_a_end_config = (known after apply)
            # (2 unchanged attributes hidden)
        }
      ~ cancelable           = true -> (known after apply)
      ~ company_name         = "1NCE GmbH" -> (known after apply)
      ~ contract_end_date    = "Wednesday, 14-Aug-24 17:00:00 EEST" -> (known after apply)
      ~ contract_start_date  = "Monday, 15-Jul-24 11:26:38 EEST" -> (known after apply)
      ~ cost_centre          = "A-123-2024-GER-123-123" -> "A-123-2024-GER-123-124"
      ~ create_date          = "Monday, 15-Jul-24 11:25:32 EEST" -> (known after apply)
      ~ csp_connections      = [
          - {
              - bandwidth     = 100 -> null
              - bandwidths    = [
                  - 100,
                ] -> null
              - connect_type  = "AWSHC" -> null
              - connection_id = "" -> null
              - name          = "TEST-EU-Paris-ICSS-AWS" -> null
              - owner_account = "893677514652" -> null
              - resource_name = "b_csp_connection" -> null
              - resource_type = "csp_connection" -> null
            },
        ] -> (known after apply)
      ~ distance_band        = "METRO" -> (known after apply)
      ~ last_updated         = "Monday, 15-Jul-24 11:26:09 EEST" -> (known after apply)
      ~ live_date            = "Monday, 15-Jul-24 11:26:38 EEST" -> (known after apply)
      ~ locked               = false -> (known after apply)
      + port_interfaces      = (known after apply)
      ~ product_type         = "VXC" -> (known after apply)
      ~ provisioning_status  = "LIVE" -> (known after apply)
      + secondary_name       = (known after apply)
      ~ service_id           = 0 -> (known after apply)
      ~ shutdown             = false -> (known after apply)
      ~ usage_algorithm      = "POST_PAID_HOURLY_SPEED_METRO_VXC" -> (known after apply)
      + virtual_router       = (known after apply)
      ~ vll                  = {
          ~ a_vlan          = 815 -> (known after apply)
          ~ b_vlan          = 815 -> (known after apply)
          ~ description     = "" -> (known after apply)
          ~ id              = 0 -> (known after apply)
          ~ name            = "" -> (known after apply)
          ~ rate_limit_mbps = 100 -> (known after apply)
          ~ resource_name   = "vll" -> (known after apply)
          ~ resource_type   = "vll" -> (known after apply)
        } -> (known after apply)
      ~ vxc_approval         = {
          ~ message   = "" -> (known after apply)
          ~ new_speed = 0 -> (known after apply)
          ~ status    = "" -> (known after apply)
          ~ type      = "" -> (known after apply)
          ~ uid       = "" -> (known after apply)
        } -> (known after apply)
        # (7 unchanged attributes hidden)
    }

  # megaport_vxc.internet will be updated in-place
  ~ resource "megaport_vxc" "internet" {
      ~ a_end                = {
          ~ current_product_uid   = "b2e1d8d9-90d1-4c4e-b363-7d783718df6f" -> (known after apply)
          + inner_vlan            = (known after apply)
          ~ location              = "Equinix PA2/3" -> (known after apply)
          ~ location_id           = 515 -> (known after apply)
          ~ ordered_vlan          = 0 -> (known after apply)
          ~ owner_uid             = "e5f088f0-15b6-44da-88a9-3ef8569b94ec" -> (known after apply)
          ~ product_name          = "TEST-EU-Paris-ICSS-MVE" -> (known after apply)
          ~ secondary_name        = "" -> (known after apply)
            # (4 unchanged attributes hidden)
        }
      ~ admin_locked         = false -> (known after apply)
      ~ attribute_tags       = {} -> (known after apply)
      ~ b_end                = {
          ~ current_product_uid   = "52cb6573-5cc8-45cc-8af1-d21db1fe3485" -> (known after apply)
          + inner_vlan            = (known after apply)
          ~ location              = "Equinix PA2/3" -> (known after apply)
          ~ location_id           = 515 -> (known after apply)
          ~ ordered_vlan          = 0 -> (known after apply)
          ~ owner_uid             = "2f83dc65-5d4c-4730-a66d-926db48a0326" -> (known after apply)
          ~ product_name          = "Megaport Internet" -> (known after apply)
          ~ secondary_name        = "" -> (known after apply)
          ~ vnic_index            = 0 -> (known after apply)
            # (3 unchanged attributes hidden)
        }
      ~ cancelable           = true -> (known after apply)
      ~ company_name         = "1NCE GmbH" -> (known after apply)
      ~ contract_end_date    = "Monday, 14-Jul-25 17:00:00 EEST" -> (known after apply)
      ~ contract_start_date  = "Monday, 15-Jul-24 11:26:38 EEST" -> (known after apply)
      ~ cost_centre          = "A-123-2024-GER-123-123" -> "A-123-2024-GER-123-124"
      ~ create_date          = "Monday, 15-Jul-24 11:25:31 EEST" -> (known after apply)
      ~ csp_connections      = [
          - {
              - connect_type         = "TRANSIT" -> null
              - customer_ip4_address = "162.43.161.1/31" -> null
              - customer_ip6_network = "2a0a:1800:1c::/64" -> null
              - ipv4_gateway_address = "162.43.161.0" -> null
              - ipv6_gateway_address = "2a0a:1800:1c::1" -> null
              - resource_name        = "b_csp_connection" -> null
              - resource_type        = "csp_connection" -> null
            },
        ] -> (known after apply)
      ~ distance_band        = "METRO" -> (known after apply)
      ~ last_updated         = "Monday, 15-Jul-24 11:26:06 EEST" -> (known after apply)
      ~ live_date            = "Monday, 15-Jul-24 11:26:38 EEST" -> (known after apply)
      ~ locked               = false -> (known after apply)
      + port_interfaces      = (known after apply)
      ~ product_type         = "VXC" -> (known after apply)
      ~ provisioning_status  = "LIVE" -> (known after apply)
      + secondary_name       = (known after apply)
      ~ service_id           = 0 -> (known after apply)
      ~ shutdown             = false -> (known after apply)
      ~ usage_algorithm      = "POST_PAID_HOURLY_NORMALISED_SPEED" -> (known after apply)
      + virtual_router       = (known after apply)
      ~ vll                  = {
          ~ a_vlan          = 1305 -> (known after apply)
          ~ b_vlan          = 1305 -> (known after apply)
          ~ description     = "" -> (known after apply)
          ~ id              = 0 -> (known after apply)
          ~ name            = "" -> (known after apply)
          ~ rate_limit_mbps = 100 -> (known after apply)
          ~ resource_name   = "vll" -> (known after apply)
          ~ resource_type   = "vll" -> (known after apply)
        } -> (known after apply)
      ~ vxc_approval         = {
          ~ message   = "" -> (known after apply)
          ~ new_speed = 0 -> (known after apply)
          ~ status    = "" -> (known after apply)
          ~ type      = "" -> (known after apply)
          ~ uid       = "" -> (known after apply)
        } -> (known after apply)
        # (7 unchanged attributes hidden)
    }

  # megaport_vxc.ipxgrx[0] will be updated in-place
  ~ resource "megaport_vxc" "ipxgrx" {
      ~ a_end                = {
          ~ current_product_uid   = "b2e1d8d9-90d1-4c4e-b363-7d783718df6f" -> (known after apply)
          + inner_vlan            = (known after apply)
          ~ location              = "Equinix PA2/3" -> (known after apply)
          ~ location_id           = 515 -> (known after apply)
          ~ ordered_vlan          = 0 -> (known after apply)
          ~ owner_uid             = "e5f088f0-15b6-44da-88a9-3ef8569b94ec" -> (known after apply)
          ~ product_name          = "TEST-EU-Paris-ICSS-MVE" -> (known after apply)
          ~ secondary_name        = "" -> (known after apply)
            # (4 unchanged attributes hidden)
        }
      ~ admin_locked         = false -> (known after apply)
      ~ attribute_tags       = {} -> (known after apply)
      ~ b_end                = {
          ~ current_product_uid   = "92036c9c-cb08-485f-b3a9-d2dfa447700c" -> (known after apply)
          + inner_vlan            = (known after apply)
          ~ location              = "Equinix PA2/3" -> (known after apply)
          ~ location_id           = 515 -> (known after apply)
          ~ ordered_vlan          = 0 -> (known after apply)
          ~ owner_uid             = "e5f088f0-15b6-44da-88a9-3ef8569b94ec" -> (known after apply)
          ~ product_name          = "TEST-EU-Paris-ICSS-Port" -> (known after apply)
          ~ secondary_name        = "" -> (known after apply)
          ~ vnic_index            = 0 -> (known after apply)
            # (3 unchanged attributes hidden)
        }
      ~ cancelable           = true -> (known after apply)
      ~ company_name         = "1NCE GmbH" -> (known after apply)
      ~ contract_end_date    = "Wednesday, 14-Aug-24 17:00:00 EEST" -> (known after apply)
      ~ contract_start_date  = "Monday, 15-Jul-24 11:26:38 EEST" -> (known after apply)
      ~ cost_centre          = "A-123-2024-GER-123-123" -> "A-123-2024-GER-123-124"
      ~ create_date          = "Monday, 15-Jul-24 11:25:30 EEST" -> (known after apply)
      + csp_connections      = (known after apply)
      ~ distance_band        = "METRO" -> (known after apply)
      ~ last_updated         = "Monday, 15-Jul-24 11:26:04 EEST" -> (known after apply)
      ~ live_date            = "Monday, 15-Jul-24 11:26:38 EEST" -> (known after apply)
      ~ locked               = false -> (known after apply)
      + port_interfaces      = (known after apply)
      ~ product_type         = "VXC" -> (known after apply)
      ~ provisioning_status  = "LIVE" -> (known after apply)
      + secondary_name       = (known after apply)
      ~ service_id           = 0 -> (known after apply)
      ~ shutdown             = false -> (known after apply)
      ~ usage_algorithm      = "POST_PAID_HOURLY_SPEED_METRO_VXC" -> (known after apply)
      + virtual_router       = (known after apply)
      ~ vll                  = {
          ~ a_vlan          = 2674 -> (known after apply)
          ~ b_vlan          = 2674 -> (known after apply)
          ~ description     = "" -> (known after apply)
          ~ id              = 0 -> (known after apply)
          ~ name            = "" -> (known after apply)
          ~ rate_limit_mbps = 100 -> (known after apply)
          ~ resource_name   = "vll" -> (known after apply)
          ~ resource_type   = "vll" -> (known after apply)
        } -> (known after apply)
      ~ vxc_approval         = {
          ~ message   = "" -> (known after apply)
          ~ new_speed = 0 -> (known after apply)
          ~ status    = "" -> (known after apply)
          ~ type      = "" -> (known after apply)
          ~ uid       = "" -> (known after apply)
        } -> (known after apply)
        # (7 unchanged attributes hidden)
    }

Plan: 0 to add, 5 to change, 0 to destroy.
mega-alex commented 2 months ago

Currently we're working on an update that will reduce the number of fields that have (known after apply) when building a plan, but it is unavoidable for quite a few values unfortunately.

For example, say you want to move a VXC from one product to another by changing the requested_product_uid field (which is possible: see the docs) that can potentially change the attributes like virutal_router, port_interfaces, a_end.product_name, b_end.product_name, location, location_id, etc. Because of this it isn't possible for the provider to use the existing state to know these values before the plan is applied, and if they change the user will see an error like:

 Error: Provider produced inconsistent result after apply

One thing to note though that might help you feel better about changes, is that there aren't too many things that can be updated once a product has been built. The updates that are possible in megaportgo for a VXC are:

// UpdateVXCRequest represents a request to update a VXC in the Megaport VXC API.
type UpdateVXCRequest struct {
    AEndVLAN       *int
    BEndVLAN       *int
    AEndProductUID *string
    BEndProductUID *string
    RateLimit      *int
    Name           *string
    CostCentre     *string
    Term           *int
    Shutdown       *bool

    AEndInnerVLAN *int
    BEndInnerVLAN *int

    WaitForUpdate bool          // Wait until the VXC updates before returning
    WaitForTime   time.Duration // How long to wait for the VXC to update if WaitForUpdate is true (default is 5 minutes)
}

Other products have similarly small update surfaces, where most major changes will require the product to be rebuilt. You would see this clearly in the provider.

I'll leave this issue open for now, and provide an update once a few more of these fields have had a PlanModifier added to allow them to use the existing state.

mega-alex commented 2 months ago

Mind giving this a try with v1.1.0-beta? It should reduce the number of fields that are known after apply, and remove a few redundant attributes.

Kostoprav19 commented 2 months ago

Will definately do, but please expext delay until 29.07. I am currently out of office without pc access

Kostoprav19 commented 2 months ago

Hello!

With provider version v1.1.0-beta2 I definitely see less changes in the terraform plan. And vlan id also was not changed.

But still enough changes to be worried about the net result of the change. For example why inner_vlan is marked with + sign. It makes me think that vlan will be changed.

# megaport_vxc.aws[0] will be updated in-place
  ~ resource "megaport_vxc" "aws" {
      ~ a_end                = {
          ~ current_product_uid   = "85613ea7-3b27-458e-88da-a80e6e04faab" -> (known after apply)
          + inner_vlan            = (known after apply)
          ~ location              = "Equinix PA2/3" -> (known after apply)
          ~ location_id           = 515 -> (known after apply)
          ~ product_name          = "TEST-EU-Paris-ICSS-MVE" -> (known after apply)
            # (6 unchanged attributes hidden)
        }

Full putput:

Terraform will perform the following actions:

  # megaport_mve.fortigate will be updated in-place
  ~ resource "megaport_mve" "fortigate" {
      ~ contract_start_date    = "Monday, 29-Jul-24 16:34:40 EEST" -> (known after apply)
      ~ cost_centre            = "A-123-2024-GER-123-124" -> "A-123-2024-GER-123-125"
      ~ last_updated           = "Monday, 29-Jul-24 16:34:33 EEST" -> (known after apply)
      ~ live_date              = "Monday, 29-Jul-24 16:34:40 EEST" -> (known after apply)
      ~ provisioning_status    = "LIVE" -> (known after apply)
      + terminate_date         = (known after apply)
        # (26 unchanged attributes hidden)
    }

  # megaport_port.ipxgrx will be updated in-place
  ~ resource "megaport_port" "ipxgrx" {
      ~ contract_end_date      = "Monday, 28-Jul-25 17:00:00 EEST" -> (known after apply)
      ~ contract_start_date    = "Monday, 29-Jul-24 16:34:40 EEST" -> (known after apply)
      ~ cost_centre            = "A-123-2024-GER-123-124" -> "A-123-2024-GER-123-125"
      ~ create_date            = "Monday, 29-Jul-24 16:34:00 EEST" -> (known after apply)
      ~ last_updated           = "Monday, 29-Jul-24 16:34:33 EEST" -> (known after apply)
      ~ live_date              = "Monday, 29-Jul-24 16:34:40 EEST" -> (known after apply)
      ~ provisioning_status    = "LIVE" -> (known after apply)
      ~ resources              = {
          ~ interface = {
              ~ demarcation = <<-EOT
                    Equinix PA2/3
                    114 Rue Ambroise Croizat, Saint Denis
                    0210
                    Type: Single-mode Fibre Pair
                    Ports: PP:0210:1177142, ports 11+12
                    Termination: SC connector
                EOT -> (known after apply)
              ~ up          = 1 -> (known after apply)
            } -> (known after apply)
        } -> (known after apply)
      + terminate_date         = (known after apply)
        # (17 unchanged attributes hidden)
    }

  # megaport_vxc.aws[0] will be updated in-place
  ~ resource "megaport_vxc" "aws" {
      ~ a_end                = {
          ~ current_product_uid   = "85613ea7-3b27-458e-88da-a80e6e04faab" -> (known after apply)
          + inner_vlan            = (known after apply)
          ~ location              = "Equinix PA2/3" -> (known after apply)
          ~ location_id           = 515 -> (known after apply)
          ~ product_name          = "TEST-EU-Paris-ICSS-MVE" -> (known after apply)
            # (6 unchanged attributes hidden)
        }
      ~ b_end                = {
          ~ current_product_uid   = "09e400a0-1b72-49ec-8ff0-5a71a4fc7774" -> (known after apply)
          + inner_vlan            = (known after apply)
          ~ location              = "Interxion PAR5" -> (known after apply)
          ~ location_id           = 527 -> (known after apply)
          ~ product_name          = "EU (Paris) (eu-west-3)" -> (known after apply)
            # (6 unchanged attributes hidden)
        }
      ~ contract_end_date    = "Wednesday, 28-Aug-24 17:00:00 EEST" -> (known after apply)
      ~ contract_start_date  = "Monday, 29-Jul-24 16:35:20 EEST" -> (known after apply)
      ~ cost_centre          = "A-123-2024-GER-123-124" -> "A-123-2024-GER-123-125"
      ~ create_date          = "Monday, 29-Jul-24 16:34:38 EEST" -> (known after apply)
      ~ last_updated         = "Monday, 29-Jul-24 16:35:14 EEST" -> (known after apply)
      ~ live_date            = "Monday, 29-Jul-24 16:35:20 EEST" -> (known after apply)
      ~ provisioning_status  = "LIVE" -> (known after apply)
        # (19 unchanged attributes hidden)
    }

  # megaport_vxc.internet will be updated in-place
  ~ resource "megaport_vxc" "internet" {
      ~ a_end                = {
          ~ current_product_uid   = "85613ea7-3b27-458e-88da-a80e6e04faab" -> (known after apply)
          + inner_vlan            = (known after apply)
          ~ location              = "Equinix PA2/3" -> (known after apply)
          ~ location_id           = 515 -> (known after apply)
          ~ product_name          = "TEST-EU-Paris-ICSS-MVE" -> (known after apply)
            # (6 unchanged attributes hidden)
        }
      ~ b_end                = {
          ~ current_product_uid   = "52cb6573-5cc8-45cc-8af1-d21db1fe3485" -> (known after apply)
          + inner_vlan            = (known after apply)
          ~ location              = "Equinix PA2/3" -> (known after apply)
          ~ location_id           = 515 -> (known after apply)
          ~ product_name          = "Megaport Internet" -> (known after apply)
            # (6 unchanged attributes hidden)
        }
      ~ contract_end_date    = "Monday, 28-Jul-25 17:00:00 EEST" -> (known after apply)
      ~ contract_start_date  = "Monday, 29-Jul-24 16:35:20 EEST" -> (known after apply)
      ~ cost_centre          = "A-123-2024-GER-123-124" -> "A-123-2024-GER-123-125"
      ~ create_date          = "Monday, 29-Jul-24 16:34:37 EEST" -> (known after apply)
      ~ last_updated         = "Monday, 29-Jul-24 16:35:12 EEST" -> (known after apply)
      ~ live_date            = "Monday, 29-Jul-24 16:35:20 EEST" -> (known after apply)
      ~ provisioning_status  = "LIVE" -> (known after apply)
        # (18 unchanged attributes hidden)
    }

  # megaport_vxc.ipxgrx[0] will be updated in-place
  ~ resource "megaport_vxc" "ipxgrx" {
      ~ a_end                = {
          ~ current_product_uid   = "85613ea7-3b27-458e-88da-a80e6e04faab" -> (known after apply)
          + inner_vlan            = (known after apply)
          ~ location              = "Equinix PA2/3" -> (known after apply)
          ~ location_id           = 515 -> (known after apply)
          ~ product_name          = "TEST-EU-Paris-ICSS-MVE" -> (known after apply)
            # (6 unchanged attributes hidden)
        }
      ~ b_end                = {
          ~ current_product_uid   = "daff9778-76d6-4df3-bae3-25bc2cf508ae" -> (known after apply)
          + inner_vlan            = (known after apply)
          ~ location              = "Equinix PA2/3" -> (known after apply)
          ~ location_id           = 515 -> (known after apply)
          ~ product_name          = "TEST-EU-Paris-ICSS-Port" -> (known after apply)
            # (6 unchanged attributes hidden)
        }
      ~ contract_end_date    = "Wednesday, 28-Aug-24 17:00:00 EEST" -> (known after apply)
      ~ contract_start_date  = "Monday, 29-Jul-24 16:35:20 EEST" -> (known after apply)
      ~ cost_centre          = "A-123-2024-GER-123-124" -> "A-123-2024-GER-123-125"
      ~ create_date          = "Monday, 29-Jul-24 16:34:36 EEST" -> (known after apply)
      + csp_connections      = (known after apply)
      ~ last_updated         = "Monday, 29-Jul-24 16:35:11 EEST" -> (known after apply)
      ~ live_date            = "Monday, 29-Jul-24 16:35:20 EEST" -> (known after apply)
      ~ provisioning_status  = "LIVE" -> (known after apply)
        # (17 unchanged attributes hidden)
    }

Plan: 0 to add, 5 to change, 0 to destroy.Terraform will perform the following actions:

  # megaport_mve.fortigate will be updated in-place
  ~ resource "megaport_mve" "fortigate" {
      ~ contract_start_date    = "Monday, 29-Jul-24 16:34:40 EEST" -> (known after apply)
      ~ cost_centre            = "A-123-2024-GER-123-124" -> "A-123-2024-GER-123-125"
      ~ last_updated           = "Monday, 29-Jul-24 16:34:33 EEST" -> (known after apply)
      ~ live_date              = "Monday, 29-Jul-24 16:34:40 EEST" -> (known after apply)
      ~ provisioning_status    = "LIVE" -> (known after apply)
      + terminate_date         = (known after apply)
        # (26 unchanged attributes hidden)
    }

  # megaport_port.ipxgrx will be updated in-place
  ~ resource "megaport_port" "ipxgrx" {
      ~ contract_end_date      = "Monday, 28-Jul-25 17:00:00 EEST" -> (known after apply)
      ~ contract_start_date    = "Monday, 29-Jul-24 16:34:40 EEST" -> (known after apply)
      ~ cost_centre            = "A-123-2024-GER-123-124" -> "A-123-2024-GER-123-125"
      ~ create_date            = "Monday, 29-Jul-24 16:34:00 EEST" -> (known after apply)
      ~ last_updated           = "Monday, 29-Jul-24 16:34:33 EEST" -> (known after apply)
      ~ live_date              = "Monday, 29-Jul-24 16:34:40 EEST" -> (known after apply)
      ~ provisioning_status    = "LIVE" -> (known after apply)
      ~ resources              = {
          ~ interface = {
              ~ demarcation = <<-EOT
                    Equinix PA2/3
                    114 Rue Ambroise Croizat, Saint Denis
                    0210
                    Type: Single-mode Fibre Pair
                    Ports: PP:0210:1177142, ports 11+12
                    Termination: SC connector
                EOT -> (known after apply)
              ~ up          = 1 -> (known after apply)
            } -> (known after apply)
        } -> (known after apply)
      + terminate_date         = (known after apply)
        # (17 unchanged attributes hidden)
    }

  # megaport_vxc.aws[0] will be updated in-place
  ~ resource "megaport_vxc" "aws" {
      ~ a_end                = {
          ~ current_product_uid   = "85613ea7-3b27-458e-88da-a80e6e04faab" -> (known after apply)
          + inner_vlan            = (known after apply)
          ~ location              = "Equinix PA2/3" -> (known after apply)
          ~ location_id           = 515 -> (known after apply)
          ~ product_name          = "TEST-EU-Paris-ICSS-MVE" -> (known after apply)
            # (6 unchanged attributes hidden)
        }
      ~ b_end                = {
          ~ current_product_uid   = "09e400a0-1b72-49ec-8ff0-5a71a4fc7774" -> (known after apply)
          + inner_vlan            = (known after apply)
          ~ location              = "Interxion PAR5" -> (known after apply)
          ~ location_id           = 527 -> (known after apply)
          ~ product_name          = "EU (Paris) (eu-west-3)" -> (known after apply)
            # (6 unchanged attributes hidden)
        }
      ~ contract_end_date    = "Wednesday, 28-Aug-24 17:00:00 EEST" -> (known after apply)
      ~ contract_start_date  = "Monday, 29-Jul-24 16:35:20 EEST" -> (known after apply)
      ~ cost_centre          = "A-123-2024-GER-123-124" -> "A-123-2024-GER-123-125"
      ~ create_date          = "Monday, 29-Jul-24 16:34:38 EEST" -> (known after apply)
      ~ last_updated         = "Monday, 29-Jul-24 16:35:14 EEST" -> (known after apply)
      ~ live_date            = "Monday, 29-Jul-24 16:35:20 EEST" -> (known after apply)
      ~ provisioning_status  = "LIVE" -> (known after apply)
        # (19 unchanged attributes hidden)
    }

  # megaport_vxc.internet will be updated in-place
  ~ resource "megaport_vxc" "internet" {
      ~ a_end                = {
          ~ current_product_uid   = "85613ea7-3b27-458e-88da-a80e6e04faab" -> (known after apply)
          + inner_vlan            = (known after apply)
          ~ location              = "Equinix PA2/3" -> (known after apply)
          ~ location_id           = 515 -> (known after apply)
          ~ product_name          = "TEST-EU-Paris-ICSS-MVE" -> (known after apply)
            # (6 unchanged attributes hidden)
        }
      ~ b_end                = {
          ~ current_product_uid   = "52cb6573-5cc8-45cc-8af1-d21db1fe3485" -> (known after apply)
          + inner_vlan            = (known after apply)
          ~ location              = "Equinix PA2/3" -> (known after apply)
          ~ location_id           = 515 -> (known after apply)
          ~ product_name          = "Megaport Internet" -> (known after apply)
            # (6 unchanged attributes hidden)
        }
      ~ contract_end_date    = "Monday, 28-Jul-25 17:00:00 EEST" -> (known after apply)
      ~ contract_start_date  = "Monday, 29-Jul-24 16:35:20 EEST" -> (known after apply)
      ~ cost_centre          = "A-123-2024-GER-123-124" -> "A-123-2024-GER-123-125"
      ~ create_date          = "Monday, 29-Jul-24 16:34:37 EEST" -> (known after apply)
      ~ last_updated         = "Monday, 29-Jul-24 16:35:12 EEST" -> (known after apply)
      ~ live_date            = "Monday, 29-Jul-24 16:35:20 EEST" -> (known after apply)
      ~ provisioning_status  = "LIVE" -> (known after apply)
        # (18 unchanged attributes hidden)
    }

  # megaport_vxc.ipxgrx[0] will be updated in-place
  ~ resource "megaport_vxc" "ipxgrx" {
      ~ a_end                = {
          ~ current_product_uid   = "85613ea7-3b27-458e-88da-a80e6e04faab" -> (known after apply)
          + inner_vlan            = (known after apply)
          ~ location              = "Equinix PA2/3" -> (known after apply)
          ~ location_id           = 515 -> (known after apply)
          ~ product_name          = "TEST-EU-Paris-ICSS-MVE" -> (known after apply)
            # (6 unchanged attributes hidden)
        }
      ~ b_end                = {
          ~ current_product_uid   = "daff9778-76d6-4df3-bae3-25bc2cf508ae" -> (known after apply)
          + inner_vlan            = (known after apply)
          ~ location              = "Equinix PA2/3" -> (known after apply)
          ~ location_id           = 515 -> (known after apply)
          ~ product_name          = "TEST-EU-Paris-ICSS-Port" -> (known after apply)
            # (6 unchanged attributes hidden)
        }
      ~ contract_end_date    = "Wednesday, 28-Aug-24 17:00:00 EEST" -> (known after apply)
      ~ contract_start_date  = "Monday, 29-Jul-24 16:35:20 EEST" -> (known after apply)
      ~ cost_centre          = "A-123-2024-GER-123-124" -> "A-123-2024-GER-123-125"
      ~ create_date          = "Monday, 29-Jul-24 16:34:36 EEST" -> (known after apply)
      + csp_connections      = (known after apply)
      ~ last_updated         = "Monday, 29-Jul-24 16:35:11 EEST" -> (known after apply)
      ~ live_date            = "Monday, 29-Jul-24 16:35:20 EEST" -> (known after apply)
      ~ provisioning_status  = "LIVE" -> (known after apply)
        # (17 unchanged attributes hidden)
    }

Plan: 0 to add, 5 to change, 0 to destroy.
MegaportPhilipBrowne commented 2 months ago

Hello, we just released a new version v1.1.0 yesterday. Can you give it a try and see if you run into any additional issues with inner_vlan changing unexpectedly from the initial plan? Thanks!

Kostoprav19 commented 2 months ago

Hi! Already checked today. It is behaving the same as beta2. The same plan output and apply results.

Regarding the inner_vlan I have created separate issue for b_end inner_vlan unexpected change - https://github.com/megaport/terraform-provider-megaport/issues/126

mega-alex commented 2 months ago

It seems like all issues here were addressed with #126, so going to close this.