Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Support azurerm expressroute connection #9849

Open
digiwhite1980 opened this issue Dec 14, 2020 · 9 comments
Open

Support azurerm expressroute connection #9849

digiwhite1980 opened this issue Dec 14, 2020 · 9 comments

Comments

@digiwhite1980
Copy link

Support azurerm expressroute connection to expressroute gateway

There seems to be no support for creating an actual connection between an ExpressRoute gateway and the ExpressRoute connection.

From the Azure Portal you need to "connect circuit" between the ExpressRoute Gateway and the ExpressRoute connection.
This connection is mandatory for having an actual traffic flow over the ExpressRoute.

A resource like "azurerm_express_route_connection" would fit the functionality.
The Azure resource which needs to be implemented is documented:
https://docs.microsoft.com/en-us/powershell/module/az.network/set-azexpressrouteconnection?view=azps-5.1.0#example-1

datasources:

  • Name
  • ResourceGroup
  • ExpressRouteGatewayID
  • ExpressRouteCircuitPeeringID
  • Weight

Please advice.

Raymond

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

New or Affected Resource(s)

  • azurerm_XXXXX

Potential Terraform Configuration

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key.

References

  • #0000
@digiwhite1980 digiwhite1980 changed the title Support azurerm expressroute connetion Support azurerm expressroute connection Dec 14, 2020
@ShuheiUda
Copy link

Let me clarify.

If you need to connect between ExpressRoute Circuit and Virtual Network Gateway for ExpressRoute, you should use azurerm_virtual_network_gateway_connection with express_route_circuit_id argument.

The other hands, if you need to connect ExpressRoute Circuit and ExpressRoute Gateway for Virtual WAN, there seems to be no support for creating "expressRouteConnections".
In my understanding, "expressRouteConnections" are sub-resource under "expressRouteGateways".
Therefore, "azurerm_express_route_gateway" need more arguments for creating "expressRouteConnections", I think.

Azure REST API Reference:
Express Route Gateways - Create Or Update
Express Route Connections - Create Or Update

@digiwhite1980
Copy link
Author

I need to connect ExpressRoute Circuit and ExpressRoute Gateway for Virtual WAN so indeed it is lacking support.
thank you for clarifying.

@amsgeodis

This comment has been minimized.

@baseif

This comment has been minimized.

@ShuheiUda
Copy link

I found workaround.
Hope this helps.

resource "azurerm_resource_group_template_deployment" "example" {
  name                = "example"
  resource_group_name = azurerm_resource_group.example.name
  deployment_mode     = "Incremental"
  parameters_content = jsonencode(
    {
      "expressRouteCircuitPeeringId" = { value = join("/", [azurerm_express_route_circuit.example.id, "peerings/AzurePrivatePeering"]) },
      "authorizationKey"             = { value = azurerm_express_route_circuit_authorization.example.authorization_key }
    }
  )
  template_content = <<TEMPLATE
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
      "expressRouteCircuitPeeringId": {
        "type": "string"
      },
		  "authorizationKey": {
			  "type": "string"
		  }
    },
    "resources": [
        {
            "name": "azure-express-route-gateway/azure-express-route-gateway-connection",
            "type": "Microsoft.Network/expressRouteGateways/expressRouteConnections",
            "apiVersion": "2020-08-01",
            "properties": {
                "expressRouteCircuitPeering": {
                    "id": "[parameters('expressRouteCircuitPeeringId')]"
                },
                "authorizationKey": "[parameters('authorizationKey')]"
            }
        }
    ]
}
TEMPLATE
}

@amsgeodis
Copy link

As a temporary hack, we used null_resource and azure cli to get around this issue. But a hack is always a hack. Hope this will get addressed sometime in the near future. Thank you @ShuheiUda for posting a solution.

@baseif
Copy link

baseif commented Apr 9, 2021

I found workaround.
Hope this helps.

resource "azurerm_resource_group_template_deployment" "example" {
  name                = "example"
  resource_group_name = azurerm_resource_group.example.name
  deployment_mode     = "Incremental"
  parameters_content = jsonencode(
    {
      "expressRouteCircuitPeeringId" = { value = join("/", [azurerm_express_route_circuit.example.id, "peerings/AzurePrivatePeering"]) },
      "authorizationKey"             = { value = azurerm_express_route_circuit_authorization.example.authorization_key }
    }
  )
  template_content = <<TEMPLATE
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
      "expressRouteCircuitPeeringId": {
        "type": "string"
      },
		  "authorizationKey": {
			  "type": "string"
		  }
    },
    "resources": [
        {
            "name": "azure-express-route-gateway/azure-express-route-gateway-connection",
            "type": "Microsoft.Network/expressRouteGateways/expressRouteConnections",
            "apiVersion": "2020-08-01",
            "properties": {
                "expressRouteCircuitPeering": {
                    "id": "[parameters('expressRouteCircuitPeeringId')]"
                },
                "authorizationKey": "[parameters('authorizationKey')]"
            }
        }
    ]
}
TEMPLATE
}

@ShuheiUda can you confirm that it works for you?
here is what I got as an error.

Error: validating Template Deployment "example" (Resource Group "xxx-RG"): requesting validating: resources.DeploymentsClient#Validate: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidTemplate" Message="Deployment template validation failed: 'The template resource 'XXX-ER_GW-ExRConnection' for type 'Microsoft.Network/expressRouteGateways/expressRouteConnections' at line '1' and column '1130' has incorrect segment lengths. A nested resource type must have identical number of segments as its resource name. A root resource type must have segment length one greater than its resource name. Please see https://aka.ms/arm-template/#resources for usage details.'." AdditionalInfo=[{"info":{"lineNumber":1,"linePosition":1130,"path":"properties.template.resources[0].type"},"type":"TemplateViolation"}]

@kahawai-sre

This comment has been minimized.

@katbyte
Copy link
Collaborator

katbyte commented Jun 24, 2021

might be solved by #11320

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

No branches or pull requests

6 participants