Skip to content

Commit f334d13

Browse files
changed solution for Marty Deploy-ChatDB-Autonomous-Database-oci-genai-demonstration solution for RM especially
1 parent 279a396 commit f334d13

File tree

23 files changed

+1648
-19
lines changed

23 files changed

+1648
-19
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright © 2022, Oracle and/or its affiliates.
2+
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.
3+
4+
.terraform
5+
*tfstate*
6+
*.pem
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!--
2+
3+
# Copyright © 2023, Oracle and/or its affiliates.
4+
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.
5+
6+
7+
-->
8+
# Contributing to Oracle Cloud Foundation Terraform Framework
9+
10+
## Contributing to Oracle Cloud Foundation Terraform Framework
11+
12+
Oracle welcomes contributions to this repository from anyone.
13+
14+
If you want to submit a pull request to fix a bug or enhance an existing
15+
feature, please first open an issue and link to that issue when you
16+
submit your pull request.
17+
18+
If you have any questions about a possible submission, feel free to open
19+
an issue too.
20+
21+
## Pull request process
22+
23+
1. Fork this repository
24+
1. Create a branch in your fork to implement the changes. We recommend using
25+
the issue number as part of your branch name, e.g. `1234-fixes`
26+
1. Ensure that there is at least one test that would fail without the fix and
27+
passes post fix
28+
1. Submit the pull request. *Do not leave the pull request blank*. Explain exactly
29+
what your changes are meant to do and provide simple steps on how to validate
30+
your changes, ideally referencing the test. Ensure that you reference the issue
31+
you created as well. We will assign the pull request to 1-2 people for review
32+
before it is submitted internally and the PR is closed.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright © 2023 Oracle and/or its affiliates. All rights reserved.
2+
3+
The Universal Permissive License (UPL), Version 1.0
4+
5+
Subject to the condition set forth below, permission is hereby granted to any person obtaining a copy of this
6+
software, associated documentation and/or data (collectively the "Software"), free of charge and under any and
7+
all copyright rights in the Software, and any and all patent rights owned or freely licensable by each licensor
8+
hereunder covering either (i) the unmodified Software as contributed to or provided by such licensor, or
9+
(ii) the Larger Works (as defined below), to deal in both
10+
11+
(a) the Software, and
12+
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if one is included with the Software
13+
(each a “Larger Work” to which the Software is contributed by such licensors),
14+
15+
without restriction, including without limitation the rights to copy, create derivative works of, display,
16+
perform, and distribute the Software and make, use, sell, offer for sale, import, export, have made, and have
17+
sold the Software and the Larger Work(s), and to sublicense the foregoing rights on either these or other terms.
18+
19+
This license is subject to the following condition:
20+
The above copyright notice and either this complete permission notice or at a minimum a reference to the UPL must
21+
be included in all copies or substantial portions of the Software.
22+
23+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
24+
THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
26+
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
27+
IN THE SOFTWARE.

cloud-foundation/solutions-for-oracle-res-mgr/Deploy-ChatDB-Autonomous-Database-oci-genai-demonstration-RM/README.md

