-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(er): import er resource, unit tests and docs
- Loading branch information
1 parent
10b165b
commit c2168a8
Showing
14 changed files
with
1,180 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
--- | ||
subcategory: "Enterprise Router (ER)" | ||
--- | ||
|
||
# g42cloud_er_instances | ||
|
||
Use this data source to filter ER instances within G42Cloud. | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
data "g42cloud_er_instances" "test" { | ||
tags = { | ||
foo = "bar" | ||
} | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
* `region` - (Optional, String) Specifies the region where the ER instances are located. | ||
If omitted, the provider-level region will be used. | ||
|
||
* `instance_id` - (Optional, String) Specifies the ID used to query specified ER instance. | ||
|
||
* `name` - (Optional, String) Specifies the name used to filter the ER instances. | ||
The valid length is limited from `1` to `64`, only Chinese and English letters, digits, underscores (_) and | ||
hyphens (-) are allowed. | ||
|
||
* `enterprise_project_id` - (Optional, String) Specifies the enterprise project ID of the ER instances to be queried. | ||
|
||
* `owned_by_self` - (Optional, Bool) Specifies whether resources belong to the current renant. | ||
|
||
* `status` - (Optional, String) Specifies the status used to filter the ER instances. | ||
|
||
* `tags` - (Optional, Map) Specifies the key/value pairs used to filter the ER instances. | ||
|
||
## Attribute Reference | ||
|
||
In addition to all arguments above, the following attributes are exported: | ||
|
||
* `id` - The data source ID. | ||
|
||
* `instances` - All instances that match the filter parameters. | ||
The [instances](#er_data_instances) structure is documented below. | ||
|
||
<a name="er_data_instances"></a> | ||
The `instances` block supports: | ||
|
||
* `id` - The ER instance ID. | ||
|
||
* `asn` - The BGP AS number of the ER instance. | ||
|
||
* `name` - The name of the ER instance. | ||
|
||
* `description` - The description of the ER instance. | ||
|
||
* `status` - The current status of the ER instance. | ||
|
||
* `enterprise_project_id` - The ID of enterprise project to which the ER instance belongs. | ||
|
||
* `tags` - The key/value pairs to associate with the ER instance. | ||
|
||
* `created_at` - The creation time of the ER instance. | ||
|
||
* `updated_at` - The last update time of the ER instance. | ||
|
||
* `enable_default_propagation` - Whether to enable the propagation of the default route table. | ||
|
||
* `enable_default_association` - Whether to enable the association of the default route table. | ||
|
||
* `auto_accept_shared_attachments` - Whether to automatically accept the creation of shared attachment. | ||
|
||
* `default_propagation_route_table_id` - The ID of the default propagation route table. | ||
|
||
* `default_association_route_table_id` - The ID of the default association route table. | ||
|
||
* `availability_zones` - The availability zone list where the ER instance is located. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
--- | ||
subcategory: "Enterprise Router (ER)" | ||
--- | ||
|
||
# g42cloud_er_route_tables | ||
|
||
Use this data source to query the route tables under the ER instance within G42Cloud. | ||
|
||
## Example Usage | ||
|
||
### Querying specified route tables under ER instance using name | ||
|
||
```hcl | ||
variable "instance_id" {} | ||
variable "route_table_name" {} | ||
data "g42cloud_er_route_tables" "test" { | ||
instance_id = var.instance_id | ||
name = var.route_table_name | ||
} | ||
``` | ||
|
||
### Querying specified route tables under ER instance using tags | ||
|
||
```hcl | ||
variable "instance_id" {} | ||
data "g42cloud_er_route_tables" "test" { | ||
instance_id = var.instance_id | ||
tags = { | ||
foo = "bar" | ||
} | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
* `region` - (Optional, String) Specifies the region where the ER instance and route table are located. | ||
If omitted, the provider-level region will be used. | ||
|
||
* `instance_id` - (Required, String) Specifies the ID of the ER instance to which the route tables belongs. | ||
|
||
* `route_table_id` - (Optional, String) Specifies the route table ID used to query specified route table. | ||
|
||
* `name` - (Optional, String) Specifies the name used to filter the route tables. | ||
The name can contain 1 to 64 characters, only english and chinese letters, digits, underscore (_), hyphens (-) and | ||
dots (.) allowed. | ||
|
||
* `tags` - (Optional, Map) Specifies the key/value pairs used to filter the route tables. | ||
|
||
## Attribute Reference | ||
|
||
In addition to all arguments above, the following attributes are exported: | ||
|
||
* `id` - The data source ID. | ||
|
||
* `route_tables` - All route tables that match the filter parameters. | ||
The [object](#route_tables) structure is documented below. | ||
|
||
<a name="route_tables"></a> | ||
The `route_tables` block supports: | ||
|
||
* `id` - The route table ID. | ||
|
||
* `name` - The name of the route table. | ||
|
||
* `description` - The description of the route table. | ||
|
||
* `associations` - The association configurations of the route table. | ||
The [object](#route_table_relationship) structure is documented below. | ||
|
||
* `propagations` - The propagation configurations of the route table. | ||
The [object](#route_table_relationship) structure is documented below. | ||
|
||
* `routes` - The route details of the route table. | ||
The [object](#route_table_routes) structure is documented below. | ||
|
||
* `is_default_association` - Whether this route table is the default association route table. | ||
|
||
* `is_default_propagation` - Whether this route table is the default propagation route table. | ||
|
||
* `status` - The current status of the route table. | ||
|
||
* `created_at` - The creation time. | ||
|
||
* `updated_at` - The latest update time. | ||
|
||
<a name="route_table_relationship"></a> | ||
The `associations` or `propagations` block supports: | ||
|
||
* `id` - The ID of the association/propagation. | ||
|
||
* `attachment_id` - The attachment ID corresponding to the routing association/propagation. | ||
|
||
* `attachment_type` - The attachment type corresponding to the routing association/propagation. | ||
|
||
<a name="route_table_routes"></a> | ||
The `routes` block supports: | ||
|
||
* `id` - The route ID. | ||
|
||
* `destination` - The destination address (CIDR) of the route. | ||
|
||
* `is_blackhole` - Whether route is the black hole route. | ||
|
||
* `attachments` - The details of the attachment corresponding to the route. | ||
The [object](#route_table_route_attachments) structure is documented below. | ||
|
||
* `status` - The current status of the route. | ||
|
||
<a name="route_table_route_attachments"></a> | ||
The `attachments` block supports: | ||
|
||
* `attachment_id` - The ID of the nexthop attachment. | ||
|
||
* `attachment_type` - The type of the nexthop attachment. | ||
|
||
* `resource_id` - The ID of the resource associated with the attachment. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
--- | ||
subcategory: "Enterprise Router (ER)" | ||
--- | ||
|
||
# g42cloud_er_instance | ||
|
||
Manages an ER instance resource within G42Cloud. | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
variable "router_name" {} | ||
variable "bgp_as_number" {} | ||
variable "availability_zones" { | ||
type = list(string) | ||
} | ||
resource "g42cloud_er_instance" "test" { | ||
availability_zones = var.availability_zones | ||
name = var.router_name | ||
asn = var.bgp_as_number | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
* `region` - (Optional, String, ForceNew) Specifies the region in which to create the resource. | ||
If omitted, the provider-level region will be used. Changing this parameter will create a new resource. | ||
|
||
* `name` - (Required, String) The router name. | ||
The name can contain 1 to 64 characters, only english and chinese letters, digits, underscore (_) and hyphens (-) are | ||
allowed. | ||
|
||
* `availability_zones` - (Required, List) The availability zone list where the ER instance is located. | ||
The maximum number of availability zone is two. Select two AZs to configure active-active deployment for high | ||
availability which will ensure reliability and disaster recovery. | ||
|
||
* `asn` - (Required, Int, ForceNew) The BGP AS number of the ER instance. | ||
The valid value is range from `64,512` to `65534` or range from `4,200,000,000` to `4,294,967,294`. | ||
|
||
Changing this parameter will create a new resource. | ||
|
||
* `description` - (Optional, String) The description of the ER instance. | ||
The description contain a maximum of 255 characters, and the angle brackets (< and >) are not allowed. | ||
|
||
* `enterprise_project_id` - (Optional, String, ForceNew) The enterprise project ID to which the ER instance | ||
belongs. | ||
Changing this parameter will create a new resource. | ||
|
||
* `enable_default_propagation` - (Optional, Bool) Whether to enable the propagation of the default route table. | ||
The default value is **false**. | ||
|
||
* `enable_default_association` - (Optional, Bool) Whether to enable the association of the default route table. | ||
The default value is **false**. | ||
|
||
* `auto_accept_shared_attachments` - (Optional, Bool) Whether to automatically accept the creation of shared | ||
attachment. | ||
The default value is **false**. | ||
|
||
* `default_propagation_route_table_id` - (Optional, String) The ID of the default propagation route table. | ||
|
||
* `default_association_route_table_id` - (Optional, String) The ID of the default association route table. | ||
|
||
* `tags` - (Optional, Map) Specifies the key/value pairs to associate with the instance. | ||
|
||
## Attribute Reference | ||
|
||
In addition to all arguments above, the following attributes are exported: | ||
|
||
* `id` - The resource ID. | ||
|
||
* `status` - Current status of the router. | ||
|
||
* `created_at` - The creation time. | ||
|
||
* `updated_at` - The latest update time. | ||
|
||
## Timeouts | ||
|
||
This resource provides the following timeouts configuration options: | ||
|
||
* `create` - Default is 10 minutes. | ||
* `update` - Default is 10 minutes. | ||
* `delete` - Default is 5 minutes. | ||
|
||
## Import | ||
|
||
The router instance can be imported using the `id`, e.g. | ||
|
||
``` | ||
$ terraform import g42cloud_er_instance.test 0ce123456a00f2591fabc00385ff1234 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
--- | ||
subcategory: "Enterprise Router (ER)" | ||
--- | ||
|
||
# g42cloud_er_route_table | ||
|
||
Manages a route table resource under the ER instance within G42Cloud. | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
variable "instance_id" {} | ||
variable "route_table_name" {} | ||
resource "g42cloud_er_route_table" "test" { | ||
instance_id = var.instance_id | ||
name = var.route_table_name | ||
description = "Route table created by terraform" | ||
tags = { | ||
foo = "bar" | ||
owner = "terraform" | ||
} | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
* `region` - (Optional, String, ForceNew) Specifies the region where the ER instance and route table are located. | ||
If omitted, the provider-level region will be used. Changing this parameter will create a new resource. | ||
|
||
* `instance_id` - (Required, String, ForceNew) Specifies the ID of the ER instance to which the route table belongs. | ||
Changing this parameter will create a new resource. | ||
|
||
* `name` - (Required, String) Specifies the name of the route table. | ||
The name can contain 1 to 64 characters, only english and chinese letters, digits, underscore (_), hyphens (-) and | ||
dots (.) allowed. | ||
|
||
* `description` - (Optional, String) Specifies the description of the route table. | ||
The description contain a maximum of 255 characters, and the angle brackets (< and >) are not allowed. | ||
|
||
* `tags` - (Optional, Map, ForceNew) Specifies the key/value pairs to associate with the route table. | ||
Changing this parameter will create a new resource. | ||
|
||
## Attribute Reference | ||
|
||
In addition to all arguments above, the following attributes are exported: | ||
|
||
* `id` - The resource ID. | ||
|
||
* `is_default_association` - Whether this route table is the default association route table. | ||
|
||
* `is_default_propagation` - Whether this route table is the default propagation route table. | ||
|
||
* `status` - The current status of the route table. | ||
|
||
* `created_at` - The creation time. | ||
|
||
* `updated_at` - The latest update time. | ||
|
||
## Timeouts | ||
|
||
This resource provides the following timeouts configuration options: | ||
|
||
* `create` - Default is 5 minutes. | ||
* `update` - Default is 5 minutes. | ||
* `delete` - Default is 5 minutes. | ||
|
||
## Import | ||
|
||
Route tables can be imported using their `id` and the related `instance_id`, separated by slashes (/), e.g. | ||
|
||
``` | ||
$ terraform import g42cloud_er_route_table.test <instance_id>/<id> | ||
``` |
Oops, something went wrong.