Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# behavior.
version: 2
env:
- PROVIDER_VERSION=4.1.0
- PROVIDER_VERSION=4.1.1
before:
hooks:
# this is just an example and not a requirement for provider building/publishing
Expand Down
2 changes: 1 addition & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ HOSTNAME=delphix.com
NAMESPACE=dct
NAME=delphix
BINARY=terraform-provider-${NAME}
VERSION=4.1.0
VERSION=4.1.1
OS_ARCH=darwin_arm64

default: install
Expand Down
2 changes: 2 additions & 0 deletions internal/provider/commons.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ var updatableEnvKeys = map[string]bool{
"description": true,
"tags": true,
"hosts": true,
"toolkit_path": true,
"ignore_tag_changes": true,
}

Expand All @@ -136,6 +137,7 @@ var isDestructiveEnvUpdate = map[string]bool{
"description": false,
"tags": false,
"hosts": true,
"toolkit_path": false,
"ignore_tag_changes": false,
}

Expand Down
32 changes: 32 additions & 0 deletions internal/provider/resource_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ func resourceEnvironment() *schema.Resource {
"toolkit_path": {
Type: schema.TypeString,
Optional: true,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
// Suppress diff when transitioning from any value to empty/null
// This allows silent migration from top-level toolkit_path to hosts.toolkit_path
if new == "" || new == "null" {
return true
}
// Suppress diff if both old and new are empty/null
return (old == "" || old == "null") && (new == "" || new == "null")
},
},
"username": {
Type: schema.TypeString,
Expand Down Expand Up @@ -204,6 +213,17 @@ func resourceEnvironment() *schema.Resource {
Type: schema.TypeBool,
Default: true,
Optional: true,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
// Don't suppress if user explicitly changed the value in their config
rawConfig := d.GetRawConfig()
if rawConfig.IsKnown() && !rawConfig.IsNull() {
ignoreTagChangesAttr := rawConfig.GetAttr("ignore_tag_changes")
if (ignoreTagChangesAttr.IsNull() || !ignoreTagChangesAttr.IsKnown()) && new == "true" && (old == "" || old == "null" || old == "<null>") {
return true
}
}
return false
},
},
"tags": {
Type: schema.TypeList,
Expand Down Expand Up @@ -562,6 +582,18 @@ func resourceEnvironmentRead(ctx context.Context, d *schema.ResourceData, meta i
// its an import or upgrade, set to default value
d.Set("os_type", "UNIX")
}

// This handles import scenario where parameter is not in config
rawConfig := d.GetRawConfig()
if rawConfig.IsKnown() && !rawConfig.IsNull() {
ignoreTagChangesAttr := rawConfig.GetAttr("ignore_tag_changes")
if ignoreTagChangesAttr.IsNull() || !ignoreTagChangesAttr.IsKnown() {
// Parameter not in config (import scenario) - set default
d.Set("ignore_tag_changes", true)
}
} else {
d.Set("ignore_tag_changes", true)
}

envRes, _ := apiRes.(*dctapi.Environment)
//d.SetId(envRes.GetId())
Expand Down
Loading