Skip to content

Commit 6ee98e4

Browse files
Tawen KanMaxrovr
authored andcommitted
Added - Support for Ops Insights support for ADB@ExaCC
1 parent 99defcb commit 6ee98e4

14 files changed

+3341
-751
lines changed
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
// Copyright (c) 2017, 2024, 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 "management_agent_id" {}
11+
variable "macs_adb_id" {}
12+
variable "service_name" {}
13+
variable "adb_host" {}
14+
variable "adb_port" {}
15+
variable "named_credential_id" {}
16+
17+
provider "oci" {
18+
tenancy_ocid = var.tenancy_ocid
19+
user_ocid = var.user_ocid
20+
fingerprint = var.fingerprint
21+
private_key_path = var.private_key_path
22+
region = var.region
23+
}
24+
25+
resource "oci_identity_tag_namespace" "tag-namespace1" {
26+
compartment_id = var.tenancy_ocid
27+
description = "example tag namespace"
28+
name = "examples-tag-namespace-all"
29+
is_retired = false
30+
}
31+
32+
resource "oci_identity_tag" "tag1" {
33+
description = "example tag"
34+
name = "example-tag"
35+
tag_namespace_id = oci_identity_tag_namespace.tag-namespace1.id
36+
is_cost_tracking = false
37+
is_retired = false
38+
}
39+
40+
variable "database_insight_database_type" {
41+
default = ["ATP-EXACC"]
42+
}
43+
44+
variable "deployment_type" {
45+
default = "EXACC"
46+
}
47+
48+
variable "database_insight_connection_credential_details_credential_type" {
49+
default = "CREDENTIALS_BY_NAMED_CREDS"
50+
}
51+
52+
variable "database_insight_connection_credential_details_role" {
53+
default = "NORMAL"
54+
}
55+
56+
variable "database_insight_database_resource_type" {
57+
default = "autonomousdatabase"
58+
}
59+
60+
variable "database_insight_defined_tags_value" {
61+
default = "value"
62+
}
63+
64+
variable "database_insight_entity_source" {
65+
default = "MACS_MANAGED_AUTONOMOUS_DATABASE"
66+
}
67+
68+
variable "database_insight_fields" {
69+
default = ["databaseName", "databaseType", "compartmentId", "databaseDisplayName", "freeformTags", "definedTags"]
70+
}
71+
72+
variable "database_insight_freeform_tags" {
73+
default = { "bar-key" = "value" }
74+
}
75+
76+
variable "resource_status" {
77+
default = "ENABLED"
78+
}
79+
80+
// Create Database insight for EM managed External Database
81+
resource "oci_opsi_database_insight" "test_database_insight" {
82+
#Required
83+
compartment_id = var.compartment_ocid
84+
entity_source = var.database_insight_entity_source
85+
86+
#Optional
87+
management_agent_id = var.management_agent_id
88+
database_id = var.macs_adb_id
89+
deployment_type = var.deployment_type
90+
database_resource_type = var.database_insight_database_resource_type
91+
connection_credential_details {
92+
credential_type = var.database_insight_connection_credential_details_credential_type
93+
named_credential_id = var.named_credential_id
94+
}
95+
connection_details {
96+
host_name = var.adb_host
97+
protocol = "TCP"
98+
service_name = var.service_name
99+
port = var.adb_port
100+
}
101+
defined_tags = "${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "${var.database_insight_defined_tags_value}")}"
102+
freeform_tags = var.database_insight_freeform_tags
103+
status = var.resource_status
104+
}
105+
106+
variable "database_insight_state" {
107+
default = ["ACTIVE"]
108+
}
109+
110+
variable "database_insight_status" {
111+
default = ["ENABLED"]
112+
}
113+
114+
// List MACS Cloud database insights
115+
data "oci_opsi_database_insights" "test_database_insights" {
116+
#Optional
117+
compartment_id = var.compartment_ocid
118+
database_type = var.database_insight_database_type
119+
fields = var.database_insight_fields
120+
state = var.database_insight_state
121+
status = var.database_insight_status
122+
}
123+
124+
// Get an EM managed database insight
125+
data "oci_opsi_database_insight" "test_database_insight" {
126+
database_insight_id = oci_opsi_database_insight.test_database_insight.id
127+
}
128+
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
// Copyright (c) 2017, 2024, 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 "management_agent_id" {}
11+
variable "macs_adb_id" {}
12+
variable "exadata_infra_id" {}
13+
variable "vmcluster_id" {}
14+
variable "named_credential_id" {}
15+
variable "adb_host" {}
16+
variable "adb_port" {}
17+
variable "service_name" {}
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 = ["EXACC"]
44+
}
45+
46+
variable "deployment_type" {
47+
default = "EXACC"
48+
}
49+
50+
variable "credential_details_credential_type" {
51+
default = "CREDENTIALS_BY_NAMED_CREDS"
52+
}
53+
54+
variable "credential_details_role" {
55+
default = "NORMAL"
56+
}
57+
58+
variable "database_resource_type" {
59+
default = "autonomousdatabase"
60+
}
61+
62+
variable "exadata_insight_defined_tags_value" {
63+
default = "value"
64+
}
65+
66+
variable "exadata_insight_entity_source" {
67+
default = "MACS_MANAGED_CLOUD_EXADATA"
68+
}
69+
70+
variable "vm_cluster_type" {
71+
default = "vmCluster"
72+
}
73+
74+
variable "freeform_tags" {
75+
default = { "bar-key" = "value" }
76+
}
77+
78+
variable "resource_status" {
79+
default = "ENABLED"
80+
}
81+
82+
// Create MACS Cloud Exadata insight
83+
resource "oci_opsi_exadata_insight" "test_exadata_insight" {
84+
#Required
85+
compartment_id = var.compartment_ocid
86+
entity_source = var.exadata_insight_entity_source
87+
#Optional
88+
exadata_infra_id = var.exadata_infra_id
89+
member_vm_cluster_details {
90+
vmcluster_id = var.vmcluster_id
91+
compartment_id = var.compartment_ocid
92+
vm_cluster_type = var.vm_cluster_type
93+
member_autonomous_details {
94+
entity_source = "MACS_MANAGED_AUTONOMOUS_DATABASE"
95+
compartment_id = var.compartment_ocid
96+
database_id = var.macs_adb_id
97+
database_resource_type = var.database_resource_type
98+
management_agent_id = var.management_agent_id
99+
deployment_type = var.deployment_type
100+
connection_credential_details {
101+
credential_type = var.credential_details_credential_type
102+
named_credential_id = var.named_credential_id
103+
}
104+
connection_details {
105+
host_name = var.adb_host
106+
protocol = "TCP"
107+
service_name = var.service_name
108+
port = var.adb_port
109+
}
110+
}
111+
}
112+
defined_tags = "${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "${var.exadata_insight_defined_tags_value}")}"
113+
freeform_tags = var.freeform_tags
114+
}
115+
116+
variable "exadata_insight_state" {
117+
default = ["ACTIVE"]
118+
}
119+
120+
variable "exadata_insight_status" {
121+
default = ["ENABLED"]
122+
}
123+
124+
variable "exadata_type" {
125+
default = ["EXACC"]
126+
}
127+
128+
// List MACS Cloud exadata insights
129+
data "oci_opsi_exadata_insights" "test_exadata_insights" {
130+
#Optional
131+
compartment_id = var.compartment_ocid
132+
exadata_type = var.exadata_insight_type
133+
state = var.exadata_insight_state
134+
status = var.exadata_insight_status
135+
}
136+
137+
// Get a MACS exadata insight
138+
data "oci_opsi_exadata_insight" "test_exadata_insight" {
139+
exadata_insight_id = oci_opsi_exadata_insight.test_exadata_insight.id
140+
}

0 commit comments

Comments
 (0)