Skip to content

Commit 8a20c57

Browse files
adding new features to Deploy-Autonomous-Database-and-the-MovieStream-data-sets-for-Oracle-LiveLabs
1 parent 79f81da commit 8a20c57

File tree

11 files changed

+195
-65
lines changed

11 files changed

+195
-65
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
variable "adw_params" {
5+
type = map(object({
6+
compartment_id = string
7+
compute_model = string
8+
compute_count = number
9+
size_in_tbs = number
10+
db_name = string
11+
db_workload = string
12+
db_version = string
13+
license_model = string
14+
database_admin_password = string
15+
database_wallet_password = string
16+
enable_auto_scaling = bool
17+
is_free_tier = bool
18+
create_local_wallet = bool
19+
is_mtls_connection_required = bool
20+
subnet_id = string
21+
nsg_ids = list(string)
22+
defined_tags = map(string)
23+
}))
24+
}

cloud-foundation/solutions/Deploy-Autonomous-Database-and-the-MovieStream-data-sets-for-Oracle-LiveLabs/README.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ Now, you'll want a local copy of this repo. You can make that with the commands:
232232

233233
## Prerequisites
234234

235-
- Install Terraform v0.13 or greater: https://www.terraform.io/downloads.html
235+
- Install Terraform v0.15 or greater: https://www.terraform.io/downloads.html
236236
- Install Python 3.6: https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-local-programming-environment-on-centos-7
237237
- Generate an OCI API Key
238238
- Create your config under \$home*directory/.oci/config (run \_oci setup config* and follow the steps)
@@ -373,7 +373,8 @@ The ADW subsystem / module is able to create ADW/ATP databases.
373373
* Parameters:
374374
* __db_name__ - The database name. The name must begin with an alphabetic character and can contain a maximum of 14 alphanumeric characters. Special characters are not permitted. The database name must be unique in the tenancy.
375375
* __db_password__ - The password must be between 12 and 30 characters long, and must contain at least 1 uppercase, 1 lowercase, and 1 numeric character. It cannot contain the double quote symbol (") or the username "admin", regardless of casing. The password is mandatory if source value is "BACKUP_FROM_ID", "BACKUP_FROM_TIMESTAMP", "DATABASE" or "NONE".
376-
* __db_cpu_core_count__ - The number of OCPU cores to be made available to the database. For Autonomous Databases on dedicated Exadata infrastructure, the maximum number of cores is determined by the infrastructure shape. See Characteristics of Infrastructure Shapes for shape details.
376+
* __db_compute_model__ - The compute model of the Autonomous Database. This is required if using the computeCount parameter. If using cpuCoreCount then it is an error to specify computeModel to a non-null value.
377+
* __db_compute_count__ - The compute amount available to the database. Minimum and maximum values depend on the compute model and whether the database is on Shared or Dedicated infrastructure. For an Autonomous Database on Shared infrastructure, the 'ECPU' compute model requires values in multiples of two. Required when using the computeModel parameter. When using cpuCoreCount parameter, it is an error to specify computeCount to a non-null value.
377378
* __db_size_in_tbs__ - The size, in gigabytes, of the data volume that will be created and attached to the database. This storage can later be scaled up if needed. The maximum storage value is determined by the infrastructure shape. See Characteristics of Infrastructure Shapes for shape details.
378379
* __db_workload__ - The Autonomous Database workload type. The following values are valid:
379380
- OLTP - indicates an Autonomous Transaction Processing database
@@ -398,12 +399,17 @@ variable "db_name" {
398399
399400
variable "db_password" {
400401
type = string
401-
default = "<enter-password-here>"
402+
default = "WlsAtpDb1234#"
402403
}
403404
404-
variable "db_cpu_core_count" {
405+
variable "db_compute_model" {
406+
type = string
407+
default = "ECPU"
408+
}
409+
410+
variable "db_compute_count" {
405411
type = number
406-
default = 1
412+
default = 4
407413
}
408414
409415
variable "db_size_in_tbs" {
@@ -423,7 +429,7 @@ variable "db_version" {
423429
424430
variable "db_enable_auto_scaling" {
425431
type = bool
426-
default = true
432+
default = false
427433
}
428434
429435
variable "db_is_free_tier" {
@@ -433,21 +439,22 @@ variable "db_is_free_tier" {
433439
434440
variable "db_license_model" {
435441
type = string
436-
default = "LICENSE_INCLUDED"
442+
default = "BRING_YOUR_OWN_LICENSE"
437443
}
438444
439445
variable "tag" {
440446
type = string
441-
default = "graph-get-started"
442447
# default = "movieapp"
448+
default = "graph-get-started"
449+
# default = "end-to-end"
450+
# default = "gen-ai"
443451
}
444452
445453
variable "run_post_load_procedures" {
446454
type = bool
447-
default = false
448-
# default = true
455+
#default = false
456+
default = true
449457
}
450-
451458
```
452459

453460
## Running the code

cloud-foundation/solutions/Deploy-Autonomous-Database-and-the-MovieStream-data-sets-for-Oracle-LiveLabs/locals.tf

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@ data "oci_identity_region_subscriptions" "home_region_subscriptions" {
3333

3434
locals{
3535
ad_names = compact(data.template_file.ad_names.*.rendered)
36-
conn_db = module.adw_database_private_endpoint.db_connection[0].profiles[1].value
36+
conn_db = module.adw_ecpus.db_connection[0].profiles[1].value
3737

3838
# Create Autonomous Data Warehouse
3939
adw_params = {
4040
adw = {
41-
compartment_id = var.compartment_id,
42-
cpu_core_count = var.db_cpu_core_count
41+
compartment_id = var.compartment_id
42+
compute_model = var.db_compute_model
43+
compute_count = var.db_compute_count
4344
size_in_tbs = var.db_size_in_tbs
4445
db_name = var.db_name
4546
db_workload = var.db_workload
@@ -60,7 +61,3 @@ locals{
6061
# End
6162

6263
}
63-
64-
65-
66-

cloud-foundation/solutions/Deploy-Autonomous-Database-and-the-MovieStream-data-sets-for-Oracle-LiveLabs/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.
33

44
# Create ADW Database with Endpoint in private subnet or public ADW
5-
module "adw_database_private_endpoint" {
6-
source = "../../../cloud-foundation/modules/cloud-foundation-library/database/adw_private_endpoint"
5+
module "adw_ecpus" {
6+
source = "../../../cloud-foundation/modules/cloud-foundation-library/database/adw_ecpus"
77
adw_params = local.adw_params
88
}

cloud-foundation/solutions/Deploy-Autonomous-Database-and-the-MovieStream-data-sets-for-Oracle-LiveLabs/outputs.tf

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,30 @@ output "adb_user_name" {
1111
value = "MOVIESTREAM"
1212
}
1313

14-
output "adb_user__password" {
14+
output "adb_user_password" {
1515
value = "watchS0meMovies#"
1616
}
1717

1818
output "ADW_Database_db_connection" {
19-
value = module.adw_database_private_endpoint.db_connection
19+
value = module.adw_ecpus.db_connection
2020
}
2121

22-
output "ADW_Database_private_endpoint_ip" {
23-
value = module.adw_database_private_endpoint.private_endpoint_ip
22+
output "ADW_Database_ip" {
23+
value = module.adw_ecpus.private_endpoint_ip
2424
}
2525

2626
output "Database_Actions" {
27-
value = module.adw_database_private_endpoint.url
27+
value = module.adw_ecpus.url
2828
}
2929

3030
output "graph_studio_url" {
31-
value = module.adw_database_private_endpoint.graph_studio_url
31+
value = module.adw_ecpus.graph_studio_url
3232
}
3333

3434
output "machine_learning_user_management_url" {
35-
value = module.adw_database_private_endpoint.machine_learning_user_management_url
35+
value = module.adw_ecpus.machine_learning_user_management_url
3636
}
3737

3838
output "database_fully_qualified_name" {
39-
value = module.adw_database_private_endpoint.database_fully_qualified_name
39+
value = module.adw_ecpus.database_fully_qualified_name
4040
}

cloud-foundation/solutions/Deploy-Autonomous-Database-and-the-MovieStream-data-sets-for-Oracle-LiveLabs/provider.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.
33

44
terraform {
5-
required_version = ">= 1.1.0"
5+
required_version = ">= 1.2.0"
66
required_providers {
77
oci = {
88
source = "oracle/oci"
9-
version = ">= 4.37.0"
9+
version = ">= 5.9.0"
1010
}
1111
}
1212
}

cloud-foundation/solutions/Deploy-Autonomous-Database-and-the-MovieStream-data-sets-for-Oracle-LiveLabs/provisioners.tf

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ resource "null_resource" "sqlcl-create-usr" {
1616
rm -rf tables.sql
1717
EOT
1818
}
19-
20-
depends_on = [module.adw_database_private_endpoint]
21-
19+
depends_on = [module.adw_ecpus]
2220
}
2321

2422
resource "local_file" "this" {

cloud-foundation/solutions/Deploy-Autonomous-Database-and-the-MovieStream-data-sets-for-Oracle-LiveLabs/schema.yaml

Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ groupings:
2323
- db_version
2424
- db_size_in_tbs
2525
- db_enable_auto_scaling
26-
- db_cpu_core_count
26+
- db_compute_model
27+
- db_compute_count
2728
- db_workload
2829
- tag
2930
- run_post_load_procedures
@@ -84,12 +85,12 @@ variables:
8485
enum:
8586
- LICENSE_INCLUDED
8687
- BRING_YOUR_OWN_LICENSE
87-
default: BRING_YOUR_OWN_LICENSE
88+
default: LICENSE_INCLUDED
8889
required: true
8990
visible:
9091
eq:
9192
- db_is_free_tier
92-
- "false"
93+
- false
9394
db_password:
9495
title: Database Admin Password
9596
description: "Provide admin password. Constraints: 12 - 30 characters. At least one uppercase letter, one lowercase letter, and one number. No special characters."
@@ -124,38 +125,46 @@ variables:
124125
- 52
125126
- 128
126127
default: 1
127-
visible: true
128128
required: true
129+
visible:
130+
eq:
131+
- db_is_free_tier
132+
- false
129133
db_enable_auto_scaling:
130134
title: Indicates if auto scaling is enabled for the Autonomous Database CPU core count.
131135
description: "Indicates if auto scaling is enabled for the Autonomous Database CPU core count. "
132136
type: enum
133137
enum:
134-
- "true"
135-
- "false"
136-
default: "false"
138+
- true
139+
- false
140+
default: false
137141
required: true
138-
visible: true
139-
db_cpu_core_count:
140-
title: The number of OCPU cores to be made available to the database
141-
description: "The number of OCPU cores to enable. Available cores are subject to your tenancy's service limits."
142+
visible:
143+
eq:
144+
- db_is_free_tier
145+
- false
146+
db_compute_model:
147+
title: "The compute model of the Autonomous Database ECPUs"
148+
description: "The compute model of the Autonomous Database ECPUs"
142149
type: enum
143150
enum:
144-
- 1
145-
- 2
146-
- 3
147-
- 4
148-
- 5
149-
- 6
150-
- 7
151-
- 8
152-
- 9
153-
- 10
154-
- 11
155-
- 12
156-
default: 1
151+
- "ECPU"
152+
default: "ECPU"
157153
required: true
158-
visible: true
154+
visible:
155+
eq:
156+
- db_is_free_tier
157+
- false
158+
db_compute_count:
159+
title: The number of ECPUs cores to be made available to the database
160+
description: "The number of ECPU cores to enable. For ECPUs count needs to be minimum 2 and maximum 512 ECPUs"
161+
type: string
162+
default: 4
163+
required: true
164+
visible:
165+
eq:
166+
- db_is_free_tier
167+
- false
159168
db_workload:
160169
title: Autonomous Database Type of workload.
161170
description: "Autonomous Database Type of workload."
@@ -173,6 +182,7 @@ variables:
173182
- "movieapp"
174183
- "graph-get-started"
175184
- "end-to-end"
185+
- "gen-ai"
176186
default: "end-to-end"
177187
required: true
178188
visible: true

0 commit comments

Comments
 (0)