Skip to content

Commit 72ec5e3

Browse files
committed
Various Example Updates
1 parent 8694d67 commit 72ec5e3

File tree

8 files changed

+147
-12
lines changed

8 files changed

+147
-12
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
This file show cases how to provision a full stack of deployment including an Azure VM, add the environment Delphix, ingest an Oracle dSource, and provision 1 VDB.
2+
3+
This is a great example of disaster recovery scenarios or showcasing the full power of Delphix.
4+
5+
Note: This example will not work out of the box, by default, as you might not have the same Oracle configuration and the Azure VM is half implementated. Consult the comments within the file for further direction.
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
/**
2+
* Summary: This template showcases a mock example to
3+
* 1) Provision an Azure VM.
4+
* 2) Create a Target environment from that VM.
5+
* 3) Link and Sync a dSource. Create a new snapshot.
6+
* 4) Provision a new VDB from that Oracle dSource's snapshot.
7+
* *** Warning: This is only an example. It will not work out of the box.***
8+
*/
9+
10+
terraform {
11+
required_providers {
12+
delphix = {
13+
version = ">=3.3.2"
14+
source = "delphix-integrations/delphix"
15+
}
16+
azurerm = {
17+
source = "hashicorp/azurerm"
18+
version = "~>3.0"
19+
}
20+
}
21+
}
22+
23+
// *** Requirement***: Various variables used throughout the example.
24+
locals {
25+
dct-key = "<1.XXXX>"
26+
dct-host = "<DCT HOSTNAME>"
27+
vm-hostname = "oracle-linux-host"
28+
vm-username = "<USERNAME>"
29+
vm-password = "<PASSWORD>"
30+
source-db-name = "<SOURCE DATABASE NAME>" // Name of Database dynamically identified on the source environment
31+
dsource-name = "full_deploy_dsource"
32+
vdb-name = "full_deploy_vdb"
33+
}
34+
35+
provider "delphix" {
36+
tls_insecure_skip = true
37+
key = local.dct-key
38+
host = loca.dct-host
39+
}
40+
41+
42+
// *** Requirement ***: This is an example only and will not work without significant modification and additional files.
43+
// See the official documentation here for a full VM deployment: https://learn.microsoft.com/en-us/azure/virtual-machines/linux/quick-create-terraform
44+
// The VM creation terraform resource can be replaced with an equivalent resource GCP, AWS, VMWare, etc that's compatible with Delphix Continuous Data.
45+
// Consult your organization's DevOps expert for guidance on how to provision a VM that's approved for your company.
46+
resource "azurerm_linux_virtual_machine" "azure_vm" {
47+
name = "Delphix Oracle Target"
48+
location = azurerm_resource_group.rg.location // Not provided
49+
resource_group_name = azurerm_resource_group.rg.name // Not provided
50+
network_interface_ids = [azurerm_network_interface.my_terraform_nic.id] // Not provided
51+
size = "Standard_DS1_v2"
52+
53+
os_disk {
54+
name = "myOsDisk"
55+
caching = "ReadWrite"
56+
storage_account_type = "Premium_LRS"
57+
}
58+
59+
source_image_reference {
60+
publisher = "Canonical"
61+
offer = "0001-com-ubuntu-server-jammy"
62+
sku = "22_04-lts-gen2"
63+
version = "latest"
64+
}
65+
66+
computer_name = local.vm-hostname
67+
admin_username = local.vm-username
68+
admin_password = local.vm-password // Not secure. Example only
69+
70+
boot_diagnostics {
71+
storage_account_uri = azurerm_storage_account.my_storage_account.primary_blob_endpoint // Not provided
72+
}
73+
}
74+
75+
// Add the Azure VM as a Delphix environment.
76+
resource "delphix_environment" "linux-oracle-target" {
77+
name = local.vm-hostname
78+
os_name = "UNIX"
79+
hostname = local.vm-hostname
80+
username = local.vm-username
81+
password = local.vm-password
82+
engine_id = 1
83+
toolkit_path = "/home/delphix_os/toolkit"
84+
description = "This is a unix target for the Oracle VDB."
85+
}
86+
87+
// Link and Sync the dSource and take a new snapshot
88+
// *** Requirement *** This is an Oracle dSource. Updates are likely required.
89+
resource "delphix_oracle_dsource" "full_oracle_dsource" {
90+
name = local.dsource-name
91+
source_value = local.source-db-name
92+
group_id = "4-GROUP-1"
93+
environment_user_id = "HOST_USER-1"
94+
log_sync_enabled = false
95+
rman_channels = 2
96+
files_per_set = 5
97+
check_logical = false
98+
encrypted_linking_enabled = false
99+
compressed_linking_enabled = true
100+
bandwidth_limit = 0
101+
number_of_connections = 1
102+
diagnose_no_logging_faults = true
103+
pre_provisioning_enabled = false
104+
link_now = true
105+
force_full_backup = false
106+
double_sync = false
107+
skip_space_check = false
108+
do_not_resume = false
109+
files_for_full_backup = []
110+
log_sync_mode = "UNDEFINED"
111+
log_sync_interval = 5
112+
make_current_account_owner = true
113+
}
114+
115+
116+
// Provision by Snapshot the 1 Oracle VDB on the newly created environment
117+
resource "delphix_vdb" "vdb_provision_loop" {
118+
name = local.vdb-name
119+
source_data_id = local.dsource-name
120+
environment_id = local.vm-hostname
121+
auto_select_repository = true
122+
}
File renamed without changes.

