---
title: "openstack_networking_router_v2"
description: ""
sidebar_position: 11
---

# openstack\_networking\_router\_v2

:::info

This instruction is an adapted copy of the official documentation for the OpenStack Terraform provider in the [Terraform Registry](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/latest/docs).

:::

Manages a V2 router resource in OpenStack.

## Example Usage \{#example-usage}

```hcl
data "openstack_networking_network_v2" "external_network_1" {
  external = true
}

resource "openstack_networking_router_v2" "router_1" {
  name                = "my_router"
  admin_state_up      = true
  external_network_id = data.openstack_networking_network_v2.external_network_1.id
}
```

## Argument Reference \{#argument-reference}

The following arguments are supported:

* `region` - (Optional) The region in which to obtain the V2 networking client. A networking client is needed to create a router. If omitted, the `region` argument of the provider is used. Changing this creates a new router.

* `name` - (Optional) A unique name for the router. Changing this updates the `name` of an existing router.

* `description` - (Optional) Human-readable description of the router.

* `admin_state_up` - (Optional) Administrative up/down status for the router (must be "true" or "false" if provided). Changing this updates the `admin_state_up` of an existing router.

* `distributed` - (Optional) Indicates whether or not to create a distributed router. The default policy setting in Neutron restricts usage of this property to administrative users only.

* `external_gateway` - ( **Deprecated** - use `external_network_id` instead) The network UUID of an external gateway for the router. A router with an external gateway is required if any compute instances or load balancers will be using floating IPs. Changing this updates the external gateway of an existing router.

* `external_network_id` - (Optional) The network UUID of an external gateway for the router. A router with an external gateway is required if any compute instances or load balancers will be using floating IPs. The external network is a service network that cannot be changed and must be assigned via the [openstack\_networking\_network\_v2](/terraform/openstack-provider-reference/networking-neutron/data-sources/openstack_networking_network_v2/) data source.

* `enable_snat` - (Optional) Enable Source NAT for the router. Valid values are "true" or "false". An `external_network_id` has to be set in order to set this property. Changing this updates the `enable_snat` of the router. Setting this value **requires** an **ext-gw-mode** extension to be enabled in OpenStack Neutron.

* `tenant_id` - (Optional) The owner of the floating IP. Required if admin wants to create a router for another tenant. Changing this creates a new router.

* `value_specs` - (Optional) A map of additional driver-specific options.

* `tags` - (Optional) A set of string tags for the router.

* `vendor_options` - (Optional) Map of additional vendor-specific options. Supported options are described below.

* `availability_zone_hints` - (Optional) An availability zone is used to make network resources highly available. Used for resources with high availability so that they are scheduled on different availability zones. Changing this creates a new router.

The `vendor_options` block supports the following:

* `set_router_gateway_after_create` - (Optional) Boolean to control whether the Router gateway is assigned during creation or updated after creation.

## Attributes Reference \{#attributes-reference}

The following attributes are exported:

* `id` - The ID of the router.
* `region` - See the Argument Reference section above.
* `name` - See the Argument Reference section above.
* `description` - See the Argument Reference section above.
* `admin_state_up` - See the Argument Reference section above.
* `external_gateway` - See the Argument Reference section above.
* `external_network_id` - See the Argument Reference section above.
* `enable_snat` - See the Argument Reference section above.
* `external_fixed_ip` - An external fixed IP for the router. Assigned automatically when the `external_network_id` argument is specified.
* `tenant_id` - See the Argument Reference section above.
* `value_specs` - See the Argument Reference section above.
* `availability_zone_hints` - See the Argument Reference section above.
* `tags` - See the Argument Reference section above.
* `all_tags` - The collection of tags assigned on the router, which have been explicitly and implicitly added.

## Import \{#import}

Routers can be imported using the `id`, e.g.

```bash
$ terraform import openstack_networking_router_v2.router_1 014395cd-89fc-4c9b-96b7-13d1ee79dad2
```
