Skip to content

Commit 0c249e6

Browse files
committed
unmark object ID or Name for formatting
1 parent 8407ce7 commit 0c249e6

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

internal/command/format/object_id.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ func ObjectValueID(obj cty.Value) (k, v string) {
2424
return "", ""
2525
}
2626

27+
obj, _ = obj.UnmarkDeep()
2728
atys := obj.Type().AttributeTypes()
2829

2930
switch {
@@ -71,6 +72,7 @@ func ObjectValueName(obj cty.Value) (k, v string) {
7172
return "", ""
7273
}
7374

75+
obj, _ = obj.UnmarkDeep()
7476
atys := obj.Type().AttributeTypes()
7577

7678
switch {

internal/command/format/object_id_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"testing"
66

7+
"github.com/hashicorp/terraform/internal/lang/marks"
78
"github.com/zclconf/go-cty/cty"
89
)
910

@@ -51,7 +52,7 @@ func TestObjectValueIDOrName(t *testing.T) {
5152
},
5253
{
5354
cty.ObjectVal(map[string]cty.Value{
54-
"name": cty.StringVal("awesome-foo"),
55+
"name": cty.StringVal("awesome-foo").Mark(marks.Sensitive),
5556
}),
5657
[...]string{"name", "awesome-foo"},
5758
[...]string{"name", "awesome-foo"},
@@ -154,7 +155,7 @@ func TestObjectValueIDOrName(t *testing.T) {
154155
{
155156
cty.ObjectVal(map[string]cty.Value{
156157
"tags": cty.MapVal(map[string]cty.Value{
157-
"Name": cty.UnknownVal(cty.String),
158+
"Name": cty.UnknownVal(cty.String).Mark(marks.Sensitive),
158159
}),
159160
}),
160161
[...]string{"", ""},

0 commit comments

Comments
 (0)