|
| 1 | +--- |
| 2 | +subcategory: "VPC" |
| 3 | +page_title: "Scaleway: scaleway_vpc_route" |
| 4 | +--- |
| 5 | + |
| 6 | +# Resource: scaleway_vpc_route |
| 7 | + |
| 8 | +Creates and manages Scaleway VPC Routes. |
| 9 | +For more information, see [the main documentation](https://www.scaleway.com/en/docs/network/vpc/concepts/). |
| 10 | + |
| 11 | +## Example Usage |
| 12 | + |
| 13 | +### Basic |
| 14 | + |
| 15 | +```terraform |
| 16 | +resource "scaleway_vpc" "vpc01" { |
| 17 | + name = "tf-vpc-vpn" |
| 18 | +} |
| 19 | +
|
| 20 | +resource "scaleway_vpc_private_network" "pn01" { |
| 21 | + name = "tf-pn-vpn" |
| 22 | + ipv4_subnet { |
| 23 | + subnet = "172.16.64.0/22" |
| 24 | + } |
| 25 | + vpc_id = scaleway_vpc.vpc01.id |
| 26 | +} |
| 27 | +
|
| 28 | +resource "scaleway_instance_server" "server01" { |
| 29 | + name = "tf-server-vpn" |
| 30 | + type = "PLAY2-MICRO" |
| 31 | + image = "openvpn" |
| 32 | +} |
| 33 | +
|
| 34 | +resource "scaleway_instance_private_nic" "pnic01" { |
| 35 | + private_network_id = scaleway_vpc_private_network.pn01.id |
| 36 | + server_id = scaleway_instance_server.server01.id |
| 37 | +} |
| 38 | +
|
| 39 | +resource "scaleway_vpc_route" "rt01" { |
| 40 | + vpc_id = scaleway_vpc.vpc01.id |
| 41 | + description = "tf-route-vpn" |
| 42 | + tags = ["tf", "route"] |
| 43 | + destination = "10.0.0.0/24" |
| 44 | + nexthop_resource_id = scaleway_instance_private_nic.pnic01.id |
| 45 | +} |
| 46 | +``` |
| 47 | + |
| 48 | +## Argument Reference |
| 49 | + |
| 50 | +The following arguments are supported: |
| 51 | + |
| 52 | +- `vpc_id` - (Required) The VPC ID the route belongs to. |
| 53 | +- `description` - (Optional) The route description. |
| 54 | +- `tags` - (Optional) The tags to associate with the route. |
| 55 | +- `destination` - (Optional) The destination of the route. |
| 56 | +- `nexthop_resource_id` - (Optional) The ID of the nexthop resource. |
| 57 | +- `nexthop_private_network_id` - (Optional) The ID of the nexthop private network. |
| 58 | +- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#regions) of the route. |
| 59 | +- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the Project the route is associated with. |
| 60 | + |
| 61 | +## Attributes Reference |
| 62 | + |
| 63 | +In addition to all arguments above, the following attributes are exported: |
| 64 | + |
| 65 | +- `id` - The ID of the route. |
| 66 | +- `created_at` - The date and time of the creation of the route (RFC 3339 format). |
| 67 | +- `updated_at` - The date and time of the creation of the route (RFC 3339 format). |
| 68 | + |
| 69 | +~> **Important:** routes' IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111 |
| 70 | + |
| 71 | +## Import |
| 72 | + |
| 73 | +Routes can be imported using `{region}/{id}`, e.g. |
| 74 | + |
| 75 | +```bash |
| 76 | +terraform import scaleway_vpc_route.main fr-par/11111111-1111-1111-1111-111111111111 |
| 77 | +``` |
0 commit comments