openstack_networking_router_v2
These instructions are an adapted copy of the official OpenStack Terraform provider documentation in the Terraform Registry.
Manages a V2 router resource within OpenStack.
Example Usage
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
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, theregionargument of the provider is used. Changing this creates a newrouter. -
name— (Optional) A unique name for the router. Changing thisupdates thenameof an existing router. -
description— (Optional) Human-readable description for the router. -
admin_state_up— (Optional) Administrative up/down status for the router(must be "true" or "false" if provided). Changing this updates theadmin_state_upof an existing router. -
distributed— (Optional) Indicates whether or not to create adistributed router. The default policy setting in Neutron restrictsusage of this property to administrative users only. -
external_gateway— ( Deprecated — useexternal_network_idinstead) Thenetwork UUID of an external gateway for the router. A router with anexternal gateway is required if any compute instances or load balancerswill be using floating IPs. Changing this updates the external gatewayof an existing router. -
external_network_id— (Optional) The network UUID of an external gatewayfor the router. A router with an external gateway is required if anycompute instances or load balancers will be using floating IPs.The external network is a service network that cannot be changed and must be assigned viathe openstack_networking_network_v2 data source. -
enable_snat— (Optional) Enable Source NAT for the router. Valid values are "true" or "false". Anexternal_network_idhas to be set in order toset this property. Changing this updates theenable_snatof the router.Setting this value requires an ext-gw-mode extension to be enabledin OpenStack Neutron. -
tenant_id— (Optional) The owner of the floating IP. Required if admin wantsto create a router for another tenant. Changing this creates a new router. -
value_specs— (Optional) 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 makenetwork resources highly available. Used for resources with high availabilityso that they are scheduled on different availability zones. Changing thiscreates a new router.
The vendor_options block supports:
set_router_gateway_after_create— (Optional) Boolean to control whetherthe Router gateway is assigned during creation or updated after creation.
Attributes Reference
The following attributes are exported:
id— ID of the router.region— See Argument Reference above.name— See Argument Reference above.description— See Argument Reference above.admin_state_up— See Argument Reference above.external_gateway— See Argument Reference above.external_network_id— See Argument Reference above.enable_snat— See Argument Reference above.external_fixed_ip— An external fixed IP for the router. Assigned automatically when theexternal_network_idargument is specified.tenant_id— See Argument Reference above.value_specs— See Argument Reference above.availability_zone_hints— See Argument Reference above.tags— See Argument Reference above.all_tags— The collection of tags assigned on the router, which have been explicitly and implicitly added.
Import
Routers can be imported using the id, e.g.
$ terraform import openstack_networking_router_v2.router_1 014395cd-89fc-4c9b-96b7-13d1ee79dad2