Skip to content

Commit 5ec5da8

Browse files
craigsfowlerjotruon
authored andcommitted
Added - Support for OPSI: TCPS Support for Cloud Databases
1 parent 3aebe8e commit 5ec5da8

13 files changed

+2087
-17
lines changed
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
// Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
2+
// Licensed under the Mozilla Public License v2.0
3+
4+
variable "tenancy_ocid" {}
5+
variable "user_ocid" {}
6+
variable "fingerprint" {}
7+
variable "private_key_path" {}
8+
variable "region" {}
9+
variable "compartment_ocid" {}
10+
variable "opsi_private_endpoint_id" {}
11+
variable "dbsystem_database_id" {}
12+
variable "service_name" {}
13+
variable "user_name" {}
14+
variable "secret_id" {}
15+
variable "wallet_secret_id" {}
16+
variable "tcps_port" {}
17+
18+
provider "oci" {
19+
tenancy_ocid = var.tenancy_ocid
20+
user_ocid = var.user_ocid
21+
fingerprint = var.fingerprint
22+
private_key_path = var.private_key_path
23+
region = var.region
24+
}
25+
26+
resource "oci_identity_tag_namespace" "tag-namespace1" {
27+
compartment_id = var.tenancy_ocid
28+
description = "example tag namespace"
29+
name = "examples-tag-namespace-all"
30+
is_retired = false
31+
}
32+
33+
resource "oci_identity_tag" "tag1" {
34+
description = "example tag"
35+
name = "example-tag"
36+
tag_namespace_id = oci_identity_tag_namespace.tag-namespace1.id
37+
is_cost_tracking = false
38+
is_retired = false
39+
}
40+
41+
variable "database_insight_database_type" {
42+
default = ["COMANAGED-VM-CDB"]
43+
}
44+
45+
variable "deployment_type" {
46+
default = "VIRTUAL_MACHINE"
47+
}
48+
49+
variable "database_insight_credential_details_credential_type" {
50+
default = "CREDENTIALS_BY_VAULT"
51+
}
52+
53+
variable "database_insight_credential_details_role" {
54+
default = "NORMAL"
55+
}
56+
57+
variable "database_insight_database_resource_type" {
58+
default = "database"
59+
}
60+
61+
variable "database_insight_defined_tags_value" {
62+
default = "value"
63+
}
64+
65+
variable "database_insight_entity_source" {
66+
default = "PE_COMANAGED_DATABASE"
67+
}
68+
69+
variable "database_insight_fields" {
70+
default = ["databaseName", "databaseType", "compartmentId", "databaseDisplayName", "freeformTags", "definedTags"]
71+
}
72+
73+
variable "database_insight_freeform_tags" {
74+
default = { "bar-key" = "value" }
75+
}
76+
77+
variable "resource_status" {
78+
default = "ENABLED"
79+
}
80+
81+
// Create Database insight for EM managed External Database
82+
resource "oci_opsi_database_insight" "test_database_insight" {
83+
#Required
84+
compartment_id = var.compartment_ocid
85+
entity_source = var.database_insight_entity_source
86+
87+
#Optional
88+
opsi_private_endpoint_id = var.opsi_private_endpoint_id
89+
service_name = var.service_name
90+
database_id = var.dbsystem_database_id
91+
deployment_type = var.deployment_type
92+
database_resource_type = var.database_insight_database_resource_type
93+
credential_details {
94+
credential_type = var.database_insight_credential_details_credential_type
95+
password_secret_id = var.secret_id
96+
role = var.database_insight_credential_details_role
97+
user_name = var.user_name
98+
wallet_secret_id = var.wallet_secret_id
99+
}
100+
connection_details {
101+
protocol = "TCPS"
102+
service_name = var.service_name
103+
hosts {
104+
port = var.tcps_port
105+
}
106+
}
107+
defined_tags = "${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "${var.database_insight_defined_tags_value}")}"
108+
freeform_tags = var.database_insight_freeform_tags
109+
status = var.resource_status
110+
}
111+
112+
variable "database_insight_state" {
113+
default = ["ACTIVE"]
114+
}
115+
116+
variable "database_insight_status" {
117+
default = ["ENABLED"]
118+
}
119+
120+
// List PE comanaged database insights
121+
data "oci_opsi_database_insights" "test_database_insights" {
122+
#Optional
123+
compartment_id = var.compartment_ocid
124+
database_type = var.database_insight_database_type
125+
opsi_private_endpoint_id = var.opsi_private_endpoint_id
126+
fields = var.database_insight_fields
127+
state = var.database_insight_state
128+
status = var.database_insight_status
129+
}
130+
131+
// Get an EM managed database insight
132+
data "oci_opsi_database_insight" "test_database_insight" {
133+
database_insight_id = oci_opsi_database_insight.test_database_insight.id
134+
}
135+
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
// Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
2+
// Licensed under the Mozilla Public License v2.0
3+
4+
variable "tenancy_ocid" {}
5+
variable "user_ocid" {}
6+
variable "fingerprint" {}
7+
variable "private_key_path" {}
8+
variable "region" {}
9+
variable "compartment_ocid" {}
10+
variable "dbm_private_endpoint_id" {}
11+
variable "dbsystem_database_id" {}
12+
variable "service_name" {}
13+
variable "user_name" {}
14+
variable "password_secret_id" {}
15+
variable "exadata_infra_id" {}
16+
variable "vmcluster_id" {}
17+
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+
}
26+
27+
resource "oci_identity_tag_namespace" "tag-namespace1" {
28+
compartment_id = var.tenancy_ocid
29+
description = "example tag namespace"
30+
name = "examples-tag-namespace-all"
31+
is_retired = false
32+
}
33+
34+
resource "oci_identity_tag" "tag1" {
35+
description = "example tag"
36+
name = "example-tag"
37+
tag_namespace_id = oci_identity_tag_namespace.tag-namespace1.id
38+
is_cost_tracking = false
39+
is_retired = false
40+
}
41+
42+
variable "exadata_insight_type" {
43+
default = ["EXACS"]
44+
}
45+
46+
variable "deployment_type" {
47+
default = "EXACS"
48+
}
49+
50+
variable "credential_details_credential_type" {
51+
default = "CREDENTIALS_BY_VAULT"
52+
}
53+
54+
variable "credential_details_role" {
55+
default = "NORMAL"
56+
}
57+
58+
variable "database_resource_type" {
59+
default = "database"
60+
}
61+
62+
variable "exadata_insight_defined_tags_value" {
63+
default = "value"
64+
}
65+
66+
variable "exadata_insight_entity_source" {
67+
default = "PE_COMANAGED_EXADATA"
68+
}
69+
70+
variable "freeform_tags" {
71+
default = { "bar-key" = "value" }
72+
}
73+
74+
variable "resource_status" {
75+
default = "ENABLED"
76+
}
77+
78+
// Create PE Comanaged Exadata insight
79+
resource "oci_opsi_exadata_insight" "test_exadata_insight" {
80+
#Required
81+
compartment_id = var.compartment_ocid
82+
entity_source = var.exadata_insight_entity_source
83+
84+
#Optional
85+
exadata_infra_id = var.exadata_infra_id
86+
member_vm_cluster_details {
87+
vmcluster_id = var.vmcluster_id
88+
compartment_id = var.compartment_ocid
89+
dbm_private_endpoint_id = var.dbm_private_endpoint_id
90+
member_database_details {
91+
entity_source = "PE_COMANAGED_DATABASE"
92+
compartment_id = var.compartment_ocid
93+
database_id = var.dbsystem_database_id
94+
database_resource_type = var.database_resource_type
95+
dbm_private_endpoint_id = var.dbm_private_endpoint_id
96+
service_name = var.service_name
97+
deployment_type = var.deployment_type
98+
credential_details {
99+
credential_type = var.credential_details_credential_type
100+
password_secret_id = var.password_secret_id
101+
role = var.credential_details_role
102+
user_name = var.user_name
103+
}
104+
}
105+
}
106+
defined_tags = "${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "${var.exadata_insight_defined_tags_value}")}"
107+
freeform_tags = var.freeform_tags
108+
}
109+
110+
variable "exadata_insight_state" {
111+
default = ["ACTIVE"]
112+
}
113+
114+
variable "exadata_insight_status" {
115+
default = ["ENABLED"]
116+
}
117+
118+
variable "exadata_type" {
119+
default = ["EXACS"]
120+
}
121+
122+
// List PE comanaged exadata insights
123+
data "oci_opsi_exadata_insights" "test_exadata_insights" {
124+
#Optional
125+
compartment_id = var.compartment_ocid
126+
exadata_type = var.exadata_insight_type
127+
state = var.exadata_insight_state
128+
status = var.exadata_insight_status
129+
}
130+
131+
// Get a PE comanaged exadata insight
132+
data "oci_opsi_exadata_insight" "test_exadata_insight" {
133+
exadata_insight_id = oci_opsi_exadata_insight.test_exadata_insight.id
134+
}
135+

0 commit comments

Comments
 (0)