Skip to content

Commit 9e5664d

Browse files
authored
Router route resource and datasource (#423)
Tested against the dogfood rack: ```console $ TEST_ACC_NAME=TestAccCloudResourceVPCRouterRoute_full make testacc -> Running terraform acceptance tests === RUN TestAccCloudResourceVPCRouterRoute_full === PAUSE TestAccCloudResourceVPCRouterRoute_full === CONT TestAccCloudResourceVPCRouterRoute_full --- PASS: TestAccCloudResourceVPCRouterRoute_full (17.90s) PASS ok github.com/oxidecomputer/terraform-provider-oxide/internal/provider 18.327s $ TEST_ACC_NAME=TestAccCloudDataSourceVPCRouterRoute_full make testacc -> Running terraform acceptance tests === RUN TestAccCloudDataSourceVPCRouterRoute_full === PAUSE TestAccCloudDataSourceVPCRouterRoute_full === CONT TestAccCloudDataSourceVPCRouterRoute_full --- PASS: TestAccCloudDataSourceVPCRouterRoute_full (1.87s) PASS ok github.com/oxidecomputer/terraform-provider-oxide/internal/provider 2.148s ``` Closes: #377
1 parent 9f0e000 commit 9e5664d

File tree

10 files changed

+1221
-5
lines changed

10 files changed

+1221
-5
lines changed

.changelog/0.10.0.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ title = ""
33
description = ""
44

55
[[features]]
6-
title = ""
7-
description = ""
6+
title = "New resource"
7+
description = "`oxide_vpc_router_route` [#423](https://github.com/oxidecomputer/terraform-provider-oxide/pull/423)."
8+
9+
[[features]]
10+
title = "New data resource"
11+
description = "`oxide_vpc_router_route` [#423](https://github.com/oxidecomputer/terraform-provider-oxide/pull/423)."
812

913
[[enhancements]]
1014
title = ""
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
page_title: "oxide_vpc_router_route Data Source - terraform-provider-oxide"
3+
---
4+
5+
# oxide_vpc_router_route (Data Source)
6+
7+
Retrieve information about a specified VPC router route.
8+
9+
## Example Usage
10+
11+
```hcl
12+
data "oxide_vpc_router_route" "example" {
13+
project_name = "my-project"
14+
name = "default-v4"
15+
vpc_name = "default"
16+
vpc_router_name = "system"
17+
timeouts = {
18+
read = "1m"
19+
}
20+
}
21+
```
22+
23+
## Schema
24+
25+
### Required
26+
27+
- `name` (String) Name of the VPC router route.
28+
- `project_name` (String) Name of the project that contains the VPC router route.
29+
- `vpc_router_name` (String) Name of the VPC router that contains the VPC router route.
30+
- `vpc_name` (String) Name of the VPC that contains the VPC router route.
31+
32+
### Optional
33+
34+
- `timeouts` (Attribute, Optional) (see [below for nested schema](#nestedatt--timeouts))
35+
36+
### Read-Only
37+
38+
- `description` (String) Description for the VPC router.
39+
- `id` (String) Unique, immutable, system-controlled identifier of the VPC router.
40+
- `destination` (Object) Selects which traffic this routing rule will apply to. (see [below for nested schema](#nestedatt--destination))
41+
- `kind` (String) Whether the VPC router is custom or system created.
42+
- `name` (String) Name of the VPC router.
43+
- `target` (Object) Location that matched packets should be forwarded to. (see [below for nested schema](#nestedatt--target))
44+
- `time_created` (String) Timestamp of when this VPC router was created.
45+
- `time_modified` (String) Timestamp of when this VPC router was last modified.
46+
- `vpc_router_id` (String) ID of the VPC router that contains the VPC router route.
47+
48+
<a id="nestedatt--destination"></a>
49+
50+
### Nested Schema for `destination`
51+
52+
Read-Only:
53+
54+
- `type` (String) Route destination type. Possible values: `vpc`, `subnet`, `ip`, and `ip_net`.
55+
- `value` (String) Depending on the type, it will be one of the following:
56+
- `vpc`: Name of the VPC
57+
- `subnet`: Name of the VPC subnet
58+
- `ip`: IP address
59+
- `ip_net`: IPv4 or IPv6 subnet
60+
61+
<a id="nestedatt--target"></a>
62+
63+
### Nested Schema for `target`
64+
65+
Read-Only:
66+
67+
- `type` (String) Route destination type. Possible values: `vpc`, `subnet`, `instance`, `ip`, `internet_gateway`, and `drop`.
68+
- `value` (String) Depending on the type, it will be one of the following:
69+
- `vpc`: Name of the VPC
70+
- `subnet`: Name of the VPC subnet
71+
- `instance`: Name of the instance
72+
- `ip`: IP address
73+
- `internet_gateway`: Name of the internet gateway
74+
75+
<a id="nestedatt--timeouts"></a>
76+
77+
### Nested Schema for `timeouts`
78+
79+
Optional:
80+
81+
- `read` (String, Default `10m`)
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
page_title: "oxide_vpc_router_route Resource - terraform-provider-oxide"
3+
---
4+
5+
# oxide_vpc_router_route (Resource)
6+
7+
This resource manages VPC router routes.
8+
9+
## Example Usage
10+
11+
```hcl
12+
resource "oxide_vpc_router_route" "example" {
13+
vpc_router_id = "c1dee930-a8e4-11ed-afa1-0242ac120002"
14+
description = "a sample VPC router route"
15+
name = "myroute"
16+
destination = {
17+
type = "ip_net"
18+
value = "::/0"
19+
}
20+
target = {
21+
type = "ip"
22+
value = "::1"
23+
}
24+
timeouts = {
25+
read = "1m"
26+
create = "3m"
27+
delete = "2m"
28+
update = "2m"
29+
}
30+
}
31+
```
32+
33+
## Schema
34+
35+
### Required
36+
37+
- `description` (String) Description for the VPC router route.
38+
- `name` (String) Name of the VPC router route.
39+
- `destination` (Object) Selects which traffic this routing rule will apply to. (see [below for nested schema](#nestedatt--destination))
40+
- `target` (Object) Location that matched packets should be forwarded to. (see [below for nested schema](#nestedatt--target))
41+
- `vpc_router_id` (String) ID of the VPC router that will contain the router route.
42+
43+
### Optional
44+
45+
- `timeouts` (Attribute, Optional) (see [below for nested schema](#nestedatt--timeouts))
46+
47+
### Read-Only
48+
49+
- `id` (String) Unique, immutable, system-controlled identifier of the VPC router.
50+
- `kind` (String) Whether the VPC router is custom or system created.
51+
- `time_created` (String) Timestamp of when this VPC router was created.
52+
- `time_modified` (String) Timestamp of when this VPC router was last modified.
53+
54+
<a id="nestedatt--destination"></a>
55+
56+
### Nested Schema for `destination`
57+
58+
Required:
59+
60+
- `type` (String) Route destination type. Possible values: `vpc`, `subnet`, `ip`, and `ip_net`.
61+
- `value` (String) Depending on the type, it will be one of the following:
62+
- `vpc`: Name of the VPC
63+
- `subnet`: Name of the VPC subnet
64+
- `ip`: IP address
65+
- `ip_net`: IPv4 or IPv6 subnet
66+
67+
<a id="nestedatt--target"></a>
68+
69+
### Nested Schema for `target`
70+
71+
Required:
72+
73+
- `type` (String) Route target type. Possible values: `vpc`, `subnet`, `instance`, `ip`, `internet_gateway`, and `drop`.
74+
75+
Optional:
76+
77+
- `value` (String) Depending on the type, it will be one of the following:
78+
- `vpc`: Name of the VPC
79+
- `subnet`: Name of the VPC subnet
80+
- `instance`: Name of the instance
81+
- `ip`: IP address
82+
- `internet_gateway`: Name of the internet gateway
83+
84+
<a id="nestedatt--timeouts"></a>
85+
86+
### Nested Schema for `timeouts`
87+
88+
Optional:
89+
90+
- `create` (String, Default `10m`)
91+
- `delete` (String, Default `10m`)
92+
- `read` (String, Default `10m`)
93+
- `update` (String, Default `10m`)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ require (
1111
github.com/hashicorp/terraform-plugin-log v0.9.0
1212
github.com/hashicorp/terraform-plugin-sdk/v2 v2.36.1
1313
github.com/hashicorp/terraform-plugin-testing v1.12.0
14-
github.com/oxidecomputer/oxide.go v0.4.0
14+
github.com/oxidecomputer/oxide.go v0.4.1-0.20250423011427-65b1d0f6b391
1515
github.com/stretchr/testify v1.10.0
1616
)
1717

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zx
136136
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
137137
github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw=
138138
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
139-
github.com/oxidecomputer/oxide.go v0.4.0 h1:Y15OPFd1TsUtYp5ivK1ROEkRH+WVHOuy0kJxVs9+dkM=
140-
github.com/oxidecomputer/oxide.go v0.4.0/go.mod h1:yNLdQdroM42/yDIFlCsLAR9PawAdeJZDgHdAx+wcywg=
139+
github.com/oxidecomputer/oxide.go v0.4.1-0.20250423011427-65b1d0f6b391 h1:q/ebxcSiqQrrdmDsd+w7gwqZUcGhpHmY9Bu2uYKNGL8=
140+
github.com/oxidecomputer/oxide.go v0.4.1-0.20250423011427-65b1d0f6b391/go.mod h1:yNLdQdroM42/yDIFlCsLAR9PawAdeJZDgHdAx+wcywg=
141141
github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=
142142
github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
143143
github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4=

0 commit comments

Comments
 (0)