From 02a452c5330a8162d50d967b7753a052bc7125bd Mon Sep 17 00:00:00 2001 From: Uddipaan <89963410+Uddipaan-Hazarika@users.noreply.github.com> Date: Tue, 16 May 2023 17:36:26 +0530 Subject: [PATCH 1/4] HUBS-1695 | Add example documentation for database specific VDB provision parameters. --- docs/guides/provider_guide.md | 5 + examples/jenkins-integration/Readme.md | 21 +++ examples/jenkins-integration/jenkinsfile | 175 ++++++++++++++++++++++ examples/vdb/hana/bookmark/main.tf | 140 +++++++++++++++++ examples/vdb/hana/snapshot/main.tf | 141 +++++++++++++++++ examples/vdb/hana/timestamp/main.tf | 142 ++++++++++++++++++ examples/vdb/mssql/bookmark/main.tf | 136 +++++++++++++++++ examples/vdb/mssql/snapshot/main.tf | 137 +++++++++++++++++ examples/vdb/mssql/timestamp/main.tf | 139 +++++++++++++++++ examples/vdb/oracle/bookmark/main.tf | 154 +++++++++++++++++++ examples/vdb/oracle/snapshot/main.tf | 156 +++++++++++++++++++ examples/vdb/oracle/timestamp/main.tf | 155 +++++++++++++++++++ examples/vdb/postgresql/bookmark/main.tf | 133 ++++++++++++++++ examples/vdb/postgresql/snapshot/main.tf | 134 +++++++++++++++++ examples/vdb/postgresql/timestamp/main.tf | 135 +++++++++++++++++ examples/vdb/sybase/bookmark/main.tf | 121 +++++++++++++++ examples/vdb/sybase/snapshot/main.tf | 123 +++++++++++++++ examples/vdb/sybase/timestamp/main.tf | 123 +++++++++++++++ 18 files changed, 2270 insertions(+) create mode 100644 docs/guides/provider_guide.md create mode 100644 examples/jenkins-integration/Readme.md create mode 100644 examples/jenkins-integration/jenkinsfile create mode 100644 examples/vdb/hana/bookmark/main.tf create mode 100644 examples/vdb/hana/snapshot/main.tf create mode 100644 examples/vdb/hana/timestamp/main.tf create mode 100644 examples/vdb/mssql/bookmark/main.tf create mode 100644 examples/vdb/mssql/snapshot/main.tf create mode 100644 examples/vdb/mssql/timestamp/main.tf create mode 100644 examples/vdb/oracle/bookmark/main.tf create mode 100644 examples/vdb/oracle/snapshot/main.tf create mode 100644 examples/vdb/oracle/timestamp/main.tf create mode 100644 examples/vdb/postgresql/bookmark/main.tf create mode 100644 examples/vdb/postgresql/snapshot/main.tf create mode 100644 examples/vdb/postgresql/timestamp/main.tf create mode 100644 examples/vdb/sybase/bookmark/main.tf create mode 100644 examples/vdb/sybase/snapshot/main.tf create mode 100644 examples/vdb/sybase/timestamp/main.tf diff --git a/docs/guides/provider_guide.md b/docs/guides/provider_guide.md new file mode 100644 index 0000000..4e1ef44 --- /dev/null +++ b/docs/guides/provider_guide.md @@ -0,0 +1,5 @@ +# Guide: Delphix Provider Guide + +## Delphix Provider Guide +[We have provided a handful of examples in our GitHub repository to help you get a jump start with our Delphix Provider.](https://github.com/delphix-integrations/terraform-provider-delphix/tree/main/examples) These examples range from Terraform resource templates, quick Terraform examples, and full Jenkins pipelines. We update this repository based on our implementation experience, so be sure to check back for updates! +If you have a suggested template, request, or modification, please submit it in our [GitHub Issues section.](https://github.com/delphix-integrations/terraform-provider-delphix) \ No newline at end of file diff --git a/examples/jenkins-integration/Readme.md b/examples/jenkins-integration/Readme.md new file mode 100644 index 0000000..7f55dee --- /dev/null +++ b/examples/jenkins-integration/Readme.md @@ -0,0 +1,21 @@ +### Summary +The Jenkinsfile presents a simple CI/CD scenario where it provisions a VDB, runs an automated test (like Selenium or JUnit) against that application & dataset, and then destroys the VDB. On testing failure, which will happen every time, a bookmark is created. This Jenksinfile leverages the DCT Terrafrom Provider and an API Curl command to show the full breadth of possibilites. All other steps are mocked out. + +### Simple Getting Stated +1) Create a Jenkinsfile Pipeline Job +2) Insert or reference the associated `Jenkinsfile` file. + - Note: This Jenkinsfile also references the Terraform files in the `../simple-provision` folder. Feel free to fork, update, and modify those. +3) Update the following values: + - DCT_HOSTNAME - Example: `10.134.0.1` + - DCT_API_KEY - Example: `2.abc...` + - [Manage this value through the Jenkins' Credentials plugin](https://docs.cloudbees.com/docs/cloudbees-ci/latest/cloud-secure-guide/injecting-secrets) + - In a pinch, update it directly. + - SOURCE_VDB - Example: `Oracle_QA` +4) Run Jenkins Job + +Note: I suggest you reduce the sleep timers in early testing scenarios . + + +### Known Issues +On VDB destroy, the underlying Bookmark's snapshot will be deleted and the Bookmark will become "dangling". +Instead, I recommend using an "Enable/Disable" command instead of "Provision/Destroy" or skip the destroy VDB on failure. \ No newline at end of file diff --git a/examples/jenkins-integration/jenkinsfile b/examples/jenkins-integration/jenkinsfile new file mode 100644 index 0000000..c237083 --- /dev/null +++ b/examples/jenkins-integration/jenkinsfile @@ -0,0 +1,175 @@ +pipeline { + agent any + + environment { + def provision_successful = false + def vdb_id = "" + def vdb_name = "" + def DCT_HOSTNAME = "" + def SOURCE_VDB = "" + test_error = 'false' + } + + stages { + + stage ('Build Application') { + steps { + echo ('Building...') + sleep (50) + } + } + + stage ('Stand Up Full Application') { + parallel { + stage ('Apply Application Install') { + steps{ + echo ('Provisioning Test App...') + sleep (30) + } + } + stage ('Create Database w/ Terraform') { + steps { + script { + echo ('Provisioning VDB...') + git branch: 'main', changelog: false, poll: false, url: 'https://github.com/nick-mathison/delphix-terraform-examples.git' + // sh ('ls -R') + sh ('terraform -chdir=simple-provision init') + withCredentials([string(credentialsId: 'DCT_API_KEY', variable: 'KEY')]) { + sh ('terraform -chdir=simple-provision apply -var="source_data_id_1=$SOURCE_VDB" -var="dct_hostname=$DCT_HOSTNAME" -var="dct_api_key=$KEY" -auto-approve') + } + vdb_id = sh(script: 'terraform -chdir=simple-provision output vdb_id_1', returnStdout: true) + vdb_id = vdb_id.replaceAll('\\"', "").trim() + vdb_name = sh(script: 'terraform -chdir=simple-provision output vdb_name_1', returnStdout: true) + echo ("vdb_id:" + vdb_id) + echo ("vdb_name:" + vdb_name) + provision_successful = true + } + } + } + } + } + + stage ('Combine') { + steps { + echo ('Combining...') + sleep (10) + } + } + + stage ('Run Tests') { + parallel { + stage ('UI') { + stages { + stage ('Run UI Tests') { + steps{ + echo ('UI Tests...') + sleep (150) + } + } + stage ('Send UI Test Results') { + steps{ + echo ('Send UI Test Results...') + sleep (5) + } + } + } + } + stage ('Unit') { + stages { + stage ('Run Unit Tests') { + steps { + script { + echo ('Unit Tests...') + sleep (70) + catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { + echo ('Identified 7 failing Unit Tests!') + test_error = 'true'; + sh "exit 1" + } + } + } + } + stage ('Send Unit Test Results') { + steps{ + echo ('Send Unit Test Results...') + sleep (6) + } + } + } + } + stage ('Integ.') { + stages { + stage ('Run Integration Tests') { + steps{ + echo ('UI Tests...') + sleep (130) + } + } + stage ('Send Integration Test Results') { + steps{ + echo ('Send Integration Test Results...') + sleep (4) + } + } + } + } + } + } + + stage ('Bookmark Database') { + when { + equals expected: 'true', actual: test_error + } + steps{ + script { + echo ('Bookmark VDB... ') + withCredentials([string(credentialsId: 'DCT_API_KEY', variable: 'KEY')]) { + sh """ + curl -X 'POST' -k \ + 'https://$DCT_HOSTNAME/v3/bookmarks' \ + -H 'accept: application/json' \ + -H 'Authorization: apk ${KEY}' \ + -H 'Content-Type: application/json' \ + -d '{ + "name": "JKNS-BOOKMARK-$BUILD_NUMBER", + "vdb_ids": [ + "${vdb_id}" + ], + "retain_forever": true, + "make_current_account_owner": true + }' + """ + } + } + } + } + + stage ('Destroy Full Application') { + parallel { + stage ('Destroy Application') { + steps { + script { + echo ('Destroying Application...') + sleep (30) + } + } + } + stage ('Destroy Database w/ Terraform') { + steps { + script { + if (provision_successful) { + sleep (60) + echo ('Destroying Test App and VDB...') + withCredentials([string(credentialsId: 'DCT_API_KEY', variable: 'KEY')]) { + sh ('terraform -chdir=simple-provision destroy -var="source_data_id_1=$SOURCE_VDB" -var="dct_hostname=$DCT_HOSTNAME" -var="dct_api_key=$KEY" -auto-approve') + } + } else { + echo ('No App or VDB to destroy...') + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/examples/vdb/hana/bookmark/main.tf b/examples/vdb/hana/bookmark/main.tf new file mode 100644 index 0000000..58c6cfc --- /dev/null +++ b/examples/vdb/hana/bookmark/main.tf @@ -0,0 +1,140 @@ +terraform { + required_providers { + delphix = { + version = "VERSION" + source = "delphix-integrations/delphix" + } + } +} + +provider "delphix" { + tls_insecure_skip = true + key = "1.XXXX" + host = "HOSTNAME" +} + +resource "delphix_vdb" "example" { + bookmark_id = "" + name = "vdb_to_be_created" + source_data_id = "dsource-name" + vdb_restart = true + environment_id = "env-name" + environment_user_id = "environment_user_name" + target_group_id = "group-123" + snapshot_policy_id = "test_snapshot_policy" + database_name = "dbname_to_be_created" + mount_point = "/var/mnt" + auto_select_repository = true + retention_policy_id = "test_retention_policy" + custom_env_files = ["/export/home/env_file_1"] + custom_env_vars = { + MY_ENV_VAR1 = "$HOME" + MY_ENV_VAR2 = "$CRS_HOME/after" + } + repository_id = "" + appdata_source_params = jsonencode({ + mountLocation = "/mnt/bkmrk" + configServices = [{ + "sTenantServicePort" = "indexserver:30049" + }, + { + "sTenantServicePort" = "xsengine:30052" + }] + tDatabaseName = "tfbkmrk" + tSystemUserName = "SYSTEM" + tSystemUserPassword ="Delphix_123" + }) + config_params jsonencode({ + processes = 150 + }) + appdata_config_params jsonencode({ + param = "value" + }) + additional_mount_points = [{ + shared_path = "/", + mount_path = "/work", + environment_id = "environment-123" + }] + make_current_account_owner = true + tags { + key = "key-1" + value = "value-1" + } + post_snapshot { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_snapshot { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_stop { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + configure_clone { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_refresh { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_stop { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_rollback { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_start { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_rollback { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_start { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_refresh { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } +} \ No newline at end of file diff --git a/examples/vdb/hana/snapshot/main.tf b/examples/vdb/hana/snapshot/main.tf new file mode 100644 index 0000000..3a6fffa --- /dev/null +++ b/examples/vdb/hana/snapshot/main.tf @@ -0,0 +1,141 @@ +terraform { + required_providers { + delphix = { + version = "VERSION" + source = "delphix-integrations/delphix" + } + } +} + +provider "delphix" { + tls_insecure_skip = true + key = "1.XXXX" + host = "HOSTNAME" +} + +resource "delphix_vdb" "example" { + snapshot_id = "snapshot-id" + name = "vdb_to_be_created" + engine_id = "1" + source_data_id = "dsource-name" + vdb_restart = true + environment_id = "env-name" + environment_user_id = "environment_user_name" + target_group_id = "group-123" + snapshot_policy_id = "test_snapshot_policy" + database_name = "dbname_to_be_created" + mount_point = "/var/mnt" + auto_select_repository = true + retention_policy_id = "test_retention_policy" + custom_env_files = ["/export/home/env_file_1"] + custom_env_vars = { + MY_ENV_VAR1 = "$HOME" + MY_ENV_VAR2 = "$CRS_HOME/after" + } + repository_id = "" + appdata_source_params = jsonencode({ + mountLocation = "/mnt/bkmrk" + configServices = [{ + "sTenantServicePort" = "indexserver:30049" + }, + { + "sTenantServicePort" = "xsengine:30052" + }] + tDatabaseName = "tfbkmrk" + tSystemUserName = "SYSTEM" + tSystemUserPassword ="Delphix_123" + }) + config_params jsonencode({ + processes = 150 + }) + appdata_config_params jsonencode({ + param = "value" + }) + additional_mount_points = [{ + shared_path = "/", + mount_path = "/work", + environment_id = "environment-123" + }] + make_current_account_owner = true + tags { + key = "key-1" + value = "value-1" + } + post_snapshot { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_snapshot { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_stop { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + configure_clone { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_refresh { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_stop { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_rollback { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_start { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_rollback { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_start { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_refresh { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } +} \ No newline at end of file diff --git a/examples/vdb/hana/timestamp/main.tf b/examples/vdb/hana/timestamp/main.tf new file mode 100644 index 0000000..e2af89e --- /dev/null +++ b/examples/vdb/hana/timestamp/main.tf @@ -0,0 +1,142 @@ +terraform { + required_providers { + delphix = { + version = "VERSION" + source = "delphix-integrations/delphix" + } + } +} + +provider "delphix" { + tls_insecure_skip = true + key = "1.XXXX" + host = "HOSTNAME" +} + +resource "delphix_vdb" "example" { + timestamp = "" + timestamp_in_database_timezone = "" + name = "vdb_to_be_created" + source_data_id = "dsource-name" + engine_id = "1" + vdb_restart = true + environment_id = "env-name" + environment_user_id = "environment_user_name" + target_group_id = "group-123" + snapshot_policy_id = "test_snapshot_policy" + database_name = "dbname_to_be_created" + mount_point = "/var/mnt" + auto_select_repository = true + retention_policy_id = "test_retention_policy" + custom_env_files = ["/export/home/env_file_1"] + custom_env_vars = { + MY_ENV_VAR1 = "$HOME" + MY_ENV_VAR2 = "$CRS_HOME/after" + } + repository_id = "" + appdata_source_params = jsonencode({ + mountLocation = "/mnt/bkmrk" + configServices = [{ + "sTenantServicePort" = "indexserver:30049" + }, + { + "sTenantServicePort" = "xsengine:30052" + }] + tDatabaseName = "tfbkmrk" + tSystemUserName = "SYSTEM" + tSystemUserPassword ="Delphix_123" + }) + config_params jsonencode({ + processes = 150 + }) + appdata_config_params jsonencode({ + param = "value" + }) + additional_mount_points = [{ + shared_path = "/", + mount_path = "/work", + environment_id = "environment-123" + }] + make_current_account_owner = true + tags { + key = "key-1" + value = "value-1" + } + post_snapshot { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_snapshot { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_stop { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + configure_clone { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_refresh { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_stop { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_rollback { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_start { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_rollback { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_start { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_refresh { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } +} \ No newline at end of file diff --git a/examples/vdb/mssql/bookmark/main.tf b/examples/vdb/mssql/bookmark/main.tf new file mode 100644 index 0000000..17c6200 --- /dev/null +++ b/examples/vdb/mssql/bookmark/main.tf @@ -0,0 +1,136 @@ +terraform { + required_providers { + delphix = { + version = "VERSION" + source = "delphix-integrations/delphix" + } + } +} + +provider "delphix" { + tls_insecure_skip = true + key = "1.XXXX" + host = "HOSTNAME" +} + +resource "delphix_vdb" "example" { + bookmark_id = "" + name = "vdb_to_be_created" + source_data_id = "dsource-name" + vdb_restart = true + environment_id = "env-name" + environment_user_id = "environment_user_name" + target_group_id = "group-123" + snapshot_policy_id = "test_snapshot_policy" + database_name = "dbname_to_be_created" + mount_point = "/var/mnt" + auto_select_repository = true + retention_policy_id = "test_retention_policy" + custom_env_files = ["/export/home/env_file_1"] + custom_env_vars = { + MY_ENV_VAR1 = "$HOME" + MY_ENV_VAR2 = "$CRS_HOME/after" + } + cdc_on_provision = true + repository_id = "" + recovery_model = "" + config_params jsonencode({ + processes = 150 + }) + make_current_account_owner = true + tags { + key = "key-1" + value = "value-1" + } + post_snapshot { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_script { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_snapshot { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_stop { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_start { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_rollback { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_start { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_refresh { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_script { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_refresh { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_stop { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + configure_clone { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_rollback { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } +} \ No newline at end of file diff --git a/examples/vdb/mssql/snapshot/main.tf b/examples/vdb/mssql/snapshot/main.tf new file mode 100644 index 0000000..770e4b0 --- /dev/null +++ b/examples/vdb/mssql/snapshot/main.tf @@ -0,0 +1,137 @@ +terraform { + required_providers { + delphix = { + version = "VERSION" + source = "delphix-integrations/delphix" + } + } +} + +provider "delphix" { + tls_insecure_skip = true + key = "1.XXXX" + host = "HOSTNAME" +} + +resource "delphix_vdb" "example" { + snapshot_id = "snapshot-id" + name = "vdb_to_be_created" + source_data_id = "dsource-name" + vdb_restart = true + environment_id = "env-name" + environment_user_id = "environment_user_name" + target_group_id = "group-123" + snapshot_policy_id = "test_snapshot_policy" + database_name = "dbname_to_be_created" + mount_point = "/var/mnt" + auto_select_repository = true + engine_id = "1" + retention_policy_id = "test_retention_policy" + custom_env_files = ["/export/home/env_file_1"] + custom_env_vars = { + MY_ENV_VAR1 = "$HOME" + MY_ENV_VAR2 = "$CRS_HOME/after" + } + cdc_on_provision = true + repository_id = "" + recovery_model = "" + config_params jsonencode({ + processes = 150 + }) + make_current_account_owner = true + tags { + key = "key-1" + value = "value-1" + } + post_snapshot { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_script { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_snapshot { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_stop { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_start { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_rollback { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_start { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_refresh { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_script { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_refresh { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_stop { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + configure_clone { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_rollback { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } +} \ No newline at end of file diff --git a/examples/vdb/mssql/timestamp/main.tf b/examples/vdb/mssql/timestamp/main.tf new file mode 100644 index 0000000..a8181f3 --- /dev/null +++ b/examples/vdb/mssql/timestamp/main.tf @@ -0,0 +1,139 @@ +terraform { + required_providers { + delphix = { + version = "VERSION" + source = "delphix-integrations/delphix" + } + } +} + +provider "delphix" { + tls_insecure_skip = true + key = "1.XXXX" + host = "HOSTNAME" +} + +resource "delphix_vdb" "example" { + timestamp = "" + timestamp_in_database_timezone = "" + name = "vdb_to_be_created" + source_data_id = "dsource-name" + vdb_restart = true + environment_id = "env-name" + environment_user_id = "environment_user_name" + target_group_id = "group-123" + snapshot_policy_id = "test_snapshot_policy" + database_name = "dbname_to_be_created" + mount_point = "/var/mnt" + auto_select_repository = true + engine_id = "1" + retention_policy_id = "test_retention_policy" + custom_env_files = ["/export/home/env_file_1"] + custom_env_vars = { + MY_ENV_VAR1 = "$HOME" + MY_ENV_VAR2 = "$CRS_HOME/after" + } + recovery_model = "" + cdc_on_provision = true + repository_id = "" + + config_params jsonencode({ + processes = 150 + }) + make_current_account_owner = true + tags { + key = "key-1" + value = "value-1" + } + post_snapshot { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_script { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_snapshot { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_stop { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_start { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_rollback { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_start { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_refresh { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_script { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_refresh { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_stop { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + configure_clone { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_rollback { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } +} \ No newline at end of file diff --git a/examples/vdb/oracle/bookmark/main.tf b/examples/vdb/oracle/bookmark/main.tf new file mode 100644 index 0000000..0c8d733 --- /dev/null +++ b/examples/vdb/oracle/bookmark/main.tf @@ -0,0 +1,154 @@ +terraform { + required_providers { + delphix = { + version = "VERSION" + source = "delphix-integrations/delphix" + } + } +} + +provider "delphix" { + tls_insecure_skip = true + key = "1.XXXX" + host = "HOSTNAME" +} + +resource "delphix_vdb" "example" { + bookmark_id = "" + name = "vdb_to_be_created" + source_data_id = "dsource-name" + os_username = "os-user-x" + os_password = "os-password-x" + vdb_restart = true + environment_id = "oracle-env-name" + environment_user_id = "environment_user_name" + target_group_id = "group-123" + open_reset_logs = true + archive_log = true + online_log_groups = 2 + snapshot_policy_id = "test_snapshot_policy" + unique_name = "dbdhcp2" + online_log_size = 4 + database_name = "dbname_to_be_created" + mount_point = "/var/mnt" + auto_select_repository = true + custom_env_files = ["/export/home/env_file_1"] + custom_env_vars = { + MY_ENV_VAR1 = "$ORACLE_HOME" + MY_ENV_VAR2 = "$CRS_HOME/after" + } + file_mapping_rules = "/datafile/dbdhcp3/oradata/dbdhcp3:/data\n/u03/app/ora11202/product/11.2.0/dbhome_1/dbs/dbv_R2V4.dbf:/data/dbv_R2V4.dbf" + new_dbid = true + cluster_node_ids = ["ORACLE_CLUSTER_NODE-ID"] + auxiliary_template_id = "aux-template-1" + oracle_instance_name = "dbdhcp2" + retention_policy_id = "test_retention_policy" + template_id = "template-1" + repository_id = "" + listener_ids = ["id1","id2"] + cdb_id = "" + vcdb_name = "" //(MT) + vcdb_database_name = "" //(MT) + target_vcdb_tde_keystore_path = "" //(MT) + parent_tde_keystore_password = "" //(MT) + cdb_tde_keystore_password = "" //(MT) + tde_key_identifier = "" //(MT) + vcdb_tde_key_identifier = "" //(MT) + parent_tde_keystore_path = "" //(MT) + tde_exported_key_file_secret = "" //(MT) + oracle_rac_custom_env_vars = [{ + node_id = "ORACLE_CLUSTER_NODE-1", + name = "MY_ENV_VAR1", + value = "$CRS_HOME/after" + }] //(RAC) + oracle_rac_custom_env_files = [ + { + node_id = "ORACLE_CLUSTER_NODE-1", + path_parameters = "/export/home/env_file_1" + }] //(RAC) + config_params jsonencode({ + processes = 150 + }) + tags { + key = "key-1" + value = "value-1" + } + make_current_account_owner = true + pre_start { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_rollback { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_start { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_rollback { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_stop { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + configure_clone { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_snapshot { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_refresh { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_refresh { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_stop { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_snapshot { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } +} \ No newline at end of file diff --git a/examples/vdb/oracle/snapshot/main.tf b/examples/vdb/oracle/snapshot/main.tf new file mode 100644 index 0000000..da710a6 --- /dev/null +++ b/examples/vdb/oracle/snapshot/main.tf @@ -0,0 +1,156 @@ +terraform { + required_providers { + delphix = { + version = "VERSION" + source = "delphix-integrations/delphix" + } + } +} + +provider "delphix" { + tls_insecure_skip = true + key = "1.XXXX" + host = "HOSTNAME" +} + +resource "delphix_vdb" "example" { + snapshot_id = "1-oracle-snapshot-id" + name = "vdb_to_be_created" + source_data_id = "dsource-name" + engine_id = "1" + os_username = "os-user-x" + os_password = "os-password-x" + vdb_restart = true + environment_id = "oracle-env-name" + environment_user_id = "environment_user_name" + target_group_id = "group-123" + auto_select_repository = true + open_reset_logs = true + archive_log = true + online_log_groups = 2 + snapshot_policy_id = "test_snapshot_policy" + unique_name = "dbdhcp2" + online_log_size = 4 + custom_env_files = ["/export/home/env_file_1"] + custom_env_vars = { + MY_ENV_VAR1 = "$ORACLE_HOME" + MY_ENV_VAR2 = "$CRS_HOME/after" + } + file_mapping_rules = "/datafile/dbdhcp3/oradata/dbdhcp3:/data\n/u03/app/ora11202/product/11.2.0/dbhome_1/dbs/dbv_R2V4.dbf:/data/dbv_R2V4.dbf" + new_dbid = true + cluster_node_ids = ["ORACLE_CLUSTER_NODE-ID"] + auxiliary_template_id = "aux-template-1" + database_name = "dbname_to_be_created" + mount_point = "/var/mnt" + oracle_instance_name = "dbdhcp2" + retention_policy_id = "test_retention_policy" + template_id = "template-1" + cdb_id = "" + listener_ids = ["id"] + repository_id = " " + vcdb_name = "" //(MT) + vcdb_database_name = "" //(MT) + target_vcdb_tde_keystore_path = "" //(MT) + parent_tde_keystore_password = "" //(MT) + cdb_tde_keystore_password = "" //(MT) + tde_key_identifier = "" //(MT) + vcdb_tde_key_identifier = "" //(MT) + parentTdeKeystorePath = "" //(MT) + tde_exported_key_file_secret = "" //(MT) + oracle_rac_custom_env_vars = [{ + node_id = "ORACLE_CLUSTER_NODE-1", + name = "MY_ENV_VAR1", + value = "$CRS_HOME/after" + }] //(RAC) + oracle_rac_custom_env_files = [ + { + node_id = "ORACLE_CLUSTER_NODE-1", + path_parameters = "/export/home/env_file_1" + }] //(RAC) + + config_params jsonencode({ + processes = 150 + }) + tags { + key = "key-1" + value = "value-1" + } + make_current_account_owner = true + pre_start { + name = "string", + command = "string", + shell = "bash", + element_id = "string", + has_credentials = true + } + pre_rollback { + name = "string", + command = "string", + shell = "bash", + element_id = "string", + has_credentials = true + } + post_start { + name = "string", + command = "string", + shell = "bash", + element_id = "string", + has_credentials = true + } + post_rollback { + name = "string", + command = "string", + shell = "bash", + element_id = "string", + has_credentials = true + } + pre_stop { + name = "string", + command = "string", + shell = "bash", + element_id = "string", + has_credentials = true + } + configure_clone { + name = "string", + command = "string", + shell = "bash", + element_id = "string", + has_credentials = true + } + post_snapshot { + name = "string", + command = "string", + shell = "bash", + element_id = "string", + has_credentials = true + } + pre_refresh { + name = "string", + command = "string", + shell = "bash", + element_id = "string", + has_credentials = true + } + post_refresh { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_stop { + name = "string", + command = "string", + shell = "bash", + element_id = "string", + has_credentials = true + } + pre_snapshot { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } +} \ No newline at end of file diff --git a/examples/vdb/oracle/timestamp/main.tf b/examples/vdb/oracle/timestamp/main.tf new file mode 100644 index 0000000..540f225 --- /dev/null +++ b/examples/vdb/oracle/timestamp/main.tf @@ -0,0 +1,155 @@ +terraform { + required_providers { + delphix = { + version = "VERSION" + source = "delphix-integrations/delphix" + } + } +} + +provider "delphix" { + tls_insecure_skip = true + key = "1.XXXX" + host = "HOSTNAME" +} + +resource "delphix_vdb" "example" { + timestamp = "" + timestamp_in_database_timezone = "" + name = "vdb_to_be_created" + source_data_id = "dsource-name" + engine_id = "1" + os_username = "os-user-x" + os_password = "os-password-x" + vdb_restart = true + environment_id = "oracle-env-name" + environment_user_id = "environment_user_name" + database_name = "dbname_to_be_created" + mount_point = "/var/mnt" + auto_select_repository = true + target_group_id = "group-123" + open_reset_logs = true + archive_log = true + online_log_groups = 2 + snapshot_policy_id = "test_snapshot_policy" + unique_name = "dbdhcp2" + online_log_size = 4 + custom_env_files = ["/export/home/env_file_1"] + custom_env_vars = { + MY_ENV_VAR1 = "$ORACLE_HOME" + MY_ENV_VAR2 = "$CRS_HOME/after" + } + file_mapping_rules = "/datafile/dbdhcp3/oradata/dbdhcp3:/data\n/u03/app/ora11202/product/11.2.0/dbhome_1/dbs/dbv_R2V4.dbf:/data/dbv_R2V4.dbf" + new_dbid = true + auxiliary_template_id = "aux-template-1" + oracle_instance_name = "dbdhcp2" + retention_policy_id = "test_retention_policy" + template_id = "template-1" + listener_ids = ["id"] + repository_id = "" + cdb_id = "" + vcdb_name = "" //(MT) + vcdb_database_name = "" //(MT) + target_vcdb_tde_keystore_path = "" //(MT) + parent_tde_keystore_password = "" //(MT) + cdb_tde_keystore_password = "" //(MT) + tde_key_identifier = "" //(MT) + vcdb_tde_key_identifier = "" //(MT) + parentTdeKeystorePath = "" //(MT) + tde_exported_key_file_secret = "" //(MT) + oracle_rac_custom_env_vars = [{ + node_id = "ORACLE_CLUSTER_NODE-1", + name = "MY_ENV_VAR1", + value = "$CRS_HOME/after" + }] //(RAC) + oracle_rac_custom_env_files = [ + { + node_id = "ORACLE_CLUSTER_NODE-1", + path_parameters = "/export/home/env_file_1" + }] //(RAC) + config_params jsonencode({ + processes = 150 + }) + tags { + key = "key-1" + value = "value-1" + } + make_current_account_owner = true + pre_start { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_rollback { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_start { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_rollback { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_stop { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + configure_clone { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_snapshot { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_refresh { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_refresh { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_stop { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_snapshot { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } +} \ No newline at end of file diff --git a/examples/vdb/postgresql/bookmark/main.tf b/examples/vdb/postgresql/bookmark/main.tf new file mode 100644 index 0000000..050ae65 --- /dev/null +++ b/examples/vdb/postgresql/bookmark/main.tf @@ -0,0 +1,133 @@ +terraform { + required_providers { + delphix = { + version = "VERSION" + source = "delphix-integrations/delphix" + } + } +} + +provider "delphix" { + tls_insecure_skip = true + key = "1.XXXX" + host = "HOSTNAME" +} + +resource "delphix_vdb" "example" { + bookmark_id = "" + name = "vdb_to_be_created" + source_data_id = "dsource-name" + vdb_restart = true + environment_id = "env-name" + environment_user_id = "environment_user_name" + target_group_id = "group-123" + snapshot_policy_id = "test_snapshot_policy" + database_name = "dbname_to_be_created" + mount_point = "/var/mnt" + auto_select_repository = true + retention_policy_id = "test_retention_policy" + custom_env_files = ["/export/home/env_file_1"] + custom_env_vars = { + MY_ENV_VAR1 = "$HOME" + MY_ENV_VAR2 = "$CRS_HOME/after" + } + repository_id = "" + appdata_source_params = jsonencode({ + mountLocation = "/mnt/GAT" + postgresPort = 5434 + configSettingsStg = [{ propertyName: "timezone", value:"GMT", commentProperty:false}] + }) + config_params jsonencode({ + processes = 150 + }) + appdata_config_params jsonencode({ + param = "value" + }) + additional_mount_points = [{ + shared_path = "/", + mount_path = "/work", + environment_id = "environment-123" + }] + make_current_account_owner = true + tags { + key = "key-1" + value = "value-1" + } + post_snapshot { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_snapshot { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_stop { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + configure_clone { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_refresh { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_stop { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_rollback { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_start { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_rollback { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_start { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_refresh { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } +} \ No newline at end of file diff --git a/examples/vdb/postgresql/snapshot/main.tf b/examples/vdb/postgresql/snapshot/main.tf new file mode 100644 index 0000000..7b06d82 --- /dev/null +++ b/examples/vdb/postgresql/snapshot/main.tf @@ -0,0 +1,134 @@ +terraform { + required_providers { + delphix = { + version = "VERSION" + source = "delphix-integrations/delphix" + } + } +} + +provider "delphix" { + tls_insecure_skip = true + key = "1.XXXX" + host = "HOSTNAME" +} + +resource "delphix_vdb" "example" { + snapshot_id = "snapshot-id" + name = "vdb_to_be_created" + source_data_id = "dsource-name" + engine_id = "1" + vdb_restart = true + environment_id = "env-name" + environment_user_id = "environment_user_name" + target_group_id = "group-123" + snapshot_policy_id = "test_snapshot_policy" + database_name = "dbname_to_be_created" + mount_point = "/var/mnt" + auto_select_repository = true + retention_policy_id = "test_retention_policy" + custom_env_files = ["/export/home/env_file_1"] + custom_env_vars = { + MY_ENV_VAR1 = "$HOME" + MY_ENV_VAR2 = "$CRS_HOME/after" + } + repository_id = "" + appdata_source_params = jsonencode({ + mountLocation = "/mnt/GAT" + postgresPort = 5434 + configSettingsStg = [{ propertyName: "timezone", value:"GMT", commentProperty:false}] + }) + config_params jsonencode({ + processes = 150 + }) + appdata_config_params jsonencode({ + param = "value" + }) + additional_mount_points = [{ + shared_path = "/", + mount_path = "/work", + environment_id = "environment-123" + }] + make_current_account_owner = true + tags { + key = "key-1" + value = "value-1" + } + post_snapshot { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_snapshot { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_stop { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + configure_clone { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_refresh { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_stop { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_rollback { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_start { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_rollback { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_start { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_refresh { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } +} \ No newline at end of file diff --git a/examples/vdb/postgresql/timestamp/main.tf b/examples/vdb/postgresql/timestamp/main.tf new file mode 100644 index 0000000..0f133c7 --- /dev/null +++ b/examples/vdb/postgresql/timestamp/main.tf @@ -0,0 +1,135 @@ +terraform { + required_providers { + delphix = { + version = "VERSION" + source = "delphix-integrations/delphix" + } + } +} + +provider "delphix" { + tls_insecure_skip = true + key = "1.XXXX" + host = "HOSTNAME" +} + +resource "delphix_vdb" "example" { + timestamp = "" + timestamp_in_database_timezone = "" + name = "vdb_to_be_created" + source_data_id = "dsource-name" + engine_id = "1" + vdb_restart = true + environment_id = "env-name" + environment_user_id = "environment_user_name" + target_group_id = "group-123" + snapshot_policy_id = "test_snapshot_policy" + database_name = "dbname_to_be_created" + mount_point = "/var/mnt" + auto_select_repository = true + retention_policy_id = "test_retention_policy" + custom_env_files = ["/export/home/env_file_1"] + custom_env_vars = { + MY_ENV_VAR1 = "$HOME" + MY_ENV_VAR2 = "$CRS_HOME/after" + } + repository_id = "" + appdata_source_params = jsonencode({ + mountLocation = "/mnt/GAT" + postgresPort = 5434 + configSettingsStg = [{ propertyName: "timezone", value:"GMT", commentProperty:false}] + }) + config_params jsonencode({ + processes = 150 + }) + appdata_config_params jsonencode({ + param = "value" + }) + additional_mount_points = [{ + shared_path = "/", + mount_path = "/work", + environment_id = "environment-123" + }] + make_current_account_owner = true + tags { + key = "key-1" + value = "value-1" + } + post_snapshot { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_snapshot { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_stop { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + configure_clone { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_refresh { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_stop { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_rollback { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_start { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_rollback { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_start { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_refresh { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } +} \ No newline at end of file diff --git a/examples/vdb/sybase/bookmark/main.tf b/examples/vdb/sybase/bookmark/main.tf new file mode 100644 index 0000000..bdbd7c7 --- /dev/null +++ b/examples/vdb/sybase/bookmark/main.tf @@ -0,0 +1,121 @@ +terraform { + required_providers { + delphix = { + version = "VERSION" + source = "delphix-integrations/delphix" + } + } +} + +provider "delphix" { + tls_insecure_skip = true + key = "1.XXXX" + host = "HOSTNAME" +} + +resource "delphix_vdb" "example" { + bookmark_id = "" + name = "vdb_to_be_created" + source_data_id = "dsource-name" + vdb_restart = true + environment_id = "env-name" + environment_user_id = "environment_user_name" + target_group_id = "group-123" + snapshot_policy_id = "test_snapshot_policy" + database_name = "dbname_to_be_created" + mount_point = "/var/mnt" + auto_select_repository = true + retention_policy_id = "test_retention_policy" + custom_env_files = ["/export/home/env_file_1"] + custom_env_vars = { + MY_ENV_VAR1 = "$HOME" + MY_ENV_VAR2 = "$CRS_HOME/after" + } + truncate_log_on_checkpoint = true + repository_id = "" + config_params jsonencode({ + processes = 150 + }) + make_current_account_owner = true + tags { + key = "key-1" + value = "value-1" + } + pre_snapshot [{ + name = "string", + command = "string", + shell = "bash", + element_id = "string", + has_credentials = true + }] + pre_stop [{ + name = "string", + command = "string", + shell = "bash", + element_id = "string", + has_credentials = true + }] + pre_refresh [{ + name = "string", + command = "string", + shell = "bash", + element_id = "string", + has_credentials = true + }] + post_start [{ + name = "string", + command = "string", + shell = "bash", + element_id = "string", + has_credentials = true + }] + post_snapshot [{ + name = "string", + command = "string", + shell = "bash", + element_id = "string", + has_credentials = true + }] + post_refresh [{ + name = "string", + command = "string", + shell = "bash", + element_id = "string", + has_credentials = true + }] + post_stop [{ + name = "string", + command = "string", + shell = "bash", + element_id = "string", + has_credentials = true + }] + post_rollback [{ + name = "string", + command = "string", + shell = "bash", + element_id = "string", + has_credentials = true + }] + pre_rollback [{ + name = "string", + command = "string", + shell = "bash", + element_id = "string", + has_credentials = true + }] + pre_start [{ + name = "string", + command = "string", + shell = "bash", + element_id = "string", + has_credentials = true + }] + configure_clone [{ + name = "string", + command = "string", + shell = "bash", + element_id = "string", + has_credentials = true + }] +} \ No newline at end of file diff --git a/examples/vdb/sybase/snapshot/main.tf b/examples/vdb/sybase/snapshot/main.tf new file mode 100644 index 0000000..95e355e --- /dev/null +++ b/examples/vdb/sybase/snapshot/main.tf @@ -0,0 +1,123 @@ +terraform { + required_providers { + delphix = { + version = "VERSION" + source = "delphix-integrations/delphix" + } + } +} + +provider "delphix" { + tls_insecure_skip = true + key = "1.XXXX" + host = "HOSTNAME" +} + +resource "delphix_vdb" "example" { + snapshot_id = "snapshot-id" + name = "vdb_to_be_created" + source_data_id = "dsource-name" + vdb_restart = true + environment_id = "env-name" + environment_user_id = "environment_user_name" + target_group_id = "group-123" + snapshot_policy_id = "test_snapshot_policy" + database_name = "dbname_to_be_created" + mount_point = "/var/mnt" + auto_select_repository = true + engine_id = "1" + retention_policy_id = "test_retention_policy" + custom_env_files = ["/export/home/env_file_1"] + custom_env_vars = { + MY_ENV_VAR1 = "$HOME" + MY_ENV_VAR2 = "$CRS_HOME/after" + } + repository_id = "" + truncate_log_on_checkpoint = true + config_params jsonencode({ + processes = 150 + }) + make_current_account_owner = true + tags { + key = "key-1" + value = "value-1" + } + pre_snapshot { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_stop { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_refresh { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_start { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_snapshot { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_refresh { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_stop { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_rollback { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_rollback { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_start { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + configure_clone { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + +} \ No newline at end of file diff --git a/examples/vdb/sybase/timestamp/main.tf b/examples/vdb/sybase/timestamp/main.tf new file mode 100644 index 0000000..dc53b4b --- /dev/null +++ b/examples/vdb/sybase/timestamp/main.tf @@ -0,0 +1,123 @@ +terraform { + required_providers { + delphix = { + version = "VERSION" + source = "delphix-integrations/delphix" + } + } +} + +provider "delphix" { + tls_insecure_skip = true + key = "1.XXXX" + host = "HOSTNAME" +} + +resource "delphix_vdb" "example" { + timestamp = "" + timestamp_in_database_timezone = "" + name = "vdb_to_be_created" + source_data_id = "dsource-name" + engine_id = "1" + vdb_restart = true + environment_id = "env-name" + environment_user_id = "environment_user_name" + target_group_id = "group-123" + snapshot_policy_id = "test_snapshot_policy" + database_name = "dbname_to_be_created" + mount_point = "/var/mnt" + auto_select_repository = true + retention_policy_id = "test_retention_policy" + custom_env_files = ["/export/home/env_file_1"] + custom_env_vars = { + MY_ENV_VAR1 = "$HOME" + MY_ENV_VAR2 = "$CRS_HOME/after" + } + truncate_log_on_checkpoint = true + repository_id = "" + config_params jsonencode({ + processes = 150 + }) + make_current_account_owner = true + tags { + key = "key-1" + value = "value-1" + } + pre_snapshot { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_stop { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_refresh { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_start { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_snapshot { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_refresh { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_stop { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + post_rollback { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_rollback { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + pre_start { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } + configure_clone { + name = "string" + command = "string" + shell = "bash" + element_id = "string" + has_credentials = true + } +} \ No newline at end of file From e154b846f07bf7a6f8849690d8bbd6ca1797997e Mon Sep 17 00:00:00 2001 From: Uddipaan <89963410+Uddipaan-Hazarika@users.noreply.github.com> Date: Tue, 16 May 2023 22:48:41 +0530 Subject: [PATCH 2/4] addressing review comments for HUBS-1695 --- docs/guides/provider_guide.md | 3 +- examples/jenkins-integration/jenkinsfile | 12 ++--- examples/simple-provision/README.md | 28 +++++++++++ examples/simple-provision/main.tf | 21 ++++++++ examples/simple-provision/outputs.tf | 0 examples/simple-provision/variables.tf | 13 +++++ examples/simple-provision/versions.tf | 8 ++++ examples/vdb/hana/bookmark/main.tf | 14 ++++-- examples/vdb/hana/snapshot/main.tf | 15 ++++-- examples/vdb/hana/timestamp/main.tf | 14 ++++-- examples/vdb/mssql/bookmark/main.tf | 14 ++++-- examples/vdb/mssql/snapshot/main.tf | 15 ++++-- examples/vdb/mssql/timestamp/main.tf | 14 ++++-- examples/vdb/oracle/bookmark/main.tf | 14 ++++-- examples/vdb/oracle/snapshot/main.tf | 16 ++++--- examples/vdb/oracle/timestamp/main.tf | 14 ++++-- examples/vdb/postgresql/bookmark/main.tf | 15 ++++-- examples/vdb/postgresql/snapshot/main.tf | 15 ++++-- examples/vdb/postgresql/timestamp/main.tf | 14 ++++-- examples/vdb/sybase/bookmark/main.tf | 58 ++++++++++++----------- examples/vdb/sybase/snapshot/main.tf | 15 +++--- examples/vdb/sybase/timestamp/main.tf | 14 ++++-- 22 files changed, 240 insertions(+), 106 deletions(-) create mode 100644 examples/simple-provision/README.md create mode 100644 examples/simple-provision/main.tf create mode 100644 examples/simple-provision/outputs.tf create mode 100644 examples/simple-provision/variables.tf create mode 100644 examples/simple-provision/versions.tf diff --git a/docs/guides/provider_guide.md b/docs/guides/provider_guide.md index 4e1ef44..783cab5 100644 --- a/docs/guides/provider_guide.md +++ b/docs/guides/provider_guide.md @@ -2,4 +2,5 @@ ## Delphix Provider Guide [We have provided a handful of examples in our GitHub repository to help you get a jump start with our Delphix Provider.](https://github.com/delphix-integrations/terraform-provider-delphix/tree/main/examples) These examples range from Terraform resource templates, quick Terraform examples, and full Jenkins pipelines. We update this repository based on our implementation experience, so be sure to check back for updates! -If you have a suggested template, request, or modification, please submit it in our [GitHub Issues section.](https://github.com/delphix-integrations/terraform-provider-delphix) \ No newline at end of file + +If you have a suggested template, request, or modification, please submit it in our [GitHub Issues section.](https://github.com/delphix-integrations/terraform-provider-delphix) diff --git a/examples/jenkins-integration/jenkinsfile b/examples/jenkins-integration/jenkinsfile index c237083..930d12d 100644 --- a/examples/jenkins-integration/jenkinsfile +++ b/examples/jenkins-integration/jenkinsfile @@ -31,15 +31,15 @@ pipeline { steps { script { echo ('Provisioning VDB...') - git branch: 'main', changelog: false, poll: false, url: 'https://github.com/nick-mathison/delphix-terraform-examples.git' + git branch: 'main', changelog: false, poll: false, url: 'https://github.com/delphix-integrations/terraform-provider-delphix.git' // sh ('ls -R') - sh ('terraform -chdir=simple-provision init') + sh ('terraform -chdir=examples/simple-provision init') withCredentials([string(credentialsId: 'DCT_API_KEY', variable: 'KEY')]) { - sh ('terraform -chdir=simple-provision apply -var="source_data_id_1=$SOURCE_VDB" -var="dct_hostname=$DCT_HOSTNAME" -var="dct_api_key=$KEY" -auto-approve') + sh ('terraform -chdir=examples/simple-provision apply -var="source_data_id_1=$SOURCE_VDB" -var="dct_hostname=$DCT_HOSTNAME" -var="dct_api_key=$KEY" -auto-approve') } - vdb_id = sh(script: 'terraform -chdir=simple-provision output vdb_id_1', returnStdout: true) + vdb_id = sh(script: 'terraform -chdir=examples/simple-provision output vdb_id_1', returnStdout: true) vdb_id = vdb_id.replaceAll('\\"', "").trim() - vdb_name = sh(script: 'terraform -chdir=simple-provision output vdb_name_1', returnStdout: true) + vdb_name = sh(script: 'terraform -chdir=examples/simple-provision output vdb_name_1', returnStdout: true) echo ("vdb_id:" + vdb_id) echo ("vdb_name:" + vdb_name) provision_successful = true @@ -161,7 +161,7 @@ pipeline { sleep (60) echo ('Destroying Test App and VDB...') withCredentials([string(credentialsId: 'DCT_API_KEY', variable: 'KEY')]) { - sh ('terraform -chdir=simple-provision destroy -var="source_data_id_1=$SOURCE_VDB" -var="dct_hostname=$DCT_HOSTNAME" -var="dct_api_key=$KEY" -auto-approve') + sh ('terraform -chdir=examples/simple-provision destroy -var="source_data_id_1=$SOURCE_VDB" -var="dct_hostname=$DCT_HOSTNAME" -var="dct_api_key=$KEY" -auto-approve') } } else { echo ('No App or VDB to destroy...') diff --git a/examples/simple-provision/README.md b/examples/simple-provision/README.md new file mode 100644 index 0000000..01cda7f --- /dev/null +++ b/examples/simple-provision/README.md @@ -0,0 +1,28 @@ + +### Simple Getting Stated + +1) Update the dct_hostname and dct_api_key variables in the `variables.tf` or in Terrafrom Cloud with the DCT Server and API Key. +For example: +- DCT: uv123abcfei59h6qajyy.vm.cld.sr +- API Key: 2.ZAAgpjHxljW7A7g... + +2) Update `Oracle_QA` with an applicable VDB name and run the following commands. +``` +# Create all resources +terraform apply -var="source_data_id_1=Oracle_QA" + +# Destroy resources +terraform destroy" +``` + + +### Troubleshoot: Invalid Resource State + +If you find that you've lost the sync between DCT and Terraform, use the `terraform state rm` command to help reconfigure without starting over. +``` +terraform state rm delphix_vdb.provision_vdb_1 + +terraform state rm delphix_vdb_group.create_vdb_group +``` + +[Documentation](https://developer.hashicorp.com/terraform/cli/commands/state/rm) diff --git a/examples/simple-provision/main.tf b/examples/simple-provision/main.tf new file mode 100644 index 0000000..431f1ff --- /dev/null +++ b/examples/simple-provision/main.tf @@ -0,0 +1,21 @@ +# Configure the connection to Data Control Tower +provider "delphix" { + host = var.dct_hostname + key = var.dct_api_key + tls_insecure_skip = true +} + +# Provision a VDB 1 +resource "delphix_vdb" "provision_vdb_1" { + name = "tfmtest1" + source_data_id = var.source_data_id_1 + auto_select_repository = true +} + +# Create a VDB Group with VDB 1 +resource "delphix_vdb_group" "create_vdb_group" { + name = "Terraform Demo Group" + vdb_ids = [ + delphix_vdb.provision_vdb_1.id + ] +} \ No newline at end of file diff --git a/examples/simple-provision/outputs.tf b/examples/simple-provision/outputs.tf new file mode 100644 index 0000000..e69de29 diff --git a/examples/simple-provision/variables.tf b/examples/simple-provision/variables.tf new file mode 100644 index 0000000..a2535e0 --- /dev/null +++ b/examples/simple-provision/variables.tf @@ -0,0 +1,13 @@ +variable "dct_hostname" { + type = string + description = "dct hostname config file [default: workspace variable set]" +} + +variable "dct_api_key" { + type = string + description = "dct api key config file [default: workspace variable set]" +} + +variable "source_data_id_1" { + description = "Name or ID of the VDB or Data Source to provision from. [User Defined]" +} \ No newline at end of file diff --git a/examples/simple-provision/versions.tf b/examples/simple-provision/versions.tf new file mode 100644 index 0000000..46085a0 --- /dev/null +++ b/examples/simple-provision/versions.tf @@ -0,0 +1,8 @@ +terraform { + required_providers { + delphix = { + source = "delphix-integrations/delphix" + version = "1.0.0" + } + } +} \ No newline at end of file diff --git a/examples/vdb/hana/bookmark/main.tf b/examples/vdb/hana/bookmark/main.tf index 58c6cfc..1b4d4b4 100644 --- a/examples/vdb/hana/bookmark/main.tf +++ b/examples/vdb/hana/bookmark/main.tf @@ -1,3 +1,7 @@ +/** +* Summary: This template showcases the properties available when provisioning a SAP Hana database from a DCT bookmark. +*/ + terraform { required_providers { delphix = { @@ -55,11 +59,6 @@ resource "delphix_vdb" "example" { mount_path = "/work", environment_id = "environment-123" }] - make_current_account_owner = true - tags { - key = "key-1" - value = "value-1" - } post_snapshot { name = "string" command = "string" @@ -137,4 +136,9 @@ resource "delphix_vdb" "example" { element_id = "string" has_credentials = true } + make_current_account_owner = true + tags { + key = "key-1" + value = "value-1" + } } \ No newline at end of file diff --git a/examples/vdb/hana/snapshot/main.tf b/examples/vdb/hana/snapshot/main.tf index 3a6fffa..fd6305a 100644 --- a/examples/vdb/hana/snapshot/main.tf +++ b/examples/vdb/hana/snapshot/main.tf @@ -1,3 +1,7 @@ +/** +* Summary: This template showcases the properties available when provisioning a SAP Hana database from a DCT bookmark. +*/ + terraform { required_providers { delphix = { @@ -56,11 +60,6 @@ resource "delphix_vdb" "example" { mount_path = "/work", environment_id = "environment-123" }] - make_current_account_owner = true - tags { - key = "key-1" - value = "value-1" - } post_snapshot { name = "string" command = "string" @@ -138,4 +137,10 @@ resource "delphix_vdb" "example" { element_id = "string" has_credentials = true } + make_current_account_owner = true + tags { + key = "key-1" + value = "value-1" + } + } \ No newline at end of file diff --git a/examples/vdb/hana/timestamp/main.tf b/examples/vdb/hana/timestamp/main.tf index e2af89e..4188310 100644 --- a/examples/vdb/hana/timestamp/main.tf +++ b/examples/vdb/hana/timestamp/main.tf @@ -1,3 +1,7 @@ +/** +* Summary: This template showcases the properties available when provisioning an SAP Hana database from a DCT bookmark. +*/ + terraform { required_providers { delphix = { @@ -57,11 +61,6 @@ resource "delphix_vdb" "example" { mount_path = "/work", environment_id = "environment-123" }] - make_current_account_owner = true - tags { - key = "key-1" - value = "value-1" - } post_snapshot { name = "string" command = "string" @@ -139,4 +138,9 @@ resource "delphix_vdb" "example" { element_id = "string" has_credentials = true } + make_current_account_owner = true + tags { + key = "key-1" + value = "value-1" + } } \ No newline at end of file diff --git a/examples/vdb/mssql/bookmark/main.tf b/examples/vdb/mssql/bookmark/main.tf index 17c6200..4c13390 100644 --- a/examples/vdb/mssql/bookmark/main.tf +++ b/examples/vdb/mssql/bookmark/main.tf @@ -1,3 +1,7 @@ +/** +* Summary: This template showcases the properties available when provisioning a MSSQL database from a DCT bookmark. +*/ + terraform { required_providers { delphix = { @@ -37,11 +41,6 @@ resource "delphix_vdb" "example" { config_params jsonencode({ processes = 150 }) - make_current_account_owner = true - tags { - key = "key-1" - value = "value-1" - } post_snapshot { name = "string" command = "string" @@ -133,4 +132,9 @@ resource "delphix_vdb" "example" { element_id = "string" has_credentials = true } + make_current_account_owner = true + tags { + key = "key-1" + value = "value-1" + } } \ No newline at end of file diff --git a/examples/vdb/mssql/snapshot/main.tf b/examples/vdb/mssql/snapshot/main.tf index 770e4b0..5b953ca 100644 --- a/examples/vdb/mssql/snapshot/main.tf +++ b/examples/vdb/mssql/snapshot/main.tf @@ -1,3 +1,7 @@ +/** +* Summary: This template showcases the properties available when provisioning a MSSQL database from a DCT bookmark. +*/ + terraform { required_providers { delphix = { @@ -38,11 +42,6 @@ resource "delphix_vdb" "example" { config_params jsonencode({ processes = 150 }) - make_current_account_owner = true - tags { - key = "key-1" - value = "value-1" - } post_snapshot { name = "string" command = "string" @@ -134,4 +133,10 @@ resource "delphix_vdb" "example" { element_id = "string" has_credentials = true } + make_current_account_owner = true + tags { + key = "key-1" + value = "value-1" + } + } \ No newline at end of file diff --git a/examples/vdb/mssql/timestamp/main.tf b/examples/vdb/mssql/timestamp/main.tf index a8181f3..5c72226 100644 --- a/examples/vdb/mssql/timestamp/main.tf +++ b/examples/vdb/mssql/timestamp/main.tf @@ -1,3 +1,7 @@ +/** +* Summary: This template showcases the properties available when provisioning a MSSQL database from a DCT bookmark. +*/ + terraform { required_providers { delphix = { @@ -40,11 +44,6 @@ resource "delphix_vdb" "example" { config_params jsonencode({ processes = 150 }) - make_current_account_owner = true - tags { - key = "key-1" - value = "value-1" - } post_snapshot { name = "string" command = "string" @@ -136,4 +135,9 @@ resource "delphix_vdb" "example" { element_id = "string" has_credentials = true } + make_current_account_owner = true + tags { + key = "key-1" + value = "value-1" + } } \ No newline at end of file diff --git a/examples/vdb/oracle/bookmark/main.tf b/examples/vdb/oracle/bookmark/main.tf index 0c8d733..eb548f3 100644 --- a/examples/vdb/oracle/bookmark/main.tf +++ b/examples/vdb/oracle/bookmark/main.tf @@ -1,3 +1,7 @@ +/** +* Summary: This template showcases the properties available when provisioning an Oracle database from a DCT bookmark. +*/ + terraform { required_providers { delphix = { @@ -69,11 +73,6 @@ resource "delphix_vdb" "example" { config_params jsonencode({ processes = 150 }) - tags { - key = "key-1" - value = "value-1" - } - make_current_account_owner = true pre_start { name = "string" command = "string" @@ -151,4 +150,9 @@ resource "delphix_vdb" "example" { element_id = "string" has_credentials = true } + tags { + key = "key-1" + value = "value-1" + } + make_current_account_owner = true } \ No newline at end of file diff --git a/examples/vdb/oracle/snapshot/main.tf b/examples/vdb/oracle/snapshot/main.tf index da710a6..e2cdfe5 100644 --- a/examples/vdb/oracle/snapshot/main.tf +++ b/examples/vdb/oracle/snapshot/main.tf @@ -1,3 +1,7 @@ +/** +* Summary: This template showcases the properties available when provisioning an Oracle database from a DCT bookmark. +*/ + terraform { required_providers { delphix = { @@ -71,12 +75,7 @@ resource "delphix_vdb" "example" { config_params jsonencode({ processes = 150 }) - tags { - key = "key-1" - value = "value-1" - } - make_current_account_owner = true - pre_start { + pre_start { name = "string", command = "string", shell = "bash", @@ -153,4 +152,9 @@ resource "delphix_vdb" "example" { element_id = "string" has_credentials = true } + tags { + key = "key-1" + value = "value-1" + } + make_current_account_owner = true } \ No newline at end of file diff --git a/examples/vdb/oracle/timestamp/main.tf b/examples/vdb/oracle/timestamp/main.tf index 540f225..da39843 100644 --- a/examples/vdb/oracle/timestamp/main.tf +++ b/examples/vdb/oracle/timestamp/main.tf @@ -1,3 +1,7 @@ +/** +* Summary: This template showcases the properties available when provisioning an Oracle database from a DCT bookmark. +*/ + terraform { required_providers { delphix = { @@ -70,11 +74,6 @@ resource "delphix_vdb" "example" { config_params jsonencode({ processes = 150 }) - tags { - key = "key-1" - value = "value-1" - } - make_current_account_owner = true pre_start { name = "string" command = "string" @@ -152,4 +151,9 @@ resource "delphix_vdb" "example" { element_id = "string" has_credentials = true } + tags { + key = "key-1" + value = "value-1" + } + make_current_account_owner = true } \ No newline at end of file diff --git a/examples/vdb/postgresql/bookmark/main.tf b/examples/vdb/postgresql/bookmark/main.tf index 050ae65..87ad424 100644 --- a/examples/vdb/postgresql/bookmark/main.tf +++ b/examples/vdb/postgresql/bookmark/main.tf @@ -1,3 +1,7 @@ +/** +* Summary: This template showcases the properties available when provisioning a PostgreSQL database from a DCT bookmark. +*/ + terraform { required_providers { delphix = { @@ -48,11 +52,7 @@ resource "delphix_vdb" "example" { mount_path = "/work", environment_id = "environment-123" }] - make_current_account_owner = true - tags { - key = "key-1" - value = "value-1" - } + post_snapshot { name = "string" command = "string" @@ -130,4 +130,9 @@ resource "delphix_vdb" "example" { element_id = "string" has_credentials = true } + make_current_account_owner = true + tags { + key = "key-1" + value = "value-1" + } } \ No newline at end of file diff --git a/examples/vdb/postgresql/snapshot/main.tf b/examples/vdb/postgresql/snapshot/main.tf index 7b06d82..f2aa01c 100644 --- a/examples/vdb/postgresql/snapshot/main.tf +++ b/examples/vdb/postgresql/snapshot/main.tf @@ -1,3 +1,7 @@ +/** +* Summary: This template showcases the properties available when provisioning a PostgreSQL database from a DCT bookmark. +*/ + terraform { required_providers { delphix = { @@ -49,11 +53,7 @@ resource "delphix_vdb" "example" { mount_path = "/work", environment_id = "environment-123" }] - make_current_account_owner = true - tags { - key = "key-1" - value = "value-1" - } + post_snapshot { name = "string" command = "string" @@ -131,4 +131,9 @@ resource "delphix_vdb" "example" { element_id = "string" has_credentials = true } + make_current_account_owner = true + tags { + key = "key-1" + value = "value-1" + } } \ No newline at end of file diff --git a/examples/vdb/postgresql/timestamp/main.tf b/examples/vdb/postgresql/timestamp/main.tf index 0f133c7..9fe33cc 100644 --- a/examples/vdb/postgresql/timestamp/main.tf +++ b/examples/vdb/postgresql/timestamp/main.tf @@ -1,3 +1,7 @@ +/** +* Summary: This template showcases the properties available when provisioning a PostgreSQL database from a DCT bookmark. +*/ + terraform { required_providers { delphix = { @@ -50,11 +54,6 @@ resource "delphix_vdb" "example" { mount_path = "/work", environment_id = "environment-123" }] - make_current_account_owner = true - tags { - key = "key-1" - value = "value-1" - } post_snapshot { name = "string" command = "string" @@ -132,4 +131,9 @@ resource "delphix_vdb" "example" { element_id = "string" has_credentials = true } + make_current_account_owner = true + tags { + key = "key-1" + value = "value-1" + } } \ No newline at end of file diff --git a/examples/vdb/sybase/bookmark/main.tf b/examples/vdb/sybase/bookmark/main.tf index bdbd7c7..1d3705f 100644 --- a/examples/vdb/sybase/bookmark/main.tf +++ b/examples/vdb/sybase/bookmark/main.tf @@ -1,3 +1,7 @@ +/** +* Summary: This template showcases the properties available when provisioning a SYBASE database from a DCT bookmark. +*/ + terraform { required_providers { delphix = { @@ -36,86 +40,86 @@ resource "delphix_vdb" "example" { config_params jsonencode({ processes = 150 }) - make_current_account_owner = true - tags { - key = "key-1" - value = "value-1" - } - pre_snapshot [{ + pre_snapshot { name = "string", command = "string", shell = "bash", element_id = "string", has_credentials = true - }] - pre_stop [{ + } + pre_stop { name = "string", command = "string", shell = "bash", element_id = "string", has_credentials = true - }] - pre_refresh [{ + } + pre_refresh { name = "string", command = "string", shell = "bash", element_id = "string", has_credentials = true - }] - post_start [{ + } + post_start { name = "string", command = "string", shell = "bash", element_id = "string", has_credentials = true - }] - post_snapshot [{ + } + post_snapshot { name = "string", command = "string", shell = "bash", element_id = "string", has_credentials = true - }] - post_refresh [{ + } + post_refresh { name = "string", command = "string", shell = "bash", element_id = "string", has_credentials = true - }] - post_stop [{ + } + post_stop { name = "string", command = "string", shell = "bash", element_id = "string", has_credentials = true - }] - post_rollback [{ + } + post_rollback { name = "string", command = "string", shell = "bash", element_id = "string", has_credentials = true - }] - pre_rollback [{ + } + pre_rollback { name = "string", command = "string", shell = "bash", element_id = "string", has_credentials = true - }] - pre_start [{ + } + pre_start { name = "string", command = "string", shell = "bash", element_id = "string", has_credentials = true - }] - configure_clone [{ + } + configure_clone { name = "string", command = "string", shell = "bash", element_id = "string", has_credentials = true - }] + } + make_current_account_owner = true + tags { + key = "key-1" + value = "value-1" + } } \ No newline at end of file diff --git a/examples/vdb/sybase/snapshot/main.tf b/examples/vdb/sybase/snapshot/main.tf index 95e355e..1913657 100644 --- a/examples/vdb/sybase/snapshot/main.tf +++ b/examples/vdb/sybase/snapshot/main.tf @@ -1,3 +1,7 @@ +/** +* Summary: This template showcases the properties available when provisioning a SYBASE database from a DCT bookmark. +*/ + terraform { required_providers { delphix = { @@ -37,11 +41,6 @@ resource "delphix_vdb" "example" { config_params jsonencode({ processes = 150 }) - make_current_account_owner = true - tags { - key = "key-1" - value = "value-1" - } pre_snapshot { name = "string" command = "string" @@ -119,5 +118,9 @@ resource "delphix_vdb" "example" { element_id = "string" has_credentials = true } - + make_current_account_owner = true + tags { + key = "key-1" + value = "value-1" + } } \ No newline at end of file diff --git a/examples/vdb/sybase/timestamp/main.tf b/examples/vdb/sybase/timestamp/main.tf index dc53b4b..1ccf2c0 100644 --- a/examples/vdb/sybase/timestamp/main.tf +++ b/examples/vdb/sybase/timestamp/main.tf @@ -1,3 +1,7 @@ +/** +* Summary: This template showcases the properties available when provisioning a SYBASE database from a DCT bookmark. +*/ + terraform { required_providers { delphix = { @@ -38,11 +42,6 @@ resource "delphix_vdb" "example" { config_params jsonencode({ processes = 150 }) - make_current_account_owner = true - tags { - key = "key-1" - value = "value-1" - } pre_snapshot { name = "string" command = "string" @@ -120,4 +119,9 @@ resource "delphix_vdb" "example" { element_id = "string" has_credentials = true } + make_current_account_owner = true + tags { + key = "key-1" + value = "value-1" + } } \ No newline at end of file From 34e22189c0d03854b4517abc6e35006b1a220dbb Mon Sep 17 00:00:00 2001 From: Uddipaan <89963410+Uddipaan-Hazarika@users.noreply.github.com> Date: Wed, 17 May 2023 12:48:17 +0530 Subject: [PATCH 3/4] output file was empty --- examples/simple-provision/outputs.tf | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/examples/simple-provision/outputs.tf b/examples/simple-provision/outputs.tf index e69de29..8a868d3 100644 --- a/examples/simple-provision/outputs.tf +++ b/examples/simple-provision/outputs.tf @@ -0,0 +1,33 @@ +### +# VDB Group Information +### +output "vdb_group_id" { + value = delphix_vdb_group.create_vdb_group.id +} + +output "vdb_group_name" { + value = delphix_vdb_group.create_vdb_group.name +} + +### +# VDB 1 Information +### +output "vdb_id_1" { + value = delphix_vdb.provision_vdb_1.id +} + +output "vdb_name_1" { + value = delphix_vdb.provision_vdb_1.name +} + +output "vdb_ip_address_1" { + value = delphix_vdb.provision_vdb_1.ip_address +} + +output "vdb_database_type_1" { + value = delphix_vdb.provision_vdb_1.database_type +} + +output "vdb_database_version_1" { + value = delphix_vdb.provision_vdb_1.database_version +} From 5cbf47aa81960d036b933220abeb809c343af3e5 Mon Sep 17 00:00:00 2001 From: Uddipaan <89963410+Uddipaan-Hazarika@users.noreply.github.com> Date: Wed, 17 May 2023 16:06:34 +0530 Subject: [PATCH 4/4] addressed comments on password --- examples/jenkins-integration/Readme.md | 2 +- examples/vdb/hana/bookmark/main.tf | 4 ++-- examples/vdb/hana/snapshot/main.tf | 4 ++-- examples/vdb/hana/timestamp/main.tf | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/jenkins-integration/Readme.md b/examples/jenkins-integration/Readme.md index 7f55dee..c7ca588 100644 --- a/examples/jenkins-integration/Readme.md +++ b/examples/jenkins-integration/Readme.md @@ -6,7 +6,7 @@ The Jenkinsfile presents a simple CI/CD scenario where it provisions a VDB, runs 2) Insert or reference the associated `Jenkinsfile` file. - Note: This Jenkinsfile also references the Terraform files in the `../simple-provision` folder. Feel free to fork, update, and modify those. 3) Update the following values: - - DCT_HOSTNAME - Example: `10.134.0.1` + - DCT_HOSTNAME - Example: `123.0.0.0` - DCT_API_KEY - Example: `2.abc...` - [Manage this value through the Jenkins' Credentials plugin](https://docs.cloudbees.com/docs/cloudbees-ci/latest/cloud-secure-guide/injecting-secrets) - In a pinch, update it directly. diff --git a/examples/vdb/hana/bookmark/main.tf b/examples/vdb/hana/bookmark/main.tf index 1b4d4b4..cf4ada6 100644 --- a/examples/vdb/hana/bookmark/main.tf +++ b/examples/vdb/hana/bookmark/main.tf @@ -45,8 +45,8 @@ resource "delphix_vdb" "example" { "sTenantServicePort" = "xsengine:30052" }] tDatabaseName = "tfbkmrk" - tSystemUserName = "SYSTEM" - tSystemUserPassword ="Delphix_123" + tSystemUserName = "" + tSystemUserPassword ="" }) config_params jsonencode({ processes = 150 diff --git a/examples/vdb/hana/snapshot/main.tf b/examples/vdb/hana/snapshot/main.tf index fd6305a..f5a8019 100644 --- a/examples/vdb/hana/snapshot/main.tf +++ b/examples/vdb/hana/snapshot/main.tf @@ -46,8 +46,8 @@ resource "delphix_vdb" "example" { "sTenantServicePort" = "xsengine:30052" }] tDatabaseName = "tfbkmrk" - tSystemUserName = "SYSTEM" - tSystemUserPassword ="Delphix_123" + tSystemUserName = "" + tSystemUserPassword ="" }) config_params jsonencode({ processes = 150 diff --git a/examples/vdb/hana/timestamp/main.tf b/examples/vdb/hana/timestamp/main.tf index 4188310..26711ba 100644 --- a/examples/vdb/hana/timestamp/main.tf +++ b/examples/vdb/hana/timestamp/main.tf @@ -47,8 +47,8 @@ resource "delphix_vdb" "example" { "sTenantServicePort" = "xsengine:30052" }] tDatabaseName = "tfbkmrk" - tSystemUserName = "SYSTEM" - tSystemUserPassword ="Delphix_123" + tSystemUserName = "" + tSystemUserPassword ="" }) config_params jsonencode({ processes = 150