From 679ad7dbd7725a2bf6ac7d8439e719557930599a Mon Sep 17 00:00:00 2001 From: Rafael Ribeiro Date: Fri, 14 Jun 2024 14:30:14 +0100 Subject: [PATCH 1/4] feat: add masked flag to VDB provisioning --- GNUmakefile | 1 + internal/provider/resource_vdb.go | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index ba5690f..ad3686e 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -13,6 +13,7 @@ build: release: GOOS=darwin GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_darwin_amd64 + GOOS=darwin GOARCH=arm64 go build -o ./bin/${BINARY}_${VERSION}_darwin_arm64 GOOS=freebsd GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_freebsd_386 GOOS=freebsd GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_freebsd_amd64 GOOS=freebsd GOARCH=arm go build -o ./bin/${BINARY}_${VERSION}_freebsd_arm diff --git a/internal/provider/resource_vdb.go b/internal/provider/resource_vdb.go index e09a6e8..6a5e65d 100644 --- a/internal/provider/resource_vdb.go +++ b/internal/provider/resource_vdb.go @@ -3,11 +3,11 @@ package provider import ( "context" "encoding/json" - "github.com/hashicorp/terraform-plugin-log/tflog" "net/http" "time" dctapi "github.com/delphix/dct-sdk-go/v14" + "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -519,6 +519,10 @@ func resourceVdb() *schema.Resource { Type: schema.TypeBool, Optional: true, }, + "masked": { + Type: schema.TypeBool, + Optional: true, + }, "listener_ids": { Type: schema.TypeList, Optional: true, @@ -861,6 +865,9 @@ func helper_provision_by_snapshot(ctx context.Context, d *schema.ResourceData, m if v, has_v := d.GetOkExists("new_dbid"); has_v { provisionVDBBySnapshotParameters.SetNewDbid(v.(bool)) } + if v, has_v := d.GetOkExists("masked"); has_v { + provisionVDBBySnapshotParameters.SetMasked(v.(bool)) + } if v, has_v := d.GetOkExists("listener_ids"); has_v { provisionVDBBySnapshotParameters.SetListenerIds(toStringArray(v)) } @@ -1099,6 +1106,9 @@ func helper_provision_by_timestamp(ctx context.Context, d *schema.ResourceData, if v, has_v := d.GetOkExists("new_dbid"); has_v { provisionVDBByTimestampParameters.SetNewDbid(v.(bool)) } + if v, has_v := d.GetOkExists("masked"); has_v { + provisionVDBByTimestampParameters.SetMasked(v.(bool)) + } if v, has_v := d.GetOk("listener_ids"); has_v { provisionVDBByTimestampParameters.SetListenerIds(toStringArray(v)) } @@ -1340,6 +1350,9 @@ func helper_provision_by_bookmark(ctx context.Context, d *schema.ResourceData, m if v, has_v := d.GetOkExists("new_dbid"); has_v { provisionVDBFromBookmarkParameters.SetNewDbid(v.(bool)) } + if v, has_v := d.GetOkExists("masked"); has_v { + provisionVDBFromBookmarkParameters.SetMasked(v.(bool)) + } if v, has_v := d.GetOk("listener_ids"); has_v { provisionVDBFromBookmarkParameters.SetListenerIds(toStringArray(v)) } @@ -1549,7 +1562,6 @@ func resourceVdbRead(ctx context.Context, d *schema.ResourceData, meta interface 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 From 390c830fbb0277fb3a63c7ea31a0e2fb37965722 Mon Sep 17 00:00:00 2001 From: Rafael Ribeiro Date: Fri, 14 Jun 2024 16:44:03 +0100 Subject: [PATCH 2/4] docs: add documentation for the masked flag on the vdb --- docs/resources/vdb.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/resources/vdb.md b/docs/resources/vdb.md index b6c7c60..2291469 100644 --- a/docs/resources/vdb.md +++ b/docs/resources/vdb.md @@ -202,6 +202,9 @@ resource "delphix_vdb" "vdb_name" { * `new_dbid` - (Optional) [Updatable] Option to generate a new DB ID for the created VDB (Oracle Only). +* `masked` - (Optional) Option to create a Masked VDB. Note: You should define a `configure_clone` script in the Hooks step to mask the dataset. The selection of the "Mask this VDB" option will cause the data to be marked as masked, whether you have defined a script to do so or not. +If you do not define a script to mask the dataset, the data will not be masked unless there is a masking job associated with the source dataset. + * `listener_ids` - (Optional) [Updatable] The listener IDs for this provision operation (Oracle Only). This is a list of listener ids. For eg: [ "listener-123", "listener-456" ] * `custom_env_vars` - (Optional) From 6ccd4508e3731f891de4c933b297b6150015b229 Mon Sep 17 00:00:00 2001 From: Uddipaan <89963410+Uddipaan-Hazarika@users.noreply.github.com> Date: Mon, 24 Jun 2024 21:09:56 +0530 Subject: [PATCH 3/4] HUBS-2448 | Add masked field in non updatable param. --- 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 6a5e65d..44b8a5d 100644 --- a/internal/provider/resource_vdb.go +++ b/internal/provider/resource_vdb.go @@ -1612,6 +1612,7 @@ func resourceVdbUpdate(ctx context.Context, d *schema.ResourceData, meta interfa "oracle_instance_name", "unique_name", "mount_point", + "masked", "open_reset_logs", "snapshot_policy_id", "retention_policy_id", From c90083459435256cbb92ac476be7ff6775119234 Mon Sep 17 00:00:00 2001 From: Uddipaan <89963410+Uddipaan-Hazarika@users.noreply.github.com> Date: Mon, 24 Jun 2024 21:17:37 +0530 Subject: [PATCH 4/4] HUBS-2448 | Add masked field in non updatable param. --- GNUmakefile | 2 +- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index ad3686e..209a97b 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -3,7 +3,7 @@ HOSTNAME=delphix.com NAMESPACE=dct NAME=delphix BINARY=terraform-provider-${NAME} -VERSION=3.2.2 +VERSION=3.2.3 OS_ARCH=darwin_amd64 default: install diff --git a/go.mod b/go.mod index 250c34f..267684f 100644 --- a/go.mod +++ b/go.mod @@ -57,7 +57,7 @@ require ( github.com/golang/protobuf v1.5.3 // indirect github.com/kr/pretty v0.2.1 // indirect github.com/kr/text v0.2.0 // indirect - golang.org/x/net v0.21.0 // indirect + golang.org/x/net v0.23.0 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/protobuf v1.33.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect diff --git a/go.sum b/go.sum index 5af325e..7810a1a 100644 --- a/go.sum +++ b/go.sum @@ -158,8 +158,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=