Skip to content

Network - fix TestAccExpressRouteCircuitConnection, TestAccExpressRouteConnection, and TestAccVirtualNetworkGateway_*#31414

Draft
v-yhyeo0202 wants to merge 18 commits intohashicorp:mainfrom
v-yhyeo0202:fix-network-acctest-sensitive-diff
Draft

Network - fix TestAccExpressRouteCircuitConnection, TestAccExpressRouteConnection, and TestAccVirtualNetworkGateway_*#31414
v-yhyeo0202 wants to merge 18 commits intohashicorp:mainfrom
v-yhyeo0202:fix-network-acctest-sensitive-diff

Conversation

@v-yhyeo0202
Copy link
Copy Markdown
Collaborator

@v-yhyeo0202 v-yhyeo0202 commented Dec 26, 2025

Community Note

  • Please vote on this PR by adding a 👍 reaction to the original PR to help the community and maintainers prioritize for review
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for PR followers and do not help prioritize for review

Description

TestAccExpressRouteCircuitConnection fails due to unavailability of bandwidth at current peering_location of azurerm_express_route_port resource as shown in the error log below. The peering_location is changed to the one with bandwidth. Another error affecting TestAccExpressRouteCircuitConnection is caused by the updating of virtual hub by multiple azurerm_route_map at the same time. To avoid the error, virtual hub lock is added to azurerm_route_map.

    testcase.go:199: Step 1/2 error: Error running apply: exit status 1
        Error: creating Express Route Port (Subscription: "*******"
        Resource Group Name: "REDACTED"
        Express Route Port Name: "REDACTED"): performing CreateOrUpdate: unexpected status 400 (400 Bad Request) with error: ExpressRoutePortsNotAvailable: ExpressRoutePorts /subscriptions/*******/resourceGroups/REDACTED/providers/Microsoft.Network/expressRoutePorts/REDACTED cannot be created as requested bandwidth 10 is not available at peering location Equinix-Osaka-OS1.
          with azurerm_express_route_port.test,
          on terraform_plugin_test.tf line 38, in resource "azurerm_express_route_port" "test":
          38: resource "azurerm_express_route_port" "test" {

The following network resource tests fail due to non-empty non-refresh plan as shown in the error log below. This happens as the Sensitive authorization_key property is not stored in Terraform state. To avoid the perpetual difference, authorization_key is set with the value from Terraform configurations when Read method is called.

TestAccVirtualNetworkGateway_vpnClientConfig
TestAccVirtualNetworkGateway_vpnClientConfigMultipleAuthTypes
TestAccExpressRouteConnection

Error log

    testcase.go:199: Step 1/2 error: After applying this test step, the non-refresh plan was not empty.
        stdout:
        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:
          # azurerm_express_route_connection.test will be updated in-place
          ~ resource "azurerm_express_route_connection" "test" {
              ~ authorization_key                    = "*****************" -> "REDACTED"
                id                                   = "/subscriptions/*******/resourceGroups/REDACTED/providers/Microsoft.Network/expressRouteGateways/REDACTED/expressRouteConnections/REDACTED"
                name                                 = "REDACTED"
                # (6 unchanged attributes hidden)
                # (1 unchanged block hidden)
            }

PR Checklist

  • I have followed the guidelines in our Contributing Documentation.
  • I have checked to ensure there aren't other open Pull Requests for the same update/change.
  • I have checked if my changes close any open issues. If so please include appropriate closing keywords below.
  • I have updated/added Documentation as required written in a helpful and kind way to assist users that may be unfamiliar with the resource / data source.
  • I have used a meaningful PR title to help maintainers and other users understand this change and help prevent duplicate work.
    For example: “resource_name_here - description of change e.g. adding property new_property_name_here

Changes to existing Resource / Data Source

  • I have added an explanation of what my changes do and why I'd like you to include them (This may be covered by linking to an issue above, but may benefit from additional explanation).
  • I have written new tests for my resource or datasource changes & updated any relevant documentation.
  • I have successfully run tests with my changes locally. If not, please provide details on testing challenges that prevented you running the tests.
  • (For changes that include a state migration only). I have manually tested the migration path between relevant versions of the provider.

Testing

  • My submission includes Test coverage as described in the Contribution Guide and the tests pass. (if this is not possible for any reason, please include details of why you did or could not add test coverage)

https://hashicorp.teamcity.com/buildConfiguration/TF_AzureRM_AZURERM_SERVICE_PUBLIC_NETWORK/630782?buildTab=overview
image

TestAccExpressRouteConnection fails due to intermittent context deadline exceeded error. The other failed tests are caused by intermittent errors or pre-existing in main branch test run.

Change Log

Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.

  • azurerm_express_route_circuit_connection - fix TestAccExpressRouteCircuitConnection
  • azurerm_express_route_connection - fix TestAccExpressRouteConnection
  • azurerm_virtual_network_gateway - fix TestAccVirtualNetworkGateway_vpnClientConfig and TestAccVirtualNetworkGateway_vpnClientConfigMultipleAuthTypes
  • azurerm_route_map - add virtual hub lock

This is a (please select all that apply):

  • Bug Fix
  • New Feature (ie adding a service, resource, or data source)
  • Enhancement
  • Breaking Change

Rollback Plan

If a change needs to be reverted, we will publish an updated version of the provider.

Note

If this PR changes meaningfully during the course of review please update the title and description as required.

@gerrytan gerrytan self-requested a review January 12, 2026 02:20
Copy link
Copy Markdown
Collaborator

@gerrytan gerrytan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay in reviewing this @v-yhyeo0202 . However can you please merge latest main and check if someone else already fixed the problem mentioned.

For example I checked TestAccVPNServerConfigurationPolicyGroup_complete and it's been passing since around Jan

Image

https://hashicorp.teamcity.com/test/-8157610531230417478?currentProjectId=TF_AzureRM

@github-actions github-actions Bot added the size/L label Mar 3, 2026
@v-yhyeo0202
Copy link
Copy Markdown
Collaborator Author

v-yhyeo0202 commented Mar 3, 2026

Sorry for the delay in reviewing this @v-yhyeo0202 . However can you please merge latest main and check if someone else already fixed the problem mentioned.

For example I checked TestAccVPNServerConfigurationPolicyGroup_complete and it's been passing since around Jan

Image https://hashicorp.teamcity.com/test/-8157610531230417478?currentProjectId=TF_AzureRM

@gerrytan, no problem, seems that most of the issues related to non-refresh plan of sensitive property is fixed in this changes. I will revert the unnecessary changes and correct the title and descriptions accordingly.

@github-actions github-actions Bot added size/XS and removed size/L labels Mar 3, 2026
@v-yhyeo0202 v-yhyeo0202 changed the title Network - fix acceptance test issues related to non-empty non-refresh plan due to Sensitive properties Network - fix TestAccExpressRouteCircuitConnection, TestAccExpressRouteConnection, and `TestAccVirtualNetworkGateway_*' Mar 16, 2026
@v-yhyeo0202 v-yhyeo0202 changed the title Network - fix TestAccExpressRouteCircuitConnection, TestAccExpressRouteConnection, and `TestAccVirtualNetworkGateway_*' Network - fix TestAccExpressRouteCircuitConnection, TestAccExpressRouteConnection, and TestAccVirtualNetworkGateway_* Mar 16, 2026
@v-yhyeo0202 v-yhyeo0202 requested a review from gerrytan April 9, 2026 01:19
@v-yhyeo0202
Copy link
Copy Markdown
Collaborator Author

Latest test results
https://hashicorp.teamcity.com/buildConfiguration/TF_AzureRM_AZURERM_SERVICE_PUBLIC_NETWORK/630782?buildTab=overview
image

TestAccExpressRouteConnection fails due to intermittent context deadline exceeded error. The other failed tests are caused by intermittent errors or pre-existing in main branch test run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants