Skip to content

Commit

Permalink
found another test case
Browse files Browse the repository at this point in the history
  • Loading branch information
liamcervante committed Apr 20, 2023
1 parent 92336d1 commit 0ec5362
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
42 changes: 42 additions & 0 deletions internal/command/jsonstate/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,48 @@ func TestMarshalResources(t *testing.T) {
},
false,
},
"single resource_with_sensitive": {
map[string]*states.Resource{
"test_thing.baz": {
Addr: addrs.AbsResource{
Resource: addrs.Resource{
Mode: addrs.ManagedResourceMode,
Type: "test_thing",
Name: "bar",
},
},
Instances: map[addrs.InstanceKey]*states.ResourceInstance{
addrs.NoKey: {
Current: &states.ResourceInstanceObjectSrc{
Status: states.ObjectReady,
AttrsJSON: []byte(`{"woozles":"confuzles","foozles":"sensuzles"}`),
},
},
},
ProviderConfig: addrs.AbsProviderConfig{
Provider: addrs.NewDefaultProvider("test"),
Module: addrs.RootModule,
},
},
},
testSchemas(),
[]Resource{
{
Address: "test_thing.bar",
Mode: "managed",
Type: "test_thing",
Name: "bar",
Index: nil,
ProviderName: "registry.terraform.io/hashicorp/test",
AttributeValues: AttributeValues{
"foozles": json.RawMessage(`"sensuzles"`),
"woozles": json.RawMessage(`"confuzles"`),
},
SensitiveValues: json.RawMessage("{\"foozles\":true}"),
},
},
false,
},
"resource with marks": {
map[string]*states.Resource{
"test_thing.bar": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@
"id": "placeheld",
"password": null
},
"sensitive_values": {}
"sensitive_values": {
"password": true
}
},
{
"address": "test_instance.foo",
Expand All @@ -70,7 +72,9 @@
"id": "placeholder",
"password": null
},
"sensitive_values": {}
"sensitive_values": {
"password": true
}
}
]
}
Expand Down

0 comments on commit 0ec5362

Please sign in to comment.