From 6af42e9ee07bdc5adc6a2a7b79af29acc6eb007b Mon Sep 17 00:00:00 2001 From: Uddipaan <89963410+Uddipaan-Hazarika@users.noreply.github.com> Date: Wed, 3 May 2023 14:37:30 +0530 Subject: [PATCH 01/25] HUBS-1559 | Postgres support --- GNUmakefile | 2 +- go.mod | 3 +- go.sum | 16 +++++++---- internal/provider/resource_vdb.go | 39 ++++++++++++++++++++++++++ internal/provider/resource_vdb_test.go | 4 +-- 5 files changed, 53 insertions(+), 11 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 62b4f27..d4ad5d4 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -3,7 +3,7 @@ HOSTNAME=delphix.com NAMESPACE=dct NAME=delphix BINARY=terraform-provider-${NAME} -VERSION=1.0.1 +VERSION=2.0.0-beta OS_ARCH=darwin_amd64 default: install diff --git a/go.mod b/go.mod index 8da7a7f..ea91957 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module terraform-provider-delphix go 1.17 require ( - github.com/delphix/dct-sdk-go v1.2.0 + github.com/delphix/dct-sdk-go v1.6.0 github.com/hashicorp/terraform-plugin-sdk v1.17.2 ) @@ -46,7 +46,6 @@ require ( github.com/vmihailenco/tagparser v0.1.1 // indirect github.com/zclconf/go-cty v1.10.0 // indirect golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e // indirect - golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2 // indirect golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d // indirect diff --git a/go.sum b/go.sum index a910e1f..7fde996 100644 --- a/go.sum +++ b/go.sum @@ -85,8 +85,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/delphix/dct-sdk-go v1.2.0 h1:/YM+CjuXv1cx3xBDYGk1ST3QcAG4EAF5ty96elnnh+M= -github.com/delphix/dct-sdk-go v1.2.0/go.mod h1:jHmLaVSOGroT5E298s7GU3TobaZ8SH0RqUhFo5WkPqo= +github.com/delphix/dct-sdk-go v1.6.0 h1:mlt+fNX7PwF1fnV9W1lbMP+qW1LPb2UBHBrrvCtiOTQ= +github.com/delphix/dct-sdk-go v1.6.0/go.mod h1:7mGbpjf2LNaBuyeblpbUF9K/VPWoym//HZlK5vGo3TI= github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -336,13 +336,18 @@ github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= @@ -458,8 +463,6 @@ golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4Iltr golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2 h1:+jnHzr9VPj32ykQVai5DNahi9+NSp7yYuCsl5eAQtL0= -golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -675,8 +678,9 @@ gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/internal/provider/resource_vdb.go b/internal/provider/resource_vdb.go index 2a46828..44f648c 100644 --- a/internal/provider/resource_vdb.go +++ b/internal/provider/resource_vdb.go @@ -2,6 +2,7 @@ package provider import ( "context" + "encoding/json" "net/http" "time" @@ -567,6 +568,14 @@ func resourceVdb() *schema.Resource { }, }, }, + "appdata_source_params": { + Type: schema.TypeString, + Optional: true, + }, + "appdata_config_params": { + Type: schema.TypeString, + Optional: true, + }, }, } } @@ -766,6 +775,16 @@ func helper_provision_by_snapshot(ctx context.Context, d *schema.ResourceData, m if v, has_v := d.GetOk("tags"); has_v { provisionVDBBySnapshotParameters.SetTags(toTagArray(v)) } + if v, has_v := d.GetOk("appdata_source_params"); has_v { + appdata_source_params := make(map[string]interface{}) + json.Unmarshal([]byte(v.(string)), &appdata_source_params) + provisionVDBBySnapshotParameters.SetAppdataSourceParams(appdata_source_params) + } + if v, has_v := d.GetOk("appdata_config_params"); has_v { + appdata_config_params := make(map[string]interface{}) + json.Unmarshal([]byte(v.(string)), &appdata_config_params) + provisionVDBBySnapshotParameters.SetAppdataConfigParams(appdata_config_params) + } req := client.VDBsApi.ProvisionVdbBySnapshot(ctx) @@ -963,6 +982,16 @@ func helper_provision_by_timestamp(ctx context.Context, d *schema.ResourceData, if v, has_v := d.GetOk("tags"); has_v { provisionVDBByTimestampParameters.SetTags(toTagArray(v)) } + if v, has_v := d.GetOk("appdata_source_params"); has_v { + appdata_source_params := make(map[string]interface{}) + json.Unmarshal([]byte(v.(string)), &appdata_source_params) + provisionVDBByTimestampParameters.SetAppdataSourceParams(appdata_source_params) + } + if v, has_v := d.GetOk("appdata_config_params"); has_v { + appdata_config_params := make(map[string]interface{}) + json.Unmarshal([]byte(v.(string)), &appdata_config_params) + provisionVDBByTimestampParameters.SetAppdataConfigParams(appdata_config_params) + } req := client.VDBsApi.ProvisionVdbByTimestamp(ctx) @@ -1145,6 +1174,16 @@ func helper_provision_by_bookmark(ctx context.Context, d *schema.ResourceData, m if v, has_v := d.GetOk("tags"); has_v { provisionVDBFromBookmarkParameters.SetPostStop(toHookArray(v)) } + if v, has_v := d.GetOk("appdata_source_params"); has_v { + appdata_source_params := make(map[string]interface{}) + json.Unmarshal([]byte(v.(string)), &appdata_source_params) + provisionVDBFromBookmarkParameters.SetAppdataSourceParams(appdata_source_params) + } + if v, has_v := d.GetOk("appdata_config_params"); has_v { + appdata_config_params := make(map[string]interface{}) + json.Unmarshal([]byte(v.(string)), &appdata_config_params) + provisionVDBFromBookmarkParameters.SetAppdataConfigParams(appdata_config_params) + } req := client.VDBsApi.ProvisionVdbFromBookmark(ctx) diff --git a/internal/provider/resource_vdb_test.go b/internal/provider/resource_vdb_test.go index 4100eb6..ff60484 100644 --- a/internal/provider/resource_vdb_test.go +++ b/internal/provider/resource_vdb_test.go @@ -113,11 +113,11 @@ func testAccCheckDctVDBBookmarkConfigBasic() string { } //create bookmark - bookmark := dctapi.NewBookmarkWithDefaults() + bookmark := dctapi.NewBookmarkCreateParametersWithDefaults() bookmark.SetVdbIds([]string{vdb_id}) bookmark.SetName(acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) - bookmark_req := client.BookmarksApi.CreateBookmark(context.Background()).Bookmark(*bookmark) + bookmark_req := client.BookmarksApi.CreateBookmark(context.Background()).BookmarkCreateParameters(*bookmark) bk_res, bk_http_res, bk_err := bookmark_req.Execute() if diags := apiErrorResponseHelper(bk_res, bk_http_res, bk_err); diags != nil { From b5b219bc5da3f8af0f33d7d59c8045b8b8b3226f Mon Sep 17 00:00:00 2001 From: Uddipaan <89963410+Uddipaan-Hazarika@users.noreply.github.com> Date: Mon, 8 May 2023 14:00:42 +0530 Subject: [PATCH 02/25] addressing review comments HUBS-1559 --- GNUmakefile | 2 +- internal/provider/resource_vdb.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/GNUmakefile b/GNUmakefile index d4ad5d4..62b4f27 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -3,7 +3,7 @@ HOSTNAME=delphix.com NAMESPACE=dct NAME=delphix BINARY=terraform-provider-${NAME} -VERSION=2.0.0-beta +VERSION=1.0.1 OS_ARCH=darwin_amd64 default: install diff --git a/internal/provider/resource_vdb.go b/internal/provider/resource_vdb.go index 44f648c..bb736f4 100644 --- a/internal/provider/resource_vdb.go +++ b/internal/provider/resource_vdb.go @@ -1287,6 +1287,8 @@ func resourceVdbRead(ctx context.Context, d *schema.ResourceData, meta interface d.Set("parent_id", result.GetParentId()) d.Set("group_name", result.GetGroupName()) d.Set("creation_date", result.GetCreationDate().String()) + d.Set("appdata_source_params", result.GetAppdataSourceParams()) + d.Set("appdata_config_params", result.GetAppdataConfigParams()) d.Set("id", vdbId) return diags From 9dc807cda00004a1a3df063c8201e35545d46add Mon Sep 17 00:00:00 2001 From: Uddipaan <89963410+Uddipaan-Hazarika@users.noreply.github.com> Date: Thu, 11 May 2023 22:39:49 +0530 Subject: [PATCH 03/25] HUBS-1692 | Additional params support for provision --- internal/provider/resource_vdb.go | 293 +++++++++++++++++++++++++++++- internal/provider/utility.go | 15 ++ 2 files changed, 306 insertions(+), 2 deletions(-) diff --git a/internal/provider/resource_vdb.go b/internal/provider/resource_vdb.go index bb736f4..008fb20 100644 --- a/internal/provider/resource_vdb.go +++ b/internal/provider/resource_vdb.go @@ -575,6 +575,100 @@ func resourceVdb() *schema.Resource { "appdata_config_params": { Type: schema.TypeString, Optional: true, + Computed: true, + }, + "make_current_account_owner": { + Type: schema.TypeBool, + Optional: true, + }, + "config_params": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "additional_mount_points": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "shared_path": { + Type: schema.TypeString, + Required: true, + }, + "mount_path": { + Type: schema.TypeString, + Optional: true, + }, + "environment_id": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "vcdb_tde_key_identifier": { + Type: schema.TypeString, + Optional: true, + }, + "cdb_tde_keystore_password": { + Type: schema.TypeString, + Optional: true, + }, + "target_vcdb_tde_keystore_path": { + Type: schema.TypeString, + Optional: true, + }, + "tde_key_identifier": { + Type: schema.TypeString, + Optional: true, + }, + "tde_exported_key_file_secret": { + Type: schema.TypeString, + Optional: true, + }, + "parent_tde_keystore_password": { + Type: schema.TypeString, + Optional: true, + }, + "parent_tde_keystore_path": { + Type: schema.TypeString, + Optional: true, + }, + "oracle_rac_custom_env_vars": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "node_id": { + Type: schema.TypeString, + Required: true, + }, + "name": { + Type: schema.TypeString, + Optional: true, + }, + "value": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "oracle_rac_custom_env_files": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "node_id": { + Type: schema.TypeString, + Required: true, + }, + "path_parameters": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, }, }, } @@ -609,6 +703,47 @@ func toTagArray(array interface{}) []dctapi.Tag { return items } +func toAdditionalMountPointsArray(array interface{}) []dctapi.AdditionalMountPoint { + items := []dctapi.AdditionalMountPoint{} + for _, item := range array.([]interface{}) { + item_map := item.(map[string]interface{}) + addMntPts := dctapi.NewAdditionalMountPoint() + addMntPts.SetEnvironmentId(item_map["environment_id"].(string)) + addMntPts.SetMountPath(item_map["mount_path"].(string)) + addMntPts.SetSharedPath(item_map["shared_path"].(string)) + + items = append(items, *addMntPts) + } + return items +} + +func toOracleRacCustomEnvVars(array interface{}) []dctapi.OracleRacCustomEnvVar { + items := []dctapi.OracleRacCustomEnvVar{} + for _, item := range array.([]interface{}) { + item_map := item.(map[string]interface{}) + oracleRacCustomEnvVars := dctapi.NewOracleRacCustomEnvVar() + oracleRacCustomEnvVars.SetName(item_map["name"].(string)) + oracleRacCustomEnvVars.SetNodeId(item_map["node_id"].(string)) + oracleRacCustomEnvVars.SetValue(item_map["value"].(string)) + + items = append(items, *oracleRacCustomEnvVars) + } + return items +} + +func toOracleRacCustomEnvFiles(array interface{}) []dctapi.OracleRacCustomEnvFile { + items := []dctapi.OracleRacCustomEnvFile{} + for _, item := range array.([]interface{}) { + item_map := item.(map[string]interface{}) + oracleRacCustomEnvFiles := dctapi.NewOracleRacCustomEnvFile() + oracleRacCustomEnvFiles.SetNodeId(item_map["node_id"].(string)) + oracleRacCustomEnvFiles.SetPathParameters(item_map["path_parameters"].(string)) + + items = append(items, *oracleRacCustomEnvFiles) + } + return items +} + func helper_provision_by_snapshot(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics client := meta.(*apiClient).client @@ -785,6 +920,44 @@ func helper_provision_by_snapshot(ctx context.Context, d *schema.ResourceData, m json.Unmarshal([]byte(v.(string)), &appdata_config_params) provisionVDBBySnapshotParameters.SetAppdataConfigParams(appdata_config_params) } + if v, has_v := d.GetOk("config_params"); has_v { + config_params := make(map[string]interface{}) + json.Unmarshal([]byte(v.(string)), &config_params) + provisionVDBBySnapshotParameters.SetConfigParams(config_params) + } + if v, has_v := d.GetOk("make_current_account_owner"); has_v { + provisionVDBBySnapshotParameters.SetMakeCurrentAccountOwner(v.(bool)) + } + if v, has_v := d.GetOk("vcdb_tde_key_identifier"); has_v { + provisionVDBBySnapshotParameters.SetVcdbTdeKeyIdentifier(v.(string)) + } + if v, has_v := d.GetOk("cdb_tde_keystore_password"); has_v { + provisionVDBBySnapshotParameters.SetCdbTdeKeystorePassword(v.(string)) + } + if v, has_v := d.GetOk("target_vcdb_tde_keystore_path"); has_v { + provisionVDBBySnapshotParameters.SetTargetVcdbTdeKeystorePath(v.(string)) + } + if v, has_v := d.GetOk("tde_key_identifier"); has_v { + provisionVDBBySnapshotParameters.SetTdeKeyIdentifier(v.(string)) + } + if v, has_v := d.GetOk("tde_exported_key_file_secret"); has_v { + provisionVDBBySnapshotParameters.SetTdeExportedKeyFileSecret(v.(string)) + } + if v, has_v := d.GetOk("parent_tde_keystore_password"); has_v { + provisionVDBBySnapshotParameters.SetParentTdeKeystorePassword(v.(string)) + } + if v, has_v := d.GetOk("parent_tde_keystore_path"); has_v { + provisionVDBBySnapshotParameters.SetParentTdeKeystorePath(v.(string)) + } + if v, has_v := d.GetOk("additional_mount_points"); has_v { + provisionVDBBySnapshotParameters.SetAdditionalMountPoints(toAdditionalMountPointsArray(v)) + } + if v, has_v := d.GetOk("oracle_rac_custom_env_files"); has_v { + provisionVDBBySnapshotParameters.SetOracleRacCustomEnvFiles(toOracleRacCustomEnvFiles(v)) + } + if v, has_v := d.GetOk("oracle_rac_custom_env_vars"); has_v { + provisionVDBBySnapshotParameters.SetOracleRacCustomEnvVars(toOracleRacCustomEnvVars(v)) + } req := client.VDBsApi.ProvisionVdbBySnapshot(ctx) @@ -992,6 +1165,44 @@ func helper_provision_by_timestamp(ctx context.Context, d *schema.ResourceData, json.Unmarshal([]byte(v.(string)), &appdata_config_params) provisionVDBByTimestampParameters.SetAppdataConfigParams(appdata_config_params) } + if v, has_v := d.GetOk("config_params"); has_v { + config_params := make(map[string]interface{}) + json.Unmarshal([]byte(v.(string)), &config_params) + provisionVDBByTimestampParameters.SetConfigParams(config_params) + } + if v, has_v := d.GetOk("make_current_account_owner"); has_v { + provisionVDBByTimestampParameters.SetMakeCurrentAccountOwner(v.(bool)) + } + if v, has_v := d.GetOk("vcdb_tde_key_identifier"); has_v { + provisionVDBByTimestampParameters.SetVcdbTdeKeyIdentifier(v.(string)) + } + if v, has_v := d.GetOk("cdb_tde_keystore_password"); has_v { + provisionVDBByTimestampParameters.SetCdbTdeKeystorePassword(v.(string)) + } + if v, has_v := d.GetOk("target_vcdb_tde_keystore_path"); has_v { + provisionVDBByTimestampParameters.SetTargetVcdbTdeKeystorePath(v.(string)) + } + if v, has_v := d.GetOk("tde_key_identifier"); has_v { + provisionVDBByTimestampParameters.SetTdeKeyIdentifier(v.(string)) + } + if v, has_v := d.GetOk("tde_exported_key_file_secret"); has_v { + provisionVDBByTimestampParameters.SetTdeExportedKeyFileSecret(v.(string)) + } + if v, has_v := d.GetOk("parent_tde_keystore_password"); has_v { + provisionVDBByTimestampParameters.SetParentTdeKeystorePassword(v.(string)) + } + if v, has_v := d.GetOk("parent_tde_keystore_path"); has_v { + provisionVDBByTimestampParameters.SetParentTdeKeystorePath(v.(string)) + } + if v, has_v := d.GetOk("additional_mount_points"); has_v { + provisionVDBByTimestampParameters.SetAdditionalMountPoints(toAdditionalMountPointsArray(v)) + } + if v, has_v := d.GetOk("oracle_rac_custom_env_files"); has_v { + provisionVDBByTimestampParameters.SetOracleRacCustomEnvFiles(toOracleRacCustomEnvFiles(v)) + } + if v, has_v := d.GetOk("oracle_rac_custom_env_vars"); has_v { + provisionVDBByTimestampParameters.SetOracleRacCustomEnvVars(toOracleRacCustomEnvVars(v)) + } req := client.VDBsApi.ProvisionVdbByTimestamp(ctx) @@ -1184,6 +1395,44 @@ func helper_provision_by_bookmark(ctx context.Context, d *schema.ResourceData, m json.Unmarshal([]byte(v.(string)), &appdata_config_params) provisionVDBFromBookmarkParameters.SetAppdataConfigParams(appdata_config_params) } + if v, has_v := d.GetOk("config_params"); has_v { + config_params := make(map[string]interface{}) + json.Unmarshal([]byte(v.(string)), &config_params) + provisionVDBFromBookmarkParameters.SetConfigParams(config_params) + } + if v, has_v := d.GetOk("make_current_account_owner"); has_v { + provisionVDBFromBookmarkParameters.SetMakeCurrentAccountOwner(v.(bool)) + } + if v, has_v := d.GetOk("vcdb_tde_key_identifier"); has_v { + provisionVDBFromBookmarkParameters.SetVcdbTdeKeyIdentifier(v.(string)) + } + if v, has_v := d.GetOk("cdb_tde_keystore_password"); has_v { + provisionVDBFromBookmarkParameters.SetCdbTdeKeystorePassword(v.(string)) + } + if v, has_v := d.GetOk("target_vcdb_tde_keystore_path"); has_v { + provisionVDBFromBookmarkParameters.SetTargetVcdbTdeKeystorePath(v.(string)) + } + if v, has_v := d.GetOk("tde_key_identifier"); has_v { + provisionVDBFromBookmarkParameters.SetTdeKeyIdentifier(v.(string)) + } + if v, has_v := d.GetOk("tde_exported_key_file_secret"); has_v { + provisionVDBFromBookmarkParameters.SetTdeExportedKeyFileSecret(v.(string)) + } + if v, has_v := d.GetOk("parent_tde_keystore_password"); has_v { + provisionVDBFromBookmarkParameters.SetParentTdeKeystorePassword(v.(string)) + } + if v, has_v := d.GetOk("parent_tde_keystore_path"); has_v { + provisionVDBFromBookmarkParameters.SetParentTdeKeystorePath(v.(string)) + } + if v, has_v := d.GetOk("additional_mount_points"); has_v { + provisionVDBFromBookmarkParameters.SetAdditionalMountPoints(toAdditionalMountPointsArray(v)) + } + if v, has_v := d.GetOk("oracle_rac_custom_env_files"); has_v { + provisionVDBFromBookmarkParameters.SetOracleRacCustomEnvFiles(toOracleRacCustomEnvFiles(v)) + } + if v, has_v := d.GetOk("oracle_rac_custom_env_vars"); has_v { + provisionVDBFromBookmarkParameters.SetOracleRacCustomEnvVars(toOracleRacCustomEnvVars(v)) + } req := client.VDBsApi.ProvisionVdbFromBookmark(ctx) @@ -1287,8 +1536,15 @@ func resourceVdbRead(ctx context.Context, d *schema.ResourceData, meta interface d.Set("parent_id", result.GetParentId()) d.Set("group_name", result.GetGroupName()) d.Set("creation_date", result.GetCreationDate().String()) - d.Set("appdata_source_params", result.GetAppdataSourceParams()) - d.Set("appdata_config_params", result.GetAppdataConfigParams()) + + appdata_source_params, _ := json.Marshal(result.GetAppdataSourceParams()) + d.Set("appdata_source_params", string(appdata_source_params)) + appdata_config_params, _ := json.Marshal(result.GetAppdataConfigParams()) + d.Set("appdata_config_params", string(appdata_config_params)) + config_params, _ := json.Marshal(result.GetConfigParams()) + d.Set("config_params", string(config_params)) + d.Set("additional_mount_points", flattenAdditionalMountPoints(result.GetAdditionalMountPoints())) + d.Set("id", vdbId) return diags @@ -1396,6 +1652,39 @@ func resourceVdbUpdate(ctx context.Context, d *schema.ResourceData, meta interfa if d.HasChange("cdc_on_provision") { updateVDBParam.SetCdcOnProvision(d.Get("cdc_on_provision").(bool)) } + if d.HasChange("additional_mount_points") { + updateVDBParam.SetAdditionalMountPoints(toAdditionalMountPointsArray(d.Get("additional_mount_points"))) + } + if d.HasChange("parent_tde_keystore_path") { + updateVDBParam.SetParentTdeKeystorePath(d.Get("parent_tde_keystore_path").(string)) + } + if d.HasChange("parent_tde_keystore_password") { + updateVDBParam.SetParentTdeKeystorePassword(d.Get("parent_tde_keystore_password").(string)) + } + if d.HasChange("tde_key_identifier") { + updateVDBParam.SetTdeKeyIdentifier(d.Get("tde_key_identifier").(string)) + } + if d.HasChange("target_vcdb_tde_keystore_path") { + updateVDBParam.SetTargetVcdbTdeKeystorePath(d.Get("target_vcdb_tde_keystore_path").(string)) + } + if d.HasChange("cdb_tde_keystore_password") { + updateVDBParam.SetCdbTdeKeystorePassword(d.Get("cdb_tde_keystore_password").(string)) + } + if d.HasChange("appdata_source_params") { + appdata_source_params := make(map[string]interface{}) + json.Unmarshal([]byte(d.Get("appdata_source_params").(string)), &appdata_source_params) + updateVDBParam.SetAppdataSourceParams(appdata_source_params) + } + if d.HasChange("appdata_config_params") { + appdata_config_params := make(map[string]interface{}) + json.Unmarshal([]byte(d.Get("appdata_config_params").(string)), &appdata_config_params) + updateVDBParam.SetAppdataConfigParams(appdata_config_params) + } + if d.HasChange("config_params") { + config_params := make(map[string]interface{}) + json.Unmarshal([]byte(d.Get("config_params").(string)), &config_params) + updateVDBParam.SetConfigParams(config_params) + } res, httpRes, err := client.VDBsApi.UpdateVdbById(ctx, d.Get("id").(string)).UpdateVDBParameters(*updateVDBParam).Execute() diff --git a/internal/provider/utility.go b/internal/provider/utility.go index 046c957..b3ba3fc 100644 --- a/internal/provider/utility.go +++ b/internal/provider/utility.go @@ -114,6 +114,21 @@ func flattenHosts(hosts []dctapi.Host) []interface{} { return make([]interface{}, 0) } +func flattenAdditionalMountPoints(additional_mount_points []dctapi.AdditionalMountPoint) []interface{} { + if additional_mount_points != nil { + returned_additional_mount_points := make([]interface{}, len(additional_mount_points)) + for i, additional_mount_point := range additional_mount_points { + returned_additional_mount_point := make(map[string]interface{}) + returned_additional_mount_point["shared_path"] = additional_mount_point.GetSharedPath() + returned_additional_mount_point["mount_path"] = additional_mount_point.GetMountPath() + returned_additional_mount_point["environment_id"] = additional_mount_point.GetEnvironmentId() + returned_additional_mount_points[i] = returned_additional_mount_point + } + return returned_additional_mount_points + } + return make([]interface{}, 0) +} + func apiErrorResponseHelper(res interface{}, httpRes *http.Response, err error) diag.Diagnostics { // Helper function to return Diagnostics object if there is // a failure during API call. From 634cea096ccff986697a3982b7c976532b73a437 Mon Sep 17 00:00:00 2001 From: Uddipaan <89963410+Uddipaan-Hazarika@users.noreply.github.com> Date: Sat, 13 May 2023 01:00:03 +0530 Subject: [PATCH 04/25] HUBS-1692 | Added docs for the new params --- docs/resources/vdb.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/docs/resources/vdb.md b/docs/resources/vdb.md index 64dd7c2..dbf732f 100644 --- a/docs/resources/vdb.md +++ b/docs/resources/vdb.md @@ -223,6 +223,42 @@ Environment variable to be set when the engine creates a VDB. See the Engine doc * `key` - (Required) Key of the tag * `value` - (Required) Value of the tag +* `make_current_account_owner` - (Optional) Whether the account provisioning this VDB must be configured as owner of the VDB. + +* `config_params` - (Optional) Database configuration parameter overrides + +* `appdata_source_params` - The JSON payload conforming to the DraftV4 schema based on the type of application data being manipulated. + +* `appdata_config_params` - (Optional) The list of parameters specified by the source config schema in the toolkit + +* `additional_mount_points` - (Optional) Specifies additional locations on which to mount a subdirectory of an AppData container + * `shared_path` - (Required) Relative path within the container of the directory that should be mounted. + * `mount_path` - (Required) Absolute path on the target environment were the filesystem should be mounted + * `environment_id` - (Required) The entity ID of the environment on which the file system will be mounted. + +* `vcdb_tde_key_identifier` - (Optional) ID of the key created by Delphix. (Oracle Multitenant Only) + +* `cdb_tde_keystore_password` - (Optional) The password for the Transparent Data Encryption keystore associated with the CDB. (Oracle Multitenant Only) + +* `target_vcdb_tde_keystore_path` - (Optional) Path to the keystore of the target vCDB. (Oracle Multitenant Only) + +* `tde_key_identifier` - (Optional) ID of the key created by Delphix. (Oracle Multitenant Only) + +* `tde_exported_key_file_secret` - (Optional) Secret to be used while exporting and importing vPDB encryption keys if Transparent Data Encryption is enabled on the vPDB. (Oracle Multitenant Only) + +* `parent_tde_keystore_password` - (Optional) The password of the keystore specified in parentTdeKeystorePath. (Oracle Multitenant Only) + +* `parent_tde_keystore_path` - (Optional) Path to a copy of the parent's Oracle transparent data encryption keystore on the target host. Required to provision from snapshots containing encrypted database files. (Oracle Multitenant Only) + +* `oracle_rac_custom_env_vars` - (Optional) Environment variable to be set when the engine creates an Oracle RAC VDB. See the Engine documentation for the list of allowed/denied environment variables and rules about substitution. + * `node_id` - (Required) The node id of the cluster. + * `name` - (Required) Name of the environment variable + * `value` - (Required) Value of the environment variable. + +* `oracle_rac_custom_env_files` - (Optional) Environment files to be sourced when the Engine creates an Oracle RAC VDB. This path can be followed by parameters. Paths and parameters are separated by spaces. + * `node_id` - (Required) The node id of the cluster. + * `path_parameters` - (Required) This references a file from which certain parameters will be loaded. + ## Attribute Reference 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 05/25] 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 06/25] 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 07/25] 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 08/25] 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 From 39c6e2b1c7967ff63eb9f08cf52385a40585e770 Mon Sep 17 00:00:00 2001 From: Uddipaan <89963410+Uddipaan-Hazarika@users.noreply.github.com> Date: Thu, 18 May 2023 01:18:44 +0530 Subject: [PATCH 09/25] HUBS-1562 | Telemetry Support --- internal/provider/provider.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/provider/provider.go b/internal/provider/provider.go index c316a62..4ae52c7 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -86,6 +86,7 @@ func configure(version string, p *schema.Provider) func(context.Context, *schema TLSClientConfig: &tls.Config{InsecureSkipVerify: d.Get("tls_insecure_skip").(bool)}, }} cfg.AddDefaultHeader("Authorization", "apk "+d.Get("key").(string)) + cfg.AddDefaultHeader("x-dct-client-name", "Terraform") client := dctapi.NewAPIClient(cfg) From 52a1869635f144ab72a75f69a39bb6d61e2aec91 Mon Sep 17 00:00:00 2001 From: Uddipaan <89963410+Uddipaan-Hazarika@users.noreply.github.com> Date: Thu, 18 May 2023 22:22:12 +0530 Subject: [PATCH 10/25] HUBS-1709 | cluster_node_ids parameter defined as a string whereas DCT takes it as a list of string. --- internal/provider/resource_vdb.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/provider/resource_vdb.go b/internal/provider/resource_vdb.go index 008fb20..922349e 100644 --- a/internal/provider/resource_vdb.go +++ b/internal/provider/resource_vdb.go @@ -96,8 +96,11 @@ func resourceVdb() *schema.Resource { Optional: true, }, "cluster_node_ids": { - Type: schema.TypeString, + Type: schema.TypeList, Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, }, "truncate_log_on_checkpoint": { Type: schema.TypeBool, From e948c60bbfe70fece487dd26df2921297e0f5b0d Mon Sep 17 00:00:00 2001 From: Uddipaan <89963410+Uddipaan-Hazarika@users.noreply.github.com> Date: Fri, 19 May 2023 20:43:09 +0530 Subject: [PATCH 11/25] HUBS-1804 | Dependabot module updates and version bump --- .goreleaser.yml | 2 +- GNUmakefile | 2 +- go.mod | 8 ++++---- go.sum | 29 ++++++++++++++++++++++------- 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 9444a8c..2e33716 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,7 +1,7 @@ # Visit https://goreleaser.com for documentation on how to customize this # behavior. env: - - PROVIDER_VERSION=1.0.1 + - PROVIDER_VERSION=2.0.0 before: hooks: # this is just an example and not a requirement for provider building/publishing diff --git a/GNUmakefile b/GNUmakefile index 62b4f27..08efba8 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -3,7 +3,7 @@ HOSTNAME=delphix.com NAMESPACE=dct NAME=delphix BINARY=terraform-provider-${NAME} -VERSION=1.0.1 +VERSION=2.0.0 OS_ARCH=darwin_amd64 default: install diff --git a/go.mod b/go.mod index ea91957..fbdb406 100644 --- a/go.mod +++ b/go.mod @@ -45,9 +45,9 @@ require ( github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect github.com/vmihailenco/tagparser v0.1.1 // indirect github.com/zclconf/go-cty v1.10.0 // indirect - golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect - golang.org/x/text v0.3.7 // indirect + golang.org/x/crypto v0.1.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d // indirect google.golang.org/grpc v1.45.0 // indirect ) @@ -55,7 +55,7 @@ require ( require ( github.com/golang/protobuf v1.5.2 // indirect github.com/hashicorp/terraform-plugin-sdk/v2 v2.12.0 - golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect + golang.org/x/net v0.7.0 // indirect google.golang.org/appengine v1.6.6 // indirect google.golang.org/protobuf v1.27.1 // indirect ) diff --git a/go.sum b/go.sum index 7fde996..6810d6d 100644 --- a/go.sum +++ b/go.sum @@ -362,6 +362,7 @@ github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zclconf/go-cty v1.0.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= @@ -389,8 +390,10 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e h1:gsTQYXdTw2Gq7RBsWvlQ91b+aEQ6bXFUngBGuR8sPpI= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= +golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -421,6 +424,7 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20180530234432-1e491301e022/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -455,8 +459,10 @@ golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -472,6 +478,7 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -509,19 +516,26 @@ golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -568,6 +582,7 @@ golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20201028111035-eafbe7b904eb/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From 7501ad41147e000b13856a65885b919e54431a53 Mon Sep 17 00:00:00 2001 From: Uddipaan <89963410+Uddipaan-Hazarika@users.noreply.github.com> Date: Thu, 25 May 2023 15:48:32 +0530 Subject: [PATCH 12/25] HUBS-1815 | Terraform - VDB update call fails when appdata_source_params are absent --- internal/provider/resource_vdb.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/provider/resource_vdb.go b/internal/provider/resource_vdb.go index 922349e..4c56351 100644 --- a/internal/provider/resource_vdb.go +++ b/internal/provider/resource_vdb.go @@ -574,6 +574,7 @@ func resourceVdb() *schema.Resource { "appdata_source_params": { Type: schema.TypeString, Optional: true, + Computed: true, }, "appdata_config_params": { Type: schema.TypeString, From 20c788e3bcf9dc69a2abd4704ea2d5866cfde2bb Mon Sep 17 00:00:00 2001 From: Uddipaan <89963410+Uddipaan-Hazarika@users.noreply.github.com> Date: Wed, 3 May 2023 14:37:30 +0530 Subject: [PATCH 13/25] HUBS-1559 | Postgres support --- GNUmakefile | 2 +- go.mod | 7 ++--- go.sum | 16 +++++++---- internal/provider/resource_vdb.go | 39 ++++++++++++++++++++++++++ internal/provider/resource_vdb_test.go | 4 +-- 5 files changed, 55 insertions(+), 13 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 62b4f27..d4ad5d4 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -3,7 +3,7 @@ HOSTNAME=delphix.com NAMESPACE=dct NAME=delphix BINARY=terraform-provider-${NAME} -VERSION=1.0.1 +VERSION=2.0.0-beta OS_ARCH=darwin_amd64 default: install diff --git a/go.mod b/go.mod index d9545bb..ea91957 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module terraform-provider-delphix go 1.17 require ( - github.com/delphix/dct-sdk-go v1.2.0 + github.com/delphix/dct-sdk-go v1.6.0 github.com/hashicorp/terraform-plugin-sdk v1.17.2 ) @@ -46,9 +46,8 @@ require ( github.com/vmihailenco/tagparser v0.1.1 // indirect github.com/zclconf/go-cty v1.10.0 // indirect golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e // indirect - golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2 // indirect - golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect - golang.org/x/text v0.3.8 // indirect + golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect + golang.org/x/text v0.3.7 // indirect google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d // indirect google.golang.org/grpc v1.45.0 // indirect ) diff --git a/go.sum b/go.sum index ca72261..6e7730e 100644 --- a/go.sum +++ b/go.sum @@ -85,8 +85,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/delphix/dct-sdk-go v1.2.0 h1:/YM+CjuXv1cx3xBDYGk1ST3QcAG4EAF5ty96elnnh+M= -github.com/delphix/dct-sdk-go v1.2.0/go.mod h1:jHmLaVSOGroT5E298s7GU3TobaZ8SH0RqUhFo5WkPqo= +github.com/delphix/dct-sdk-go v1.6.0 h1:mlt+fNX7PwF1fnV9W1lbMP+qW1LPb2UBHBrrvCtiOTQ= +github.com/delphix/dct-sdk-go v1.6.0/go.mod h1:7mGbpjf2LNaBuyeblpbUF9K/VPWoym//HZlK5vGo3TI= github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -336,13 +336,18 @@ github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= @@ -464,8 +469,6 @@ golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4Iltr golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2 h1:+jnHzr9VPj32ykQVai5DNahi9+NSp7yYuCsl5eAQtL0= -golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -686,8 +689,9 @@ gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/internal/provider/resource_vdb.go b/internal/provider/resource_vdb.go index 2a46828..44f648c 100644 --- a/internal/provider/resource_vdb.go +++ b/internal/provider/resource_vdb.go @@ -2,6 +2,7 @@ package provider import ( "context" + "encoding/json" "net/http" "time" @@ -567,6 +568,14 @@ func resourceVdb() *schema.Resource { }, }, }, + "appdata_source_params": { + Type: schema.TypeString, + Optional: true, + }, + "appdata_config_params": { + Type: schema.TypeString, + Optional: true, + }, }, } } @@ -766,6 +775,16 @@ func helper_provision_by_snapshot(ctx context.Context, d *schema.ResourceData, m if v, has_v := d.GetOk("tags"); has_v { provisionVDBBySnapshotParameters.SetTags(toTagArray(v)) } + if v, has_v := d.GetOk("appdata_source_params"); has_v { + appdata_source_params := make(map[string]interface{}) + json.Unmarshal([]byte(v.(string)), &appdata_source_params) + provisionVDBBySnapshotParameters.SetAppdataSourceParams(appdata_source_params) + } + if v, has_v := d.GetOk("appdata_config_params"); has_v { + appdata_config_params := make(map[string]interface{}) + json.Unmarshal([]byte(v.(string)), &appdata_config_params) + provisionVDBBySnapshotParameters.SetAppdataConfigParams(appdata_config_params) + } req := client.VDBsApi.ProvisionVdbBySnapshot(ctx) @@ -963,6 +982,16 @@ func helper_provision_by_timestamp(ctx context.Context, d *schema.ResourceData, if v, has_v := d.GetOk("tags"); has_v { provisionVDBByTimestampParameters.SetTags(toTagArray(v)) } + if v, has_v := d.GetOk("appdata_source_params"); has_v { + appdata_source_params := make(map[string]interface{}) + json.Unmarshal([]byte(v.(string)), &appdata_source_params) + provisionVDBByTimestampParameters.SetAppdataSourceParams(appdata_source_params) + } + if v, has_v := d.GetOk("appdata_config_params"); has_v { + appdata_config_params := make(map[string]interface{}) + json.Unmarshal([]byte(v.(string)), &appdata_config_params) + provisionVDBByTimestampParameters.SetAppdataConfigParams(appdata_config_params) + } req := client.VDBsApi.ProvisionVdbByTimestamp(ctx) @@ -1145,6 +1174,16 @@ func helper_provision_by_bookmark(ctx context.Context, d *schema.ResourceData, m if v, has_v := d.GetOk("tags"); has_v { provisionVDBFromBookmarkParameters.SetPostStop(toHookArray(v)) } + if v, has_v := d.GetOk("appdata_source_params"); has_v { + appdata_source_params := make(map[string]interface{}) + json.Unmarshal([]byte(v.(string)), &appdata_source_params) + provisionVDBFromBookmarkParameters.SetAppdataSourceParams(appdata_source_params) + } + if v, has_v := d.GetOk("appdata_config_params"); has_v { + appdata_config_params := make(map[string]interface{}) + json.Unmarshal([]byte(v.(string)), &appdata_config_params) + provisionVDBFromBookmarkParameters.SetAppdataConfigParams(appdata_config_params) + } req := client.VDBsApi.ProvisionVdbFromBookmark(ctx) diff --git a/internal/provider/resource_vdb_test.go b/internal/provider/resource_vdb_test.go index 4100eb6..ff60484 100644 --- a/internal/provider/resource_vdb_test.go +++ b/internal/provider/resource_vdb_test.go @@ -113,11 +113,11 @@ func testAccCheckDctVDBBookmarkConfigBasic() string { } //create bookmark - bookmark := dctapi.NewBookmarkWithDefaults() + bookmark := dctapi.NewBookmarkCreateParametersWithDefaults() bookmark.SetVdbIds([]string{vdb_id}) bookmark.SetName(acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) - bookmark_req := client.BookmarksApi.CreateBookmark(context.Background()).Bookmark(*bookmark) + bookmark_req := client.BookmarksApi.CreateBookmark(context.Background()).BookmarkCreateParameters(*bookmark) bk_res, bk_http_res, bk_err := bookmark_req.Execute() if diags := apiErrorResponseHelper(bk_res, bk_http_res, bk_err); diags != nil { From 91ad5cd20bcd485b646492ac8751b9fbc04e3ba5 Mon Sep 17 00:00:00 2001 From: Uddipaan <89963410+Uddipaan-Hazarika@users.noreply.github.com> Date: Mon, 8 May 2023 14:00:42 +0530 Subject: [PATCH 14/25] addressing review comments HUBS-1559 --- GNUmakefile | 2 +- internal/provider/resource_vdb.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/GNUmakefile b/GNUmakefile index d4ad5d4..62b4f27 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -3,7 +3,7 @@ HOSTNAME=delphix.com NAMESPACE=dct NAME=delphix BINARY=terraform-provider-${NAME} -VERSION=2.0.0-beta +VERSION=1.0.1 OS_ARCH=darwin_amd64 default: install diff --git a/internal/provider/resource_vdb.go b/internal/provider/resource_vdb.go index 44f648c..bb736f4 100644 --- a/internal/provider/resource_vdb.go +++ b/internal/provider/resource_vdb.go @@ -1287,6 +1287,8 @@ func resourceVdbRead(ctx context.Context, d *schema.ResourceData, meta interface d.Set("parent_id", result.GetParentId()) d.Set("group_name", result.GetGroupName()) d.Set("creation_date", result.GetCreationDate().String()) + d.Set("appdata_source_params", result.GetAppdataSourceParams()) + d.Set("appdata_config_params", result.GetAppdataConfigParams()) d.Set("id", vdbId) return diags From cd23bbe67be738b144f7d81c8c8aba888930330c Mon Sep 17 00:00:00 2001 From: Uddipaan <89963410+Uddipaan-Hazarika@users.noreply.github.com> Date: Thu, 11 May 2023 22:39:49 +0530 Subject: [PATCH 15/25] HUBS-1692 | Additional params support for provision --- internal/provider/resource_vdb.go | 293 +++++++++++++++++++++++++++++- internal/provider/utility.go | 15 ++ 2 files changed, 306 insertions(+), 2 deletions(-) diff --git a/internal/provider/resource_vdb.go b/internal/provider/resource_vdb.go index bb736f4..008fb20 100644 --- a/internal/provider/resource_vdb.go +++ b/internal/provider/resource_vdb.go @@ -575,6 +575,100 @@ func resourceVdb() *schema.Resource { "appdata_config_params": { Type: schema.TypeString, Optional: true, + Computed: true, + }, + "make_current_account_owner": { + Type: schema.TypeBool, + Optional: true, + }, + "config_params": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "additional_mount_points": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "shared_path": { + Type: schema.TypeString, + Required: true, + }, + "mount_path": { + Type: schema.TypeString, + Optional: true, + }, + "environment_id": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "vcdb_tde_key_identifier": { + Type: schema.TypeString, + Optional: true, + }, + "cdb_tde_keystore_password": { + Type: schema.TypeString, + Optional: true, + }, + "target_vcdb_tde_keystore_path": { + Type: schema.TypeString, + Optional: true, + }, + "tde_key_identifier": { + Type: schema.TypeString, + Optional: true, + }, + "tde_exported_key_file_secret": { + Type: schema.TypeString, + Optional: true, + }, + "parent_tde_keystore_password": { + Type: schema.TypeString, + Optional: true, + }, + "parent_tde_keystore_path": { + Type: schema.TypeString, + Optional: true, + }, + "oracle_rac_custom_env_vars": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "node_id": { + Type: schema.TypeString, + Required: true, + }, + "name": { + Type: schema.TypeString, + Optional: true, + }, + "value": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "oracle_rac_custom_env_files": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "node_id": { + Type: schema.TypeString, + Required: true, + }, + "path_parameters": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, }, }, } @@ -609,6 +703,47 @@ func toTagArray(array interface{}) []dctapi.Tag { return items } +func toAdditionalMountPointsArray(array interface{}) []dctapi.AdditionalMountPoint { + items := []dctapi.AdditionalMountPoint{} + for _, item := range array.([]interface{}) { + item_map := item.(map[string]interface{}) + addMntPts := dctapi.NewAdditionalMountPoint() + addMntPts.SetEnvironmentId(item_map["environment_id"].(string)) + addMntPts.SetMountPath(item_map["mount_path"].(string)) + addMntPts.SetSharedPath(item_map["shared_path"].(string)) + + items = append(items, *addMntPts) + } + return items +} + +func toOracleRacCustomEnvVars(array interface{}) []dctapi.OracleRacCustomEnvVar { + items := []dctapi.OracleRacCustomEnvVar{} + for _, item := range array.([]interface{}) { + item_map := item.(map[string]interface{}) + oracleRacCustomEnvVars := dctapi.NewOracleRacCustomEnvVar() + oracleRacCustomEnvVars.SetName(item_map["name"].(string)) + oracleRacCustomEnvVars.SetNodeId(item_map["node_id"].(string)) + oracleRacCustomEnvVars.SetValue(item_map["value"].(string)) + + items = append(items, *oracleRacCustomEnvVars) + } + return items +} + +func toOracleRacCustomEnvFiles(array interface{}) []dctapi.OracleRacCustomEnvFile { + items := []dctapi.OracleRacCustomEnvFile{} + for _, item := range array.([]interface{}) { + item_map := item.(map[string]interface{}) + oracleRacCustomEnvFiles := dctapi.NewOracleRacCustomEnvFile() + oracleRacCustomEnvFiles.SetNodeId(item_map["node_id"].(string)) + oracleRacCustomEnvFiles.SetPathParameters(item_map["path_parameters"].(string)) + + items = append(items, *oracleRacCustomEnvFiles) + } + return items +} + func helper_provision_by_snapshot(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics client := meta.(*apiClient).client @@ -785,6 +920,44 @@ func helper_provision_by_snapshot(ctx context.Context, d *schema.ResourceData, m json.Unmarshal([]byte(v.(string)), &appdata_config_params) provisionVDBBySnapshotParameters.SetAppdataConfigParams(appdata_config_params) } + if v, has_v := d.GetOk("config_params"); has_v { + config_params := make(map[string]interface{}) + json.Unmarshal([]byte(v.(string)), &config_params) + provisionVDBBySnapshotParameters.SetConfigParams(config_params) + } + if v, has_v := d.GetOk("make_current_account_owner"); has_v { + provisionVDBBySnapshotParameters.SetMakeCurrentAccountOwner(v.(bool)) + } + if v, has_v := d.GetOk("vcdb_tde_key_identifier"); has_v { + provisionVDBBySnapshotParameters.SetVcdbTdeKeyIdentifier(v.(string)) + } + if v, has_v := d.GetOk("cdb_tde_keystore_password"); has_v { + provisionVDBBySnapshotParameters.SetCdbTdeKeystorePassword(v.(string)) + } + if v, has_v := d.GetOk("target_vcdb_tde_keystore_path"); has_v { + provisionVDBBySnapshotParameters.SetTargetVcdbTdeKeystorePath(v.(string)) + } + if v, has_v := d.GetOk("tde_key_identifier"); has_v { + provisionVDBBySnapshotParameters.SetTdeKeyIdentifier(v.(string)) + } + if v, has_v := d.GetOk("tde_exported_key_file_secret"); has_v { + provisionVDBBySnapshotParameters.SetTdeExportedKeyFileSecret(v.(string)) + } + if v, has_v := d.GetOk("parent_tde_keystore_password"); has_v { + provisionVDBBySnapshotParameters.SetParentTdeKeystorePassword(v.(string)) + } + if v, has_v := d.GetOk("parent_tde_keystore_path"); has_v { + provisionVDBBySnapshotParameters.SetParentTdeKeystorePath(v.(string)) + } + if v, has_v := d.GetOk("additional_mount_points"); has_v { + provisionVDBBySnapshotParameters.SetAdditionalMountPoints(toAdditionalMountPointsArray(v)) + } + if v, has_v := d.GetOk("oracle_rac_custom_env_files"); has_v { + provisionVDBBySnapshotParameters.SetOracleRacCustomEnvFiles(toOracleRacCustomEnvFiles(v)) + } + if v, has_v := d.GetOk("oracle_rac_custom_env_vars"); has_v { + provisionVDBBySnapshotParameters.SetOracleRacCustomEnvVars(toOracleRacCustomEnvVars(v)) + } req := client.VDBsApi.ProvisionVdbBySnapshot(ctx) @@ -992,6 +1165,44 @@ func helper_provision_by_timestamp(ctx context.Context, d *schema.ResourceData, json.Unmarshal([]byte(v.(string)), &appdata_config_params) provisionVDBByTimestampParameters.SetAppdataConfigParams(appdata_config_params) } + if v, has_v := d.GetOk("config_params"); has_v { + config_params := make(map[string]interface{}) + json.Unmarshal([]byte(v.(string)), &config_params) + provisionVDBByTimestampParameters.SetConfigParams(config_params) + } + if v, has_v := d.GetOk("make_current_account_owner"); has_v { + provisionVDBByTimestampParameters.SetMakeCurrentAccountOwner(v.(bool)) + } + if v, has_v := d.GetOk("vcdb_tde_key_identifier"); has_v { + provisionVDBByTimestampParameters.SetVcdbTdeKeyIdentifier(v.(string)) + } + if v, has_v := d.GetOk("cdb_tde_keystore_password"); has_v { + provisionVDBByTimestampParameters.SetCdbTdeKeystorePassword(v.(string)) + } + if v, has_v := d.GetOk("target_vcdb_tde_keystore_path"); has_v { + provisionVDBByTimestampParameters.SetTargetVcdbTdeKeystorePath(v.(string)) + } + if v, has_v := d.GetOk("tde_key_identifier"); has_v { + provisionVDBByTimestampParameters.SetTdeKeyIdentifier(v.(string)) + } + if v, has_v := d.GetOk("tde_exported_key_file_secret"); has_v { + provisionVDBByTimestampParameters.SetTdeExportedKeyFileSecret(v.(string)) + } + if v, has_v := d.GetOk("parent_tde_keystore_password"); has_v { + provisionVDBByTimestampParameters.SetParentTdeKeystorePassword(v.(string)) + } + if v, has_v := d.GetOk("parent_tde_keystore_path"); has_v { + provisionVDBByTimestampParameters.SetParentTdeKeystorePath(v.(string)) + } + if v, has_v := d.GetOk("additional_mount_points"); has_v { + provisionVDBByTimestampParameters.SetAdditionalMountPoints(toAdditionalMountPointsArray(v)) + } + if v, has_v := d.GetOk("oracle_rac_custom_env_files"); has_v { + provisionVDBByTimestampParameters.SetOracleRacCustomEnvFiles(toOracleRacCustomEnvFiles(v)) + } + if v, has_v := d.GetOk("oracle_rac_custom_env_vars"); has_v { + provisionVDBByTimestampParameters.SetOracleRacCustomEnvVars(toOracleRacCustomEnvVars(v)) + } req := client.VDBsApi.ProvisionVdbByTimestamp(ctx) @@ -1184,6 +1395,44 @@ func helper_provision_by_bookmark(ctx context.Context, d *schema.ResourceData, m json.Unmarshal([]byte(v.(string)), &appdata_config_params) provisionVDBFromBookmarkParameters.SetAppdataConfigParams(appdata_config_params) } + if v, has_v := d.GetOk("config_params"); has_v { + config_params := make(map[string]interface{}) + json.Unmarshal([]byte(v.(string)), &config_params) + provisionVDBFromBookmarkParameters.SetConfigParams(config_params) + } + if v, has_v := d.GetOk("make_current_account_owner"); has_v { + provisionVDBFromBookmarkParameters.SetMakeCurrentAccountOwner(v.(bool)) + } + if v, has_v := d.GetOk("vcdb_tde_key_identifier"); has_v { + provisionVDBFromBookmarkParameters.SetVcdbTdeKeyIdentifier(v.(string)) + } + if v, has_v := d.GetOk("cdb_tde_keystore_password"); has_v { + provisionVDBFromBookmarkParameters.SetCdbTdeKeystorePassword(v.(string)) + } + if v, has_v := d.GetOk("target_vcdb_tde_keystore_path"); has_v { + provisionVDBFromBookmarkParameters.SetTargetVcdbTdeKeystorePath(v.(string)) + } + if v, has_v := d.GetOk("tde_key_identifier"); has_v { + provisionVDBFromBookmarkParameters.SetTdeKeyIdentifier(v.(string)) + } + if v, has_v := d.GetOk("tde_exported_key_file_secret"); has_v { + provisionVDBFromBookmarkParameters.SetTdeExportedKeyFileSecret(v.(string)) + } + if v, has_v := d.GetOk("parent_tde_keystore_password"); has_v { + provisionVDBFromBookmarkParameters.SetParentTdeKeystorePassword(v.(string)) + } + if v, has_v := d.GetOk("parent_tde_keystore_path"); has_v { + provisionVDBFromBookmarkParameters.SetParentTdeKeystorePath(v.(string)) + } + if v, has_v := d.GetOk("additional_mount_points"); has_v { + provisionVDBFromBookmarkParameters.SetAdditionalMountPoints(toAdditionalMountPointsArray(v)) + } + if v, has_v := d.GetOk("oracle_rac_custom_env_files"); has_v { + provisionVDBFromBookmarkParameters.SetOracleRacCustomEnvFiles(toOracleRacCustomEnvFiles(v)) + } + if v, has_v := d.GetOk("oracle_rac_custom_env_vars"); has_v { + provisionVDBFromBookmarkParameters.SetOracleRacCustomEnvVars(toOracleRacCustomEnvVars(v)) + } req := client.VDBsApi.ProvisionVdbFromBookmark(ctx) @@ -1287,8 +1536,15 @@ func resourceVdbRead(ctx context.Context, d *schema.ResourceData, meta interface d.Set("parent_id", result.GetParentId()) d.Set("group_name", result.GetGroupName()) d.Set("creation_date", result.GetCreationDate().String()) - d.Set("appdata_source_params", result.GetAppdataSourceParams()) - d.Set("appdata_config_params", result.GetAppdataConfigParams()) + + appdata_source_params, _ := json.Marshal(result.GetAppdataSourceParams()) + d.Set("appdata_source_params", string(appdata_source_params)) + appdata_config_params, _ := json.Marshal(result.GetAppdataConfigParams()) + d.Set("appdata_config_params", string(appdata_config_params)) + config_params, _ := json.Marshal(result.GetConfigParams()) + d.Set("config_params", string(config_params)) + d.Set("additional_mount_points", flattenAdditionalMountPoints(result.GetAdditionalMountPoints())) + d.Set("id", vdbId) return diags @@ -1396,6 +1652,39 @@ func resourceVdbUpdate(ctx context.Context, d *schema.ResourceData, meta interfa if d.HasChange("cdc_on_provision") { updateVDBParam.SetCdcOnProvision(d.Get("cdc_on_provision").(bool)) } + if d.HasChange("additional_mount_points") { + updateVDBParam.SetAdditionalMountPoints(toAdditionalMountPointsArray(d.Get("additional_mount_points"))) + } + if d.HasChange("parent_tde_keystore_path") { + updateVDBParam.SetParentTdeKeystorePath(d.Get("parent_tde_keystore_path").(string)) + } + if d.HasChange("parent_tde_keystore_password") { + updateVDBParam.SetParentTdeKeystorePassword(d.Get("parent_tde_keystore_password").(string)) + } + if d.HasChange("tde_key_identifier") { + updateVDBParam.SetTdeKeyIdentifier(d.Get("tde_key_identifier").(string)) + } + if d.HasChange("target_vcdb_tde_keystore_path") { + updateVDBParam.SetTargetVcdbTdeKeystorePath(d.Get("target_vcdb_tde_keystore_path").(string)) + } + if d.HasChange("cdb_tde_keystore_password") { + updateVDBParam.SetCdbTdeKeystorePassword(d.Get("cdb_tde_keystore_password").(string)) + } + if d.HasChange("appdata_source_params") { + appdata_source_params := make(map[string]interface{}) + json.Unmarshal([]byte(d.Get("appdata_source_params").(string)), &appdata_source_params) + updateVDBParam.SetAppdataSourceParams(appdata_source_params) + } + if d.HasChange("appdata_config_params") { + appdata_config_params := make(map[string]interface{}) + json.Unmarshal([]byte(d.Get("appdata_config_params").(string)), &appdata_config_params) + updateVDBParam.SetAppdataConfigParams(appdata_config_params) + } + if d.HasChange("config_params") { + config_params := make(map[string]interface{}) + json.Unmarshal([]byte(d.Get("config_params").(string)), &config_params) + updateVDBParam.SetConfigParams(config_params) + } res, httpRes, err := client.VDBsApi.UpdateVdbById(ctx, d.Get("id").(string)).UpdateVDBParameters(*updateVDBParam).Execute() diff --git a/internal/provider/utility.go b/internal/provider/utility.go index 046c957..b3ba3fc 100644 --- a/internal/provider/utility.go +++ b/internal/provider/utility.go @@ -114,6 +114,21 @@ func flattenHosts(hosts []dctapi.Host) []interface{} { return make([]interface{}, 0) } +func flattenAdditionalMountPoints(additional_mount_points []dctapi.AdditionalMountPoint) []interface{} { + if additional_mount_points != nil { + returned_additional_mount_points := make([]interface{}, len(additional_mount_points)) + for i, additional_mount_point := range additional_mount_points { + returned_additional_mount_point := make(map[string]interface{}) + returned_additional_mount_point["shared_path"] = additional_mount_point.GetSharedPath() + returned_additional_mount_point["mount_path"] = additional_mount_point.GetMountPath() + returned_additional_mount_point["environment_id"] = additional_mount_point.GetEnvironmentId() + returned_additional_mount_points[i] = returned_additional_mount_point + } + return returned_additional_mount_points + } + return make([]interface{}, 0) +} + func apiErrorResponseHelper(res interface{}, httpRes *http.Response, err error) diag.Diagnostics { // Helper function to return Diagnostics object if there is // a failure during API call. From f4e59cf59311a5abbcf6aa4df6e3e9c6bdfa1be9 Mon Sep 17 00:00:00 2001 From: Uddipaan <89963410+Uddipaan-Hazarika@users.noreply.github.com> Date: Sat, 13 May 2023 01:00:03 +0530 Subject: [PATCH 16/25] HUBS-1692 | Added docs for the new params --- docs/resources/vdb.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/docs/resources/vdb.md b/docs/resources/vdb.md index 64dd7c2..dbf732f 100644 --- a/docs/resources/vdb.md +++ b/docs/resources/vdb.md @@ -223,6 +223,42 @@ Environment variable to be set when the engine creates a VDB. See the Engine doc * `key` - (Required) Key of the tag * `value` - (Required) Value of the tag +* `make_current_account_owner` - (Optional) Whether the account provisioning this VDB must be configured as owner of the VDB. + +* `config_params` - (Optional) Database configuration parameter overrides + +* `appdata_source_params` - The JSON payload conforming to the DraftV4 schema based on the type of application data being manipulated. + +* `appdata_config_params` - (Optional) The list of parameters specified by the source config schema in the toolkit + +* `additional_mount_points` - (Optional) Specifies additional locations on which to mount a subdirectory of an AppData container + * `shared_path` - (Required) Relative path within the container of the directory that should be mounted. + * `mount_path` - (Required) Absolute path on the target environment were the filesystem should be mounted + * `environment_id` - (Required) The entity ID of the environment on which the file system will be mounted. + +* `vcdb_tde_key_identifier` - (Optional) ID of the key created by Delphix. (Oracle Multitenant Only) + +* `cdb_tde_keystore_password` - (Optional) The password for the Transparent Data Encryption keystore associated with the CDB. (Oracle Multitenant Only) + +* `target_vcdb_tde_keystore_path` - (Optional) Path to the keystore of the target vCDB. (Oracle Multitenant Only) + +* `tde_key_identifier` - (Optional) ID of the key created by Delphix. (Oracle Multitenant Only) + +* `tde_exported_key_file_secret` - (Optional) Secret to be used while exporting and importing vPDB encryption keys if Transparent Data Encryption is enabled on the vPDB. (Oracle Multitenant Only) + +* `parent_tde_keystore_password` - (Optional) The password of the keystore specified in parentTdeKeystorePath. (Oracle Multitenant Only) + +* `parent_tde_keystore_path` - (Optional) Path to a copy of the parent's Oracle transparent data encryption keystore on the target host. Required to provision from snapshots containing encrypted database files. (Oracle Multitenant Only) + +* `oracle_rac_custom_env_vars` - (Optional) Environment variable to be set when the engine creates an Oracle RAC VDB. See the Engine documentation for the list of allowed/denied environment variables and rules about substitution. + * `node_id` - (Required) The node id of the cluster. + * `name` - (Required) Name of the environment variable + * `value` - (Required) Value of the environment variable. + +* `oracle_rac_custom_env_files` - (Optional) Environment files to be sourced when the Engine creates an Oracle RAC VDB. This path can be followed by parameters. Paths and parameters are separated by spaces. + * `node_id` - (Required) The node id of the cluster. + * `path_parameters` - (Required) This references a file from which certain parameters will be loaded. + ## Attribute Reference From f5802151581955e4b31aa7e342f9a12a4850e6da 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 17/25] 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 51a9159610f4a155f80f9b17e84cac4f1cb02b15 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 18/25] 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 4000a4f1ba907c294574d5d9f93b7aea8f160a32 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 19/25] 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 df13d99918b11a2ee1c07d3b876778be14aa821f 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 20/25] 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 From fe0d353d80cf4173c7dcf4a8782ab5d44bc90a85 Mon Sep 17 00:00:00 2001 From: Uddipaan <89963410+Uddipaan-Hazarika@users.noreply.github.com> Date: Thu, 18 May 2023 01:18:44 +0530 Subject: [PATCH 21/25] HUBS-1562 | Telemetry Support --- internal/provider/provider.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/provider/provider.go b/internal/provider/provider.go index c316a62..4ae52c7 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -86,6 +86,7 @@ func configure(version string, p *schema.Provider) func(context.Context, *schema TLSClientConfig: &tls.Config{InsecureSkipVerify: d.Get("tls_insecure_skip").(bool)}, }} cfg.AddDefaultHeader("Authorization", "apk "+d.Get("key").(string)) + cfg.AddDefaultHeader("x-dct-client-name", "Terraform") client := dctapi.NewAPIClient(cfg) From 543a1aa3ca5e8e67fa1b91c5c922632c064494c9 Mon Sep 17 00:00:00 2001 From: Uddipaan <89963410+Uddipaan-Hazarika@users.noreply.github.com> Date: Thu, 18 May 2023 22:22:12 +0530 Subject: [PATCH 22/25] HUBS-1709 | cluster_node_ids parameter defined as a string whereas DCT takes it as a list of string. --- internal/provider/resource_vdb.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/provider/resource_vdb.go b/internal/provider/resource_vdb.go index 008fb20..922349e 100644 --- a/internal/provider/resource_vdb.go +++ b/internal/provider/resource_vdb.go @@ -96,8 +96,11 @@ func resourceVdb() *schema.Resource { Optional: true, }, "cluster_node_ids": { - Type: schema.TypeString, + Type: schema.TypeList, Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, }, "truncate_log_on_checkpoint": { Type: schema.TypeBool, From a410cb09634228c7bb0a04106bb29cefa99c8596 Mon Sep 17 00:00:00 2001 From: Uddipaan <89963410+Uddipaan-Hazarika@users.noreply.github.com> Date: Fri, 19 May 2023 20:43:09 +0530 Subject: [PATCH 23/25] HUBS-1804 | Dependabot module updates and version bump --- .goreleaser.yml | 2 +- GNUmakefile | 2 +- go.mod | 8 ++++---- go.sum | 24 ++++++++++++++---------- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 9444a8c..2e33716 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,7 +1,7 @@ # Visit https://goreleaser.com for documentation on how to customize this # behavior. env: - - PROVIDER_VERSION=1.0.1 + - PROVIDER_VERSION=2.0.0 before: hooks: # this is just an example and not a requirement for provider building/publishing diff --git a/GNUmakefile b/GNUmakefile index 62b4f27..08efba8 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -3,7 +3,7 @@ HOSTNAME=delphix.com NAMESPACE=dct NAME=delphix BINARY=terraform-provider-${NAME} -VERSION=1.0.1 +VERSION=2.0.0 OS_ARCH=darwin_amd64 default: install diff --git a/go.mod b/go.mod index ea91957..fbdb406 100644 --- a/go.mod +++ b/go.mod @@ -45,9 +45,9 @@ require ( github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect github.com/vmihailenco/tagparser v0.1.1 // indirect github.com/zclconf/go-cty v1.10.0 // indirect - golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect - golang.org/x/text v0.3.7 // indirect + golang.org/x/crypto v0.1.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d // indirect google.golang.org/grpc v1.45.0 // indirect ) @@ -55,7 +55,7 @@ require ( require ( github.com/golang/protobuf v1.5.2 // indirect github.com/hashicorp/terraform-plugin-sdk/v2 v2.12.0 - golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect + golang.org/x/net v0.7.0 // indirect google.golang.org/appengine v1.6.6 // indirect google.golang.org/protobuf v1.27.1 // indirect ) diff --git a/go.sum b/go.sum index 6e7730e..6810d6d 100644 --- a/go.sum +++ b/go.sum @@ -390,10 +390,10 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e h1:gsTQYXdTw2Gq7RBsWvlQ91b+aEQ6bXFUngBGuR8sPpI= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= +golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -459,10 +459,10 @@ golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -516,13 +516,16 @@ golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -530,8 +533,9 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY= -golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= From 028cd7607679068bc2ecfed9554600e4279fc3e8 Mon Sep 17 00:00:00 2001 From: Uddipaan <89963410+Uddipaan-Hazarika@users.noreply.github.com> Date: Thu, 25 May 2023 15:48:32 +0530 Subject: [PATCH 24/25] HUBS-1815 | Terraform - VDB update call fails when appdata_source_params are absent --- internal/provider/resource_vdb.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/provider/resource_vdb.go b/internal/provider/resource_vdb.go index 922349e..4c56351 100644 --- a/internal/provider/resource_vdb.go +++ b/internal/provider/resource_vdb.go @@ -574,6 +574,7 @@ func resourceVdb() *schema.Resource { "appdata_source_params": { Type: schema.TypeString, Optional: true, + Computed: true, }, "appdata_config_params": { Type: schema.TypeString, From f4c3bcf464dadaf0563a0acf5df333d2db976b05 Mon Sep 17 00:00:00 2001 From: Uddipaan <89963410+Uddipaan-Hazarika@users.noreply.github.com> Date: Fri, 26 May 2023 12:54:35 +0530 Subject: [PATCH 25/25] HUBS-1816 | Write acceptance tests for appdata vdb provisioning --- internal/provider/resource_vdb_test.go | 73 ++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/internal/provider/resource_vdb_test.go b/internal/provider/resource_vdb_test.go index ff60484..9f90ff9 100644 --- a/internal/provider/resource_vdb_test.go +++ b/internal/provider/resource_vdb_test.go @@ -62,6 +62,22 @@ func TestAccVdb_bookmark_provision(t *testing.T) { }) } +func TestAccVdb_appdata_provision(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccVdbAppDataPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckVdbDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckDctVDBConfigAppDataBasic(), + Check: resource.ComposeTestCheckFunc( + testAccCheckDctAppDataVdbResourceExists("delphix_vdb.new_appdata"), + resource.TestCheckResourceAttr("delphix_vdb.new_appdata", "parent_id", os.Getenv("APPDATA_DATASOURCE_ID"))), + }, + }, + }) +} + func testAccVdbPreCheck(t *testing.T) { testAccPreCheck(t) if err := os.Getenv("DATASOURCE_ID"); err == "" { @@ -69,6 +85,19 @@ func testAccVdbPreCheck(t *testing.T) { } } +func testAccVdbAppDataPreCheck(t *testing.T) { + testAccPreCheck(t) + if err := os.Getenv("APPDATA_DATASOURCE_ID"); err == "" { + t.Fatal("DATASOURCE_ID must be set for vdb acceptance tests") + } + if err := os.Getenv("APPDATA_SOURCE_PARAMS"); err == "" { + t.Fatal("APPDATA_SOURCE_PARAMS must be set for vdb acceptance tests") + } + if err := os.Getenv("APPDATA_CONFIG_PARAMS"); err == "" { + t.Fatal("APPDATA_CONFIG_PARAMS must be set for vdb acceptance tests") + } +} + func testAccCheckDctVDBConfigBasic() string { datasource_id := os.Getenv("DATASOURCE_ID") return fmt.Sprintf(` @@ -79,6 +108,20 @@ func testAccCheckDctVDBConfigBasic() string { `, datasource_id) } +func testAccCheckDctVDBConfigAppDataBasic() string { + appdata_datasource_id := os.Getenv("APPDATA_DATASOURCE_ID") + appdata_source_params := os.Getenv("APPDATA_SOURCE_PARAMS") + appdata_config_params := os.Getenv("APPDATA_CONFIG_PARAMS") + return fmt.Sprintf(` + resource "delphix_vdb" "new_appdata" { + auto_select_repository = true + source_data_id = "%s" + appdata_source_params = jsonencode(%s) + appdata_config_params = jsonencode(%s) + } + `, appdata_datasource_id, appdata_source_params, appdata_config_params) +} + func testAccCheckDctVDBBookmarkConfigBasic() string { // init client cfg := dctapi.NewConfiguration() @@ -178,6 +221,36 @@ func testAccCheckDctVdbResourceExists(n string) resource.TestCheckFunc { } } +func testAccCheckDctAppDataVdbResourceExists(n string) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + vdbId := rs.Primary.ID + if vdbId == "" { + return fmt.Errorf("No VdbID set") + } + + client := testAccProvider.Meta().(*apiClient).client + + res, _, err := client.VDBsApi.GetVdbById(context.Background(), vdbId).Execute() + + if err != nil { + return err + } + + parentId := res.GetParentId() + if parentId != os.Getenv("APPDATA_DATASOURCE_ID") { + return fmt.Errorf("parentId does not match APPDATA_DATASOURCE_ID") + } + + return nil + } +} + func testAccCheckDctVdbBookmarkResourceExists() resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources["delphix_vdb.vdb_bookmark"]