Skip to content

Commit

Permalink
Merge pull request #88 from rafaribe/feat/add-masked-flag-to-tf-provider
Browse files Browse the repository at this point in the history
Feat/add masked flag to tf provider
  • Loading branch information
Uddipaan-Hazarika authored Jun 20, 2024
2 parents bb67fed + 390c830 commit cde0fd3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions docs/resources/vdb.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 14 additions & 2 deletions internal/provider/resource_vdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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))
}
Expand Down Expand Up @@ -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))
}
Expand Down Expand Up @@ -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))
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit cde0fd3

Please sign in to comment.