Skip to content

Commit b9748e3

Browse files
author
jiangong
committed
add a new data source for IpSec connection tunnels
update core_ip_sec_connection update test case and add tunnel data source and resource
1 parent 65227ed commit b9748e3

15 files changed

+1109
-27
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
### Added
44
- Support for setting `compartment_id` argument in `object_storage_namespace` data source
5+
- Support BGP dynamic routing and allow customer to input PSK for IPSec tunnels
56

67
## 3.25.0 (May 15, 2019)
78

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
// Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
2+
variable "ip_sec_connection_cpe_local_identifier" {
3+
default = "189.44.2.135"
4+
}
5+
6+
variable "ip_sec_connection_cpe_local_identifier_type" {
7+
default = "IP_ADDRESS"
8+
}
9+
10+
variable "ip_sec_connection_defined_tags_value" {
11+
default = "value"
12+
}
13+
14+
variable "ip_sec_connection_display_name" {
15+
default = "MyIPSecConnection"
16+
}
17+
18+
variable "ip_sec_connection_freeform_tags" {
19+
default = {
20+
"Department" = "Finance"
21+
}
22+
}
23+
24+
variable "ip_sec_connection_static_routes" {
25+
default = ["10.0.0.0/16"]
26+
}
27+
28+
variable "ip_sec_connection_tunnel_configuration_bgp_session_config_customer_bgp_asn" {
29+
default = "1587232876"
30+
}
31+
32+
variable "ip_sec_connection_tunnel_configuration_bgp_session_config_customer_interface_ip" {
33+
default = "10.0.0.16/31"
34+
}
35+
36+
variable "ip_sec_connection_tunnel_configuration_bgp_session_config_oracle_interface_ip" {
37+
default = "10.0.0.17/31"
38+
}
39+
40+
variable "ip_sec_connection_tunnel_configuration_display_name" {
41+
default = "MyIPSecConnection"
42+
}
43+
44+
variable "ip_sec_connection_tunnel_configuration_routing" {
45+
default = "BGP"
46+
}
47+
48+
variable "ip_sec_connection_tunnel_configuration_shared_secret" {
49+
default = "sharedSecret"
50+
}
51+
52+
resource oci_core_cpe "test_cpe" {
53+
compartment_id = "${var.compartment_ocid}"
54+
display_name = "test_cpe"
55+
ip_address = "189.44.2.135"
56+
}
57+
58+
resource oci_core_drg "test_drg" {
59+
compartment_id = "${var.compartment_ocid}"
60+
display_name = "test_drg"
61+
}
62+
63+
resource "oci_core_ipsec" "test_ip_sec_connection" {
64+
#Required
65+
compartment_id = "${var.compartment_ocid}"
66+
cpe_id = "${oci_core_cpe.test_cpe.id}"
67+
drg_id = "${oci_core_drg.test_drg.id}"
68+
static_routes = "${var.ip_sec_connection_static_routes}"
69+
70+
#Optional
71+
cpe_local_identifier = "${var.ip_sec_connection_cpe_local_identifier}"
72+
cpe_local_identifier_type = "${var.ip_sec_connection_cpe_local_identifier_type}"
73+
defined_tags = "${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "${var.ip_sec_connection_defined_tags_value}")}"
74+
display_name = "${var.ip_sec_connection_display_name}"
75+
freeform_tags = "${var.ip_sec_connection_freeform_tags}"
76+
77+
tunnel_configuration {
78+
#Optional
79+
bgp_session_config {
80+
#Optional
81+
customer_bgp_asn = "${var.ip_sec_connection_tunnel_configuration_bgp_session_config_customer_bgp_asn}"
82+
customer_interface_ip = "${var.ip_sec_connection_tunnel_configuration_bgp_session_config_customer_interface_ip}"
83+
oracle_interface_ip = "${var.ip_sec_connection_tunnel_configuration_bgp_session_config_oracle_interface_ip}"
84+
}
85+
86+
display_name = "${var.ip_sec_connection_tunnel_configuration_display_name}"
87+
routing = "${var.ip_sec_connection_tunnel_configuration_routing}"
88+
shared_secret = "${var.ip_sec_connection_tunnel_configuration_shared_secret}"
89+
}
90+
}
91+
92+
data "oci_core_ipsec_connections" "test_ip_sec_connections" {
93+
#Required
94+
compartment_id = "${var.compartment_ocid}"
95+
96+
#Optional
97+
cpe_id = "${oci_core_cpe.test_cpe.id}"
98+
drg_id = "${oci_core_drg.test_drg.id}"
99+
}
100+
101+
data "oci_core_ipsec_connection_tunnels" "test_ip_sec_connection_tunnels" {
102+
ipsec_id = "${oci_core_ipsec.test_ip_sec_connection.id}"
103+
104+
# tunnel_id = ""
105+
}
106+
107+
data "oci_core_ipsec_connection_tunnel" "test_ipsec_connection_tunnel" {
108+
ipsec_id = "${oci_core_ipsec.test_ip_sec_connection.id}"
109+
tunnel_id = "${data.oci_core_ipsec_connection_tunnels.test_ip_sec_connection_tunnels.ip_sec_connection_tunnels.0.id}"
110+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
2+
3+
variable "tenancy_ocid" {}
4+
variable "user_ocid" {}
5+
variable "fingerprint" {}
6+
variable "private_key_path" {}
7+
variable "region" {}
8+
9+
variable "tag_namespace_description" {
10+
default = "Just a test"
11+
}
12+
13+
variable "tag_namespace_name" {
14+
default = "testexamples-tag-namespace"
15+
}
16+
17+
variable "compartment_ocid" {}
18+
19+
provider "oci" {
20+
tenancy_ocid = "${var.tenancy_ocid}"
21+
user_ocid = "${var.user_ocid}"
22+
fingerprint = "${var.fingerprint}"
23+
private_key_path = "${var.private_key_path}"
24+
region = "${var.region}"
25+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
2+
3+
resource "oci_identity_tag_namespace" "tag-namespace1" {
4+
#Required
5+
compartment_id = "${var.tenancy_ocid}"
6+
description = "${var.tag_namespace_description}"
7+
name = "${var.tag_namespace_name}"
8+
}
9+
10+
resource "oci_identity_tag" "tag1" {
11+
#Required
12+
description = "tf example tag"
13+
name = "tf-example-tag"
14+
tag_namespace_id = "${oci_identity_tag_namespace.tag-namespace1.id}"
15+
}
16+
17+
resource "oci_identity_tag" "tag2" {
18+
#Required
19+
description = "tf example tag 2"
20+
name = "tf-example-tag-2"
21+
tag_namespace_id = "${oci_identity_tag_namespace.tag-namespace1.id}"
22+
}

0 commit comments

Comments
 (0)