Lines changed: 668 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://cloud.oracle.com/resourcemanager/stacks/create?region=home&zipUrl=https://github.com/oracle-devrel/terraform-oci-oracle-cloud-foundation/releases/download/v1.0.0/Deploy-ChatDB-Autonomous-Database-oci-genai-demonstration-RM.zip&zipUrlVariables={%22tag%22:%22moviestream-analytics%22,%22db_compute_count%22:4,%22db_name%22:%22MovieStreamWorkshop%22}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Copyright © 2023, Oracle and/or its affiliates.
2+
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.
3+
4+
data "oci_identity_availability_domains" "ADs" {
5+
compartment_id = var.tenancy_ocid
6+
}
7+
8+
data "oci_identity_tenancy" "tenancy" {
9+
tenancy_id = var.tenancy_ocid
10+
}
11+
12+
data "template_file" "ad_names" {
13+
count = length(data.oci_identity_availability_domains.ADs.availability_domains)
14+
template = lookup(data.oci_identity_availability_domains.ADs.availability_domains[count.index], "name")
15+
}
16+
17+
data "oci_core_services" "sgw_services" {
18+
filter {
19+
name = "cidr_block"
20+
values = ["all-.*-services-in-oracle-services-network"]
21+
regex = true
22+
}
23+
}
24+
25+
data "oci_identity_region_subscriptions" "home_region_subscriptions" {
26+
tenancy_id = var.tenancy_ocid
27+
28+
filter {
29+
name = "is_home_region"
30+
values = [true]
31+
}
32+
}
33+
34+
locals{
35+
ad_names = compact(data.template_file.ad_names.*.rendered)
36+
conn_db = module.adb.db_connection[0].profiles[1].value
37+
38+
# Create Autonomous Data Warehouse
39+
adw_params = {
40+
adw = {
41+
compartment_id = var.compartment_id
42+
compute_model = var.db_compute_model
43+
compute_count = var.db_compute_count
44+
size_in_tbs = var.db_size_in_tbs
45+
db_name = var.db_name
46+
db_workload = var.db_workload
47+
db_version = var.db_version
48+
enable_auto_scaling = var.db_enable_auto_scaling
49+
is_free_tier = var.db_is_free_tier
50+
license_model = var.db_license_model
51+
create_local_wallet = true
52+
database_admin_password = var.db_password
53+
database_wallet_password = var.db_password
54+
data_safe_status = var.db_data_safe_status
55+
operations_insights_status = var.db_operations_insights_status
56+
database_management_status = var.db_database_management_status
57+
is_mtls_connection_required = null
58+
subnet_id = null
59+
nsg_ids = null
60+
defined_tags = {}
61+
},
62+
}
63+
64+
# End
65+
66+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright © 2023, Oracle and/or its affiliates.
2+
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.
3+
4+
# Create ADW Database with Endpoint in private subnet or public ADW
5+
module "adb" {
6+
source = "./modules/cloud-foundation-library/database/adb"
7+
adw_params = local.adw_params
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright © 2023, Oracle and/or its affiliates.
2+
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.
3+
4+
locals {
5+
adw_download_wallet = { for key, value in var.adw_params : key => value if value.create_local_wallet == true }
6+
}
7+
8+
resource "oci_database_autonomous_database_wallet" "autonomous_database_wallet" {
9+
for_each = var.adw_params
10+
autonomous_database_id = oci_database_autonomous_database.adw[each.key].id
11+
password = each.value.database_wallet_password
12+
base64_encode_content = "true"
13+
}
14+
15+
resource "local_file" "autonomous_data_warehouse_wallet_file" {
16+
for_each = local.adw_download_wallet
17+
content_base64 = oci_database_autonomous_database_wallet.autonomous_database_wallet[each.key].content
18+
filename = "${path.cwd}/wallet_${each.value.db_name}.zip"
19+
}
20+
21+
resource "oci_database_autonomous_database" "adw" {
22+
for_each = var.adw_params
23+
admin_password = each.value.database_admin_password
24+
compartment_id = each.value.compartment_id
25+
compute_model = each.value.compute_model
26+
compute_count = each.value.compute_count
27+
data_storage_size_in_tbs = each.value.size_in_tbs
28+
db_name = each.value.db_name
29+
display_name = each.value.db_name
30+
db_workload = each.value.db_workload
31+
db_version = each.value.db_version
32+
license_model = each.value.license_model
33+
is_mtls_connection_required = each.value.is_mtls_connection_required
34+
subnet_id = each.value.subnet_id
35+
nsg_ids = each.value.nsg_ids
36+
defined_tags = each.value.defined_tags
37+
is_auto_scaling_enabled = each.value.enable_auto_scaling
38+
is_free_tier = each.value.is_free_tier
39+
data_safe_status = each.value.data_safe_status
40+
operations_insights_status = each.value.operations_insights_status
41+
database_management_status = each.value.database_management_status
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Copyright © 2023, Oracle and/or its affiliates.
2+
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.
3+
4+
output "atp_db_id" {
5+
value = {
6+
for adw in oci_database_autonomous_database.adw:
7+
adw.display_name => adw.id
8+
}
9+
}
10+
11+
output "ad" {
12+
value = {
13+
for idx, ad in oci_database_autonomous_database.adw:
14+
ad.db_name => { "connection_strings" : ad.connection_strings.0.all_connection_strings}
15+
}
16+
}
17+
18+
output "db_connection" {
19+
value = one([ for b in oci_database_autonomous_database.adw : b.connection_strings])
20+
}
21+
22+
output "private_endpoint_ip" {
23+
value = one([for b in oci_database_autonomous_database.adw : b.private_endpoint_ip])
24+
}
25+
26+
output "private_endpoint" {
27+
value = ([for b in oci_database_autonomous_database.adw : b.private_endpoint])
28+
}
29+
30+
output "url" {
31+
value = [for b in oci_database_autonomous_database.adw : b.connection_urls.0.sql_dev_web_url]
32+
}
33+
34+
output "graph_studio_url" {
35+
value = [for b in oci_database_autonomous_database.adw : b.connection_urls.0.graph_studio_url]
36+
}
37+
38+
output "machine_learning_user_management_url" {
39+
value = [for b in oci_database_autonomous_database.adw : b.connection_urls.0.machine_learning_user_management_url]
40+
}
41+
42+
output "adb_wallet_content" {
43+
value = oci_database_autonomous_database_wallet.autonomous_database_wallet["adw"].content
44+
}
45+
46+
output "database_fully_qualified_name" {
47+
value = lower(trimsuffix(trimprefix(join("\n", [for b in oci_database_autonomous_database.adw : b.connection_urls.0.graph_studio_url]), "https://"), "/graphstudio/"))
48+
}
49+
50+
output "adw" {
51+
value = {
52+
for adw in oci_database_autonomous_database.adw:
53+
adw.display_name => adw.id
54+
}
55+
}
56+
57+
output "apex_url" {
58+
value = [for b in oci_database_autonomous_database.adw : b.connection_urls.0.apex_url]
59+
}
60+
61+
output "select_ai_demo_url" {
62+
value = join("", [lower(trimsuffix(join("\n", [for b in oci_database_autonomous_database.adw : b.connection_urls.0.graph_studio_url]), "/graphstudio/")),"/ords/r/moviestream/chatdb"])
63+
}
64+

0 commit comments

Comments
 (0)