generated from hashicorp/terraform-provider-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added create, scaffolded read and delete for hvn route resource * Adds delete for HVN route resource * Adds hvn route import function * Handle both peering and tgw attachment resource types in HVN route resources * Regenerate docs, add example s for hvn route resource * Re-run go generate after adding example * ACreate hvn route function checks for target existence before proceeding * Add peering to example for hvn route, regenerate docs * Resolves comments - better logging and commenting for HVN route resource * removed unnecessary validation * removed todos * removed tgw attachment from hvn route example * added examples of the hvn route target * moved hvn route creation into clients * simplified parsing target_link for the hvn route resource * dropped checking for hvn route existance * fixed hvn routes import * gofmt hvn_route.go * redo hvn route import to use route ID * go mod tidy * redo hvn route datasource to use route ID * renamed hvn -> hvn_link * refactored WaitForHVNRouteToBeActive * unified hvn route errors/logs * small refactoring * improved logs * messages improvements Co-authored-by: Brenna Hewer-Darroch <[email protected]> * regenarated docs Co-authored-by: Anton Panferov <[email protected]> Co-authored-by: Brenna Hewer-Darroch <[email protected]>
- Loading branch information
1 parent
32d485f
commit 19091f2
Showing
14 changed files
with
575 additions
and
43 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
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,89 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "hcp_hvn_route Resource - terraform-provider-hcp" | ||
subcategory: "" | ||
description: |- | ||
The HVN route resource allows you to manage an HVN route. | ||
--- | ||
|
||
# hcp_hvn_route (Resource) | ||
|
||
The HVN route resource allows you to manage an HVN route. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
provider "aws" { | ||
region = "us-west-2" | ||
} | ||
resource "hcp_hvn" "main" { | ||
hvn_id = "main-hvn" | ||
cloud_provider = "aws" | ||
region = "us-west-2" | ||
cidr_block = "172.25.16.0/20" | ||
} | ||
// Creating a peering and a route for it. | ||
resource "aws_vpc" "peer" { | ||
cidr_block = "192.168.0.0/20" | ||
} | ||
resource "hcp_aws_network_peering" "example" { | ||
peering_id = "peer-example" | ||
hvn_id = hcp_hvn.main.hvn_id | ||
peer_vpc_id = aws_vpc.peer.id | ||
peer_account_id = aws_vpc.peer.owner_id | ||
peer_vpc_region = "us-west-2" | ||
} | ||
resource "aws_vpc_peering_connection_accepter" "peer" { | ||
vpc_peering_connection_id = hcp_aws_network_peering.example.provider_peering_id | ||
auto_accept = true | ||
} | ||
resource "hcp_hvn_route" "example-peering-route" { | ||
hvn_link = hcp_hvn.main.self_link | ||
hvn_route_id = "peering-route" | ||
destination_cidr = aws_vpc.peer.cidr_block | ||
target_link = hcp_aws_network_peering.example.self_link | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- **destination_cidr** (String) The destination CIDR of the HVN route. | ||
- **hvn_link** (String) The `self_link` of the HashiCorp Virtual Network (HVN). | ||
- **hvn_route_id** (String) The ID of the HVN route. | ||
- **target_link** (String) A unique URL identifying the target of the HVN route. Examples of the target: [`aws_network_peering`](aws_network_peering.md), [`aws_transit_gateway_attachment`](aws_transit_gateway_attachment.md) | ||
|
||
### Optional | ||
|
||
- **id** (String) The ID of this resource. | ||
- **timeouts** (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) | ||
|
||
### Read-Only | ||
|
||
- **created_at** (String) The time that the HVN route was created. | ||
- **self_link** (String) A unique URL identifying the HVN route. | ||
- **state** (String) The state of the HVN route. | ||
|
||
<a id="nestedblock--timeouts"></a> | ||
### Nested Schema for `timeouts` | ||
|
||
Optional: | ||
|
||
- **create** (String) | ||
- **default** (String) | ||
|
||
## Import | ||
|
||
Import is supported using the following syntax: | ||
|
||
```shell | ||
# The import ID is {hvn_id}:{hvn_route_id} | ||
terraform import hcp_hvn_route.example main-hvn:example-hvn-route | ||
``` |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
data "hcp_hvn_route" "example" { | ||
hvn = var.hvn | ||
destination_cidr = var.destination_cidr | ||
hvn_link = var.hvn_link | ||
destination_cidr = var.hvn_route_id | ||
} |
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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
variable "hvn" { | ||
variable "hvn_link" { | ||
description = "The `self_link` of the HashiCorp Virtual Network (HVN)." | ||
type = string | ||
} | ||
|
||
variable "destination_cidr" { | ||
description = "The destination CIDR of the HVN route." | ||
variable "hvn_route_id" { | ||
description = "The ID of the HVN route ID." | ||
type = string | ||
} |
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,2 @@ | ||
# The import ID is {hvn_id}:{hvn_route_id} | ||
terraform import hcp_hvn_route.example main-hvn:example-hvn-route |
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,35 @@ | ||
provider "aws" { | ||
region = "us-west-2" | ||
} | ||
|
||
resource "hcp_hvn" "main" { | ||
hvn_id = "main-hvn" | ||
cloud_provider = "aws" | ||
region = "us-west-2" | ||
cidr_block = "172.25.16.0/20" | ||
} | ||
|
||
// Creating a peering and a route for it. | ||
resource "aws_vpc" "peer" { | ||
cidr_block = "192.168.0.0/20" | ||
} | ||
|
||
resource "hcp_aws_network_peering" "example" { | ||
peering_id = "peer-example" | ||
hvn_id = hcp_hvn.main.hvn_id | ||
peer_vpc_id = aws_vpc.peer.id | ||
peer_account_id = aws_vpc.peer.owner_id | ||
peer_vpc_region = "us-west-2" | ||
} | ||
|
||
resource "aws_vpc_peering_connection_accepter" "peer" { | ||
vpc_peering_connection_id = hcp_aws_network_peering.example.provider_peering_id | ||
auto_accept = true | ||
} | ||
|
||
resource "hcp_hvn_route" "example-peering-route" { | ||
hvn_link = hcp_hvn.main.self_link | ||
hvn_route_id = "peering-route" | ||
destination_cidr = aws_vpc.peer.cidr_block | ||
target_link = hcp_aws_network_peering.example.self_link | ||
} |
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
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
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
Oops, something went wrong.