Skip to content

Commit 73e3ec7

Browse files
authored
improve naming for RPCs (#13)
1 parent fd276e3 commit 73e3ec7

File tree

5 files changed

+24
-9
lines changed

5 files changed

+24
-9
lines changed

drg.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ resource "oci_core_remote_peering_connection" "rpcs" {
4848
for_each = var.remote_peering_connections != null ? var.remote_peering_connections : {}
4949
compartment_id = var.compartment_id
5050
drg_id = var.drg_id == null ? oci_core_drg.drg[0].id : var.drg_id
51-
display_name = var.label_prefix == "none" ? each.key : "${var.label_prefix}-${each.key}"
51+
display_name = each.key
5252

5353
freeform_tags = var.freeform_tags
5454
defined_tags = var.defined_tags

examples/rpc/main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ module "drg_acceptor" {
8585
drg_display_name = "drg-rpc-acceptor"
8686

8787
# rpc parameters
88-
remote_peering_connections = { "rpc_acceptor" = {} }
88+
remote_peering_connections = { "${var.rpc_name_acceptor}" = {} }
8989

9090
providers = {
9191
oci = oci.acceptor
@@ -168,8 +168,8 @@ module "drg_requestor" {
168168

169169
# rpc parameters
170170
remote_peering_connections = {
171-
"rpc_requestor" = {
172-
"rpc_acceptor_id" = module.drg_acceptor.rpc_all_attributes["rpc_acceptor"].id,
171+
"${var.rpc_name_requestor}" = {
172+
"rpc_acceptor_id" = module.drg_acceptor.rpc_all_attributes["${var.rpc_name_acceptor}"].id,
173173
"rpc_acceptor_region" = var.region_acceptor
174174
}
175175
}

examples/rpc/variables.tf

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ variable "defined_tags" {
5656
}
5757

5858
# acceptor parameters
59-
59+
variable "rpc_name_acceptor" {
60+
description = "Name for RPC acceptor"
61+
type = string
62+
default = "rpc_acceptor"
63+
}
6064
variable "region_acceptor" {
6165
description = "the oci region where RPC acceptor resources will be created"
6266
type = string
@@ -71,6 +75,11 @@ variable "vcn_cidrs_acceptor" {
7175
}
7276

7377
# requestor parameter
78+
variable "rpc_name_requestor" {
79+
description = "Name for RPC requestor"
80+
type = string
81+
default = "rpc_requestor"
82+
}
7483

7584
variable "region_requestor" {
7685
description = "OCI region where RPC requstor resources will be created"

terraform.tfvars.example

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,13 @@ drg_vcn_attachments = null
3636

3737
# rpc parameters
3838
remote_peering_connections = null
39-
39+
#
40+
# map of remote peering connections
41+
# - key-only items represent represent local acceptors with no info about the remote peer
42+
# - items containing key and values represent local requestor and must have the OCID and region of the remote acceptor
4043
#remote_peering_connections = {
41-
# "rpc1" : {}
42-
# "rpc2" : {
44+
# "rpc_name_1" : {}
45+
# "rpc_name_2" : {
4346
# "rpc_acceptor_id" : "ocid1.remotepeeringconnection.oc1.aaaaaa" # <-- edit this OCID
4447
# "rpc_acceptor_region" : "us-ashburn-1" <-- replace the region
4548
# }

variables.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,11 @@ variable "drg_id" {
5757
}
5858

5959
# rpc parameters
60+
# map of remote peering connections
61+
# - key-only items represent represent local acceptors with no info about the remote peer
62+
# - items containing key and values represent local requestor and must have the OCID and region of the remote acceptor
6063
variable "remote_peering_connections" {
61-
description = "List of parameters to add and optionally peer remote peering connections"
64+
description = "List of parameters to add and optionally peer to remote peering connections"
6265
type = map(any)
6366
default = null
6467
}

0 commit comments

Comments
 (0)