generated from oracle-devrel/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #96 from oracle-devrel/iopanait-develop33
adding the Deploy-ChatDB-Autonomous-Database-Select-AI-demonstration …
- Loading branch information
Showing
20 changed files
with
1,613 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+43.4 KB
...tions-for-oracle-res-mgr/Deploy-ChatDB-Autonomous-Database-Select-AI-demonstration-RM.zip
Binary file not shown.
6 changes: 6 additions & 0 deletions
6
...foundation/solutions/Deploy-ChatDB-Autonomous-Database-Select-AI-demonstration/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Copyright © 2022, Oracle and/or its affiliates. | ||
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl. | ||
|
||
.terraform | ||
*tfstate* | ||
*.pem |
32 changes: 32 additions & 0 deletions
32
...tions/Deploy-ChatDB-Autonomous-Database-Select-AI-demonstration/CONTRIBUTING.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!-- | ||
# Copyright © 2023, Oracle and/or its affiliates. | ||
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl. | ||
--> | ||
# Contributing to Oracle Cloud Foundation Terraform Framework | ||
|
||
## Contributing to Oracle Cloud Foundation Terraform Framework | ||
|
||
Oracle welcomes contributions to this repository from anyone. | ||
|
||
If you want to submit a pull request to fix a bug or enhance an existing | ||
feature, please first open an issue and link to that issue when you | ||
submit your pull request. | ||
|
||
If you have any questions about a possible submission, feel free to open | ||
an issue too. | ||
|
||
## Pull request process | ||
|
||
1. Fork this repository | ||
1. Create a branch in your fork to implement the changes. We recommend using | ||
the issue number as part of your branch name, e.g. `1234-fixes` | ||
1. Ensure that there is at least one test that would fail without the fix and | ||
passes post fix | ||
1. Submit the pull request. *Do not leave the pull request blank*. Explain exactly | ||
what your changes are meant to do and provide simple steps on how to validate | ||
your changes, ideally referencing the test. Ensure that you reference the issue | ||
you created as well. We will assign the pull request to 1-2 people for review | ||
before it is submitted internally and the PR is closed. |
27 changes: 27 additions & 0 deletions
27
cloud-foundation/solutions/Deploy-ChatDB-Autonomous-Database-Select-AI-demonstration/LICENSE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Copyright © 2023 Oracle and/or its affiliates. All rights reserved. | ||
|
||
The Universal Permissive License (UPL), Version 1.0 | ||
|
||
Subject to the condition set forth below, permission is hereby granted to any person obtaining a copy of this | ||
software, associated documentation and/or data (collectively the "Software"), free of charge and under any and | ||
all copyright rights in the Software, and any and all patent rights owned or freely licensable by each licensor | ||
hereunder covering either (i) the unmodified Software as contributed to or provided by such licensor, or | ||
(ii) the Larger Works (as defined below), to deal in both | ||
|
||
(a) the Software, and | ||
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if one is included with the Software | ||
(each a “Larger Work” to which the Software is contributed by such licensors), | ||
|
||
without restriction, including without limitation the rights to copy, create derivative works of, display, | ||
perform, and distribute the Software and make, use, sell, offer for sale, import, export, have made, and have | ||
sold the Software and the Larger Work(s), and to sublicense the foregoing rights on either these or other terms. | ||
|
||
This license is subject to the following condition: | ||
The above copyright notice and either this complete permission notice or at a minimum a reference to the UPL must | ||
be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO | ||
THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | ||
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
IN THE SOFTWARE. |
644 changes: 644 additions & 0 deletions
644
...n/solutions/Deploy-ChatDB-Autonomous-Database-Select-AI-demonstration/README.md
Large diffs are not rendered by default.
Oops, something went wrong.
66 changes: 66 additions & 0 deletions
66
...-foundation/solutions/Deploy-ChatDB-Autonomous-Database-Select-AI-demonstration/locals.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Copyright © 2023, Oracle and/or its affiliates. | ||
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl. | ||
|
||
data "oci_identity_availability_domains" "ADs" { | ||
compartment_id = var.tenancy_ocid | ||
} | ||
|
||
data "oci_identity_tenancy" "tenancy" { | ||
tenancy_id = var.tenancy_ocid | ||
} | ||
|
||
data "template_file" "ad_names" { | ||
count = length(data.oci_identity_availability_domains.ADs.availability_domains) | ||
template = lookup(data.oci_identity_availability_domains.ADs.availability_domains[count.index], "name") | ||
} | ||
|
||
data "oci_core_services" "sgw_services" { | ||
filter { | ||
name = "cidr_block" | ||
values = ["all-.*-services-in-oracle-services-network"] | ||
regex = true | ||
} | ||
} | ||
|
||
data "oci_identity_region_subscriptions" "home_region_subscriptions" { | ||
tenancy_id = var.tenancy_ocid | ||
|
||
filter { | ||
name = "is_home_region" | ||
values = [true] | ||
} | ||
} | ||
|
||
locals{ | ||
ad_names = compact(data.template_file.ad_names.*.rendered) | ||
conn_db = module.adb.db_connection[0].profiles[1].value | ||
|
||
# Create Autonomous Data Warehouse | ||
adw_params = { | ||
adw = { | ||
compartment_id = var.compartment_id | ||
compute_model = var.db_compute_model | ||
compute_count = var.db_compute_count | ||
size_in_tbs = var.db_size_in_tbs | ||
db_name = var.db_name | ||
db_workload = var.db_workload | ||
db_version = var.db_version | ||
enable_auto_scaling = var.db_enable_auto_scaling | ||
is_free_tier = var.db_is_free_tier | ||
license_model = var.db_license_model | ||
create_local_wallet = true | ||
database_admin_password = var.db_password | ||
database_wallet_password = var.db_password | ||
data_safe_status = var.db_data_safe_status | ||
operations_insights_status = var.db_operations_insights_status | ||
database_management_status = var.db_database_management_status | ||
is_mtls_connection_required = null | ||
subnet_id = null | ||
nsg_ids = null | ||
defined_tags = {} | ||
}, | ||
} | ||
|
||
# End | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
cloud-foundation/solutions/Deploy-ChatDB-Autonomous-Database-Select-AI-demonstration/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Copyright © 2023, Oracle and/or its affiliates. | ||
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl. | ||
|
||
# Create ADW Database with Endpoint in private subnet or public ADW | ||
module "adb" { | ||
source = "./modules/cloud-foundation-library/database/adb" | ||
adw_params = local.adw_params | ||
} |
42 changes: 42 additions & 0 deletions
42
...us-Database-Select-AI-demonstration/modules/cloud-foundation-library/database/adb/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Copyright © 2023, Oracle and/or its affiliates. | ||
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl. | ||
|
||
locals { | ||
adw_download_wallet = { for key, value in var.adw_params : key => value if value.create_local_wallet == true } | ||
} | ||
|
||
resource "oci_database_autonomous_database_wallet" "autonomous_database_wallet" { | ||
for_each = var.adw_params | ||
autonomous_database_id = oci_database_autonomous_database.adw[each.key].id | ||
password = each.value.database_wallet_password | ||
base64_encode_content = "true" | ||
} | ||
|
||
resource "local_file" "autonomous_data_warehouse_wallet_file" { | ||
for_each = local.adw_download_wallet | ||
content_base64 = oci_database_autonomous_database_wallet.autonomous_database_wallet[each.key].content | ||
filename = "${path.cwd}/wallet_${each.value.db_name}.zip" | ||
} | ||
|
||
resource "oci_database_autonomous_database" "adw" { | ||
for_each = var.adw_params | ||
admin_password = each.value.database_admin_password | ||
compartment_id = each.value.compartment_id | ||
compute_model = each.value.compute_model | ||
compute_count = each.value.compute_count | ||
data_storage_size_in_tbs = each.value.size_in_tbs | ||
db_name = each.value.db_name | ||
display_name = each.value.db_name | ||
db_workload = each.value.db_workload | ||
db_version = each.value.db_version | ||
license_model = each.value.license_model | ||
is_mtls_connection_required = each.value.is_mtls_connection_required | ||
subnet_id = each.value.subnet_id | ||
nsg_ids = each.value.nsg_ids | ||
defined_tags = each.value.defined_tags | ||
is_auto_scaling_enabled = each.value.enable_auto_scaling | ||
is_free_tier = each.value.is_free_tier | ||
data_safe_status = each.value.data_safe_status | ||
operations_insights_status = each.value.operations_insights_status | ||
database_management_status = each.value.database_management_status | ||
} |
64 changes: 64 additions & 0 deletions
64
...Database-Select-AI-demonstration/modules/cloud-foundation-library/database/adb/outputs.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Copyright © 2023, Oracle and/or its affiliates. | ||
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl. | ||
|
||
output "atp_db_id" { | ||
value = { | ||
for adw in oci_database_autonomous_database.adw: | ||
adw.display_name => adw.id | ||
} | ||
} | ||
|
||
output "ad" { | ||
value = { | ||
for idx, ad in oci_database_autonomous_database.adw: | ||
ad.db_name => { "connection_strings" : ad.connection_strings.0.all_connection_strings} | ||
} | ||
} | ||
|
||
output "db_connection" { | ||
value = one([ for b in oci_database_autonomous_database.adw : b.connection_strings]) | ||
} | ||
|
||
output "private_endpoint_ip" { | ||
value = one([for b in oci_database_autonomous_database.adw : b.private_endpoint_ip]) | ||
} | ||
|
||
output "private_endpoint" { | ||
value = ([for b in oci_database_autonomous_database.adw : b.private_endpoint]) | ||
} | ||
|
||
output "url" { | ||
value = [for b in oci_database_autonomous_database.adw : b.connection_urls.0.sql_dev_web_url] | ||
} | ||
|
||
output "graph_studio_url" { | ||
value = [for b in oci_database_autonomous_database.adw : b.connection_urls.0.graph_studio_url] | ||
} | ||
|
||
output "machine_learning_user_management_url" { | ||
value = [for b in oci_database_autonomous_database.adw : b.connection_urls.0.machine_learning_user_management_url] | ||
} | ||
|
||
output "adb_wallet_content" { | ||
value = oci_database_autonomous_database_wallet.autonomous_database_wallet["adw"].content | ||
} | ||
|
||
output "database_fully_qualified_name" { | ||
value = lower(trimsuffix(trimprefix(join("\n", [for b in oci_database_autonomous_database.adw : b.connection_urls.0.graph_studio_url]), "https://"), "/graphstudio/")) | ||
} | ||
|
||
output "adw" { | ||
value = { | ||
for adw in oci_database_autonomous_database.adw: | ||
adw.display_name => adw.id | ||
} | ||
} | ||
|
||
output "apex_url" { | ||
value = [for b in oci_database_autonomous_database.adw : b.connection_urls.0.apex_url] | ||
} | ||
|
||
output "select_ai_demo_url" { | ||
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"]) | ||
} | ||
|
27 changes: 27 additions & 0 deletions
27
...tabase-Select-AI-demonstration/modules/cloud-foundation-library/database/adb/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright © 2023, Oracle and/or its affiliates. | ||
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl. | ||
|
||
variable "adw_params" { | ||
type = map(object({ | ||
compartment_id = string | ||
compute_model = string | ||
compute_count = number | ||
size_in_tbs = number | ||
db_name = string | ||
db_workload = string | ||
db_version = string | ||
license_model = string | ||
database_admin_password = string | ||
database_wallet_password = string | ||
enable_auto_scaling = bool | ||
is_free_tier = bool | ||
create_local_wallet = bool | ||
is_mtls_connection_required = bool | ||
subnet_id = string | ||
data_safe_status = string | ||
operations_insights_status = string | ||
database_management_status = string | ||
nsg_ids = list(string) | ||
defined_tags = map(string) | ||
})) | ||
} |
52 changes: 52 additions & 0 deletions
52
...foundation/solutions/Deploy-ChatDB-Autonomous-Database-Select-AI-demonstration/outputs.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Copyright © 2023, Oracle and/or its affiliates. | ||
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl. | ||
|
||
# Autonomous Database Outputs: | ||
|
||
output "adb_admin_password" { | ||
description = "ADB Admin password" | ||
value = var.db_password | ||
sensitive = true | ||
} | ||
|
||
output "adb_user_name" { | ||
description = "Workshop user name" | ||
value = "MOVIESTREAM" | ||
} | ||
|
||
output "adb_user_password" { | ||
description = "Workshop user initial password" | ||
value = "watchS0meMovies#" | ||
} | ||
|
||
output "ADW_Database_db_connection" { | ||
value = module.adb.db_connection | ||
} | ||
|
||
output "database_fully_qualified_name" { | ||
value = module.adb.database_fully_qualified_name | ||
} | ||
|
||
output "ADW_Database_ip" { | ||
value = module.adb.private_endpoint_ip | ||
} | ||
|
||
output "Database_Actions" { | ||
value = module.adb.url | ||
} | ||
|
||
output "graph_studio_url" { | ||
value = module.adb.graph_studio_url | ||
} | ||
|
||
output "machine_learning_user_management_url" { | ||
value = module.adb.machine_learning_user_management_url | ||
} | ||
|
||
output "apex_url" { | ||
value = module.adb.apex_url | ||
} | ||
|
||
output "select_ai_demo_url" { | ||
value = module.adb.select_ai_demo_url | ||
} |
31 changes: 31 additions & 0 deletions
31
...oundation/solutions/Deploy-ChatDB-Autonomous-Database-Select-AI-demonstration/provider.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright © 2023, Oracle and/or its affiliates. | ||
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl. | ||
|
||
terraform { | ||
required_version = ">= 1.2.0" | ||
required_providers { | ||
oci = { | ||
source = "oracle/oci" | ||
version = ">= 5.9.0" | ||
} | ||
} | ||
} | ||
|
||
provider "oci" { | ||
tenancy_ocid = var.tenancy_ocid | ||
user_ocid = var.user_ocid | ||
fingerprint = var.fingerprint | ||
private_key_path = var.private_key_path | ||
region = var.region | ||
disable_auto_retries = false | ||
} | ||
|
||
provider "oci" { | ||
alias = "homeregion" | ||
tenancy_ocid = var.tenancy_ocid | ||
user_ocid = var.user_ocid | ||
fingerprint = var.fingerprint | ||
private_key_path = var.private_key_path | ||
region = data.oci_identity_region_subscriptions.home_region_subscriptions.region_subscriptions[0].region_name | ||
disable_auto_retries = false | ||
} |
Oops, something went wrong.