Skip to content

Commit cde0fd3

Browse files
Merge pull request #88 from rafaribe/feat/add-masked-flag-to-tf-provider
Feat/add masked flag to tf provider
2 parents bb67fed + 390c830 commit cde0fd3

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

GNUmakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ build:
1313

1414
release:
1515
GOOS=darwin GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_darwin_amd64
16+
GOOS=darwin GOARCH=arm64 go build -o ./bin/${BINARY}_${VERSION}_darwin_arm64
1617
GOOS=freebsd GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_freebsd_386
1718
GOOS=freebsd GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_freebsd_amd64
1819
GOOS=freebsd GOARCH=arm go build -o ./bin/${BINARY}_${VERSION}_freebsd_arm

docs/resources/vdb.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ resource "delphix_vdb" "vdb_name" {
202202

203203
* `new_dbid` - (Optional) [Updatable] Option to generate a new DB ID for the created VDB (Oracle Only).
204204

205+
* `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.
206+
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.
207+
205208
* `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" ]
206209

207210
* `custom_env_vars` - (Optional)

internal/provider/resource_vdb.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ package provider
33
import (
44
"context"
55
"encoding/json"
6-
"github.com/hashicorp/terraform-plugin-log/tflog"
76
"net/http"
87
"time"
98

109
dctapi "github.com/delphix/dct-sdk-go/v14"
10+
"github.com/hashicorp/terraform-plugin-log/tflog"
1111
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
1212
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1313
)
@@ -519,6 +519,10 @@ func resourceVdb() *schema.Resource {
519519
Type: schema.TypeBool,
520520
Optional: true,
521521
},
522+
"masked": {
523+
Type: schema.TypeBool,
524+
Optional: true,
525+
},
522526
"listener_ids": {
523527
Type: schema.TypeList,
524528
Optional: true,
@@ -861,6 +865,9 @@ func helper_provision_by_snapshot(ctx context.Context, d *schema.ResourceData, m
861865
if v, has_v := d.GetOkExists("new_dbid"); has_v {
862866
provisionVDBBySnapshotParameters.SetNewDbid(v.(bool))
863867
}
868+
if v, has_v := d.GetOkExists("masked"); has_v {
869+
provisionVDBBySnapshotParameters.SetMasked(v.(bool))
870+
}
864871
if v, has_v := d.GetOkExists("listener_ids"); has_v {
865872
provisionVDBBySnapshotParameters.SetListenerIds(toStringArray(v))
866873
}
@@ -1099,6 +1106,9 @@ func helper_provision_by_timestamp(ctx context.Context, d *schema.ResourceData,
10991106
if v, has_v := d.GetOkExists("new_dbid"); has_v {
11001107
provisionVDBByTimestampParameters.SetNewDbid(v.(bool))
11011108
}
1109+
if v, has_v := d.GetOkExists("masked"); has_v {
1110+
provisionVDBByTimestampParameters.SetMasked(v.(bool))
1111+
}
11021112
if v, has_v := d.GetOk("listener_ids"); has_v {
11031113
provisionVDBByTimestampParameters.SetListenerIds(toStringArray(v))
11041114
}
@@ -1340,6 +1350,9 @@ func helper_provision_by_bookmark(ctx context.Context, d *schema.ResourceData, m
13401350
if v, has_v := d.GetOkExists("new_dbid"); has_v {
13411351
provisionVDBFromBookmarkParameters.SetNewDbid(v.(bool))
13421352
}
1353+
if v, has_v := d.GetOkExists("masked"); has_v {
1354+
provisionVDBFromBookmarkParameters.SetMasked(v.(bool))
1355+
}
13431356
if v, has_v := d.GetOk("listener_ids"); has_v {
13441357
provisionVDBFromBookmarkParameters.SetListenerIds(toStringArray(v))
13451358
}
@@ -1549,7 +1562,6 @@ func resourceVdbRead(ctx context.Context, d *schema.ResourceData, meta interface
15491562
config_params, _ := json.Marshal(result.GetConfigParams())
15501563
d.Set("config_params", string(config_params))
15511564
d.Set("additional_mount_points", flattenAdditionalMountPoints(result.GetAdditionalMountPoints()))
1552-
15531565
d.Set("id", vdbId)
15541566

15551567
return diags

0 commit comments

Comments
 (0)