Skip to content

Commit 3a29896

Browse files
snafuzhyder
authored andcommitted
add support for remote peering connection
1 parent 440eb33 commit 3a29896

File tree

5 files changed

+43
-1
lines changed

5 files changed

+43
-1
lines changed

docs/terraformoptions.adoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,16 @@ EOT
175175
|""
176176
|drg
177177

178+
|remote_peering_connections
179+
|Map of parameters to add and optionally to peer to remote peering connections. Key-only items represent represent local acceptors no peering attempted; items containing key and values represent local requestor and must have the OCID and region of the remote acceptor to peer to
180+
|{
181+
"rpc_name_1" = {}
182+
"rpc_name_2" = {
183+
rpc_acceptor_id = "ocid1.remotepeeringconnection.oc1.aaaaaa..." #
184+
rpc_acceptor_region = "us-ashburn-1"
185+
}
186+
|{}
187+
178188
|enable_waf
179189
|Whether to enable WAF monitoring of load balancers
180190
|`true/false`

main.tf

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module "vcn" {
3636

3737
module "drg" {
3838
source = "oracle-terraform-modules/drg/oci"
39-
version = "1.0.3"
39+
version = "1.0.5"
4040

4141
# general oci parameters
4242
compartment_id = local.compartment_id
@@ -51,9 +51,17 @@ module "drg" {
5151
drg_route_table_id : null
5252
}
5353
}
54+
5455
# var.drg_id can either contain an existing DRG ID or be null.
5556
drg_id = var.drg_id
5657

58+
# rpc parameters
59+
remote_peering_connections = { for k, v in var.remote_peering_connections: k => {
60+
"rpc_acceptor_id" = try(v.rpc_acceptor_id,null),
61+
"rpc_acceptor_region" = try(v.rpc_acceptor_region, null)
62+
}
63+
}
64+
5765
count = var.create_drg || var.drg_id != null ? 1 : 0
5866
}
5967

outputs.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ output "drg_id" {
5656
value = var.create_drg || var.drg_id != null ? module.drg[0].drg_id : null
5757
}
5858

59+
output "rpcs_ids" {
60+
description = "IDs of remote peering connections"
61+
value = (var.create_drg || var.drg_id != null) && length(var.remote_peering_connections) > 0 ? { for k, v in module.drg[0].rpc_all_attributes : k => v.id } : null
62+
63+
}
64+
5965
# convenient output
6066

6167
output "bastion_public_ip" {

terraform.tfvars.example

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@ ssh_private_key_path = "~/.ssh/id_rsa"
3737
create_drg = false
3838
drg_display_name = "drg"
3939
drg_id = null
40+
remote_peering_connections = {}
41+
#
42+
# map of remote peering connections
43+
# - key-only items represent represent local acceptors with no info about the remote peer
44+
# - items containing key and values represent local requestor and must have the OCID and region of the remote acceptor
45+
# remote_peering_connections = {
46+
# "rpc_name_1" : {}
47+
# "rpc_name_2" : {
48+
# "rpc_acceptor_id" : "ocid1.remotepeeringconnection.oc1.aaaaaa" # <-- edit this OCID
49+
# "rpc_acceptor_region" : "us-ashburn-1" #<-- replace the region
50+
# }
51+
# }
4052

4153
internet_gateway_route_rules = [
4254
# {

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,12 @@ variable "drg_id" {
180180
default = null
181181
}
182182

183+
variable "remote_peering_connections" {
184+
description = "Map of parameters to add and optionally to peer to remote peering connections. Key-only items represent local acceptors and no peering attempted; items containing key and values represent local requestor and must have the OCID and region of the remote acceptor to peer to"
185+
type = map(any)
186+
default = {}
187+
}
188+
183189
variable "internet_gateway_route_rules" {
184190
description = "(Updatable) List of routing rules to add to Internet Gateway Route Table"
185191
type = list(map(string))

0 commit comments

Comments
 (0)