examples/simple-provision/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
delphix = {
44
source = "delphix-integrations/delphix"
5-
version = "3.1.0"
5+
version = ">=3.1.0"
66
}
77
}
88
}

examples/vdb/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
terraform {
22
required_providers {
33
delphix = {
4-
version = "1.0-beta"
4+
version = ">=3.3.2"
55
source = "delphix.com/dct/delphix"
66
}
77
}

examples/vdb/postgresql/bookmark/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ provider "delphix" {
1818
}
1919

2020
resource "delphix_vdb" "example" {
21-
bookmark_id = ""
21+
bookmark_id = "bookmark_name"
2222
name = "vdb_to_be_created"
2323
source_data_id = "dsource-name"
2424
vdb_restart = true

examples/vdb_group/main.tf

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,50 @@
11
/**
2-
* Summary: This template showcases the properties available when creating an app data dsource.
2+
* Summary: This template showcases a simple example to
3+
* 1) Set local VDB variables
4+
* 2) Provision 5 VDBs using a for_each loop
5+
* 3) Place the 5 VDBs into a single VDB Group using a for loop
36
*/
47

58
terraform {
69
required_providers {
710
delphix = {
8-
version = "VERSION"
11+
version = ">=3.3.2"
912
source = "delphix-integrations/delphix"
1013
}
1114
}
1215
}
1316

17+
// *** Requirement***: Update the key and host with valid credentials.
1418
provider "delphix" {
1519
tls_insecure_skip = true
1620
key = "1.XXXX"
1721
host = "HOSTNAME"
1822
}
1923

2024

25+
// Create variables for the VDBs.
26+
// *** Requirement***: Update the Snapshot ID with a valid Snapshot. The same snapshot can be reused.
2127
locals {
2228
vdbs = {
29+
"vdb1" = { snapshot_id = "6-ORACLE_DB_CONTAINER-7", name = "us1" },
30+
"vdb2" = { snapshot_id = "6-ORACLE_DB_CONTAINER-1", name = "us2" },
31+
"vdb3" = { snapshot_id = "6-ORACLE_DB_CONTAINER-5", name = "us3" },
2332
"vdb4" = { snapshot_id = "6-ORACLE_DB_CONTAINER-21", name = "us4" },
24-
"vdb5" = { snapshot_id = "6-ORACLE_DB_CONTAINER-23", name = "us5" },
25-
"vdb1" = { snapshot_id = "6-ORACLE_DB_CONTAINER-7", name = "us1" },
26-
"vdb2" = { snapshot_id = "6-ORACLE_DB_CONTAINER-1", name = "us2" },
27-
"vdb3" = { snapshot_id = "6-ORACLE_DB_CONTAINER-5", name = "us3" }
33+
"vdb5" = { snapshot_id = "6-ORACLE_DB_CONTAINER-23", name = "us5" }
2834
}
2935
}
3036

31-
resource "delphix_vdb" "example" {
37+
// Provision by Snapshot the 5 VDBs in a loop.
38+
// Instead of a for_each loop, you could optionally copy this resource 4 more times and replace the values directly.
39+
resource "delphix_vdb" "vdb_provision_loop" {
3240
for_each = try(local.vdbs, {})
3341
name = each.value.name
3442
source_data_id = each.value.snapshot_id
3543
auto_select_repository = true
3644

3745
}
38-
39-
#sort helps to maintain thr order of the vdbs to avoid erroneous drift
46+
// Place the 5 VDBs in a single VDB Group.
47+
// The sort() function helps to maintain the order of the vdbs to avoid erroneous drift.
4048
resource "delphix_vdb_group" "this" {
4149
name = "random"
4250
vdb_ids = sort(flatten([for vdb in delphix_vdb.example : vdb.id]))

0 commit comments

Comments
 (0)