Skip to content

Commit

Permalink
added new Oracle Data in industry Vertical DEMOS
Browse files Browse the repository at this point in the history
  • Loading branch information
ionelpanaitescu committed Jul 24, 2024
1 parent edffc2d commit a8be096
Show file tree
Hide file tree
Showing 28 changed files with 1,665 additions and 66 deletions.
Binary file not shown.
Binary file not shown.
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
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.
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.

Large diffs are not rendered by default.

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

}
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
}
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
}
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"])
}

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)
}))
}
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
}
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
}
Loading

0 comments on commit a8be096

Please sign in to comment.