|
|
|
|
@ -4150,6 +4150,176 @@ func TestResourceChange_sensitiveVariable(t *testing.T) {
|
|
|
|
|
# so its contents will not be displayed.
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
`,
|
|
|
|
|
},
|
|
|
|
|
"in-place update - value unchanged, sensitivity changes": {
|
|
|
|
|
Action: plans.Update,
|
|
|
|
|
Mode: addrs.ManagedResourceMode,
|
|
|
|
|
Before: cty.ObjectVal(map[string]cty.Value{
|
|
|
|
|
"id": cty.StringVal("i-02ae66f368e8518a9"),
|
|
|
|
|
"ami": cty.StringVal("ami-BEFORE"),
|
|
|
|
|
"special": cty.BoolVal(true),
|
|
|
|
|
"some_number": cty.NumberIntVal(1),
|
|
|
|
|
"list_field": cty.ListVal([]cty.Value{
|
|
|
|
|
cty.StringVal("hello"),
|
|
|
|
|
cty.StringVal("friends"),
|
|
|
|
|
cty.StringVal("!"),
|
|
|
|
|
}),
|
|
|
|
|
"map_key": cty.MapVal(map[string]cty.Value{
|
|
|
|
|
"breakfast": cty.NumberIntVal(800),
|
|
|
|
|
"dinner": cty.NumberIntVal(2000), // sensitive key
|
|
|
|
|
}),
|
|
|
|
|
"map_whole": cty.MapVal(map[string]cty.Value{
|
|
|
|
|
"breakfast": cty.StringVal("pizza"),
|
|
|
|
|
"dinner": cty.StringVal("pizza"),
|
|
|
|
|
}),
|
|
|
|
|
"nested_block": cty.ListVal([]cty.Value{
|
|
|
|
|
cty.ObjectVal(map[string]cty.Value{
|
|
|
|
|
"an_attr": cty.StringVal("secretval"),
|
|
|
|
|
}),
|
|
|
|
|
}),
|
|
|
|
|
"nested_block_set": cty.ListVal([]cty.Value{
|
|
|
|
|
cty.ObjectVal(map[string]cty.Value{
|
|
|
|
|
"an_attr": cty.StringVal("secretval"),
|
|
|
|
|
}),
|
|
|
|
|
}),
|
|
|
|
|
}),
|
|
|
|
|
After: cty.ObjectVal(map[string]cty.Value{
|
|
|
|
|
"id": cty.StringVal("i-02ae66f368e8518a9"),
|
|
|
|
|
"ami": cty.StringVal("ami-BEFORE"),
|
|
|
|
|
"special": cty.BoolVal(true),
|
|
|
|
|
"some_number": cty.NumberIntVal(1),
|
|
|
|
|
"list_field": cty.ListVal([]cty.Value{
|
|
|
|
|
cty.StringVal("hello"),
|
|
|
|
|
cty.StringVal("friends"),
|
|
|
|
|
cty.StringVal("!"),
|
|
|
|
|
}),
|
|
|
|
|
"map_key": cty.MapVal(map[string]cty.Value{
|
|
|
|
|
"breakfast": cty.NumberIntVal(800),
|
|
|
|
|
"dinner": cty.NumberIntVal(2000), // sensitive key
|
|
|
|
|
}),
|
|
|
|
|
"map_whole": cty.MapVal(map[string]cty.Value{
|
|
|
|
|
"breakfast": cty.StringVal("pizza"),
|
|
|
|
|
"dinner": cty.StringVal("pizza"),
|
|
|
|
|
}),
|
|
|
|
|
"nested_block": cty.ListVal([]cty.Value{
|
|
|
|
|
cty.ObjectVal(map[string]cty.Value{
|
|
|
|
|
"an_attr": cty.StringVal("secretval"),
|
|
|
|
|
}),
|
|
|
|
|
}),
|
|
|
|
|
"nested_block_set": cty.ListVal([]cty.Value{
|
|
|
|
|
cty.ObjectVal(map[string]cty.Value{
|
|
|
|
|
"an_attr": cty.StringVal("secretval"),
|
|
|
|
|
}),
|
|
|
|
|
}),
|
|
|
|
|
}),
|
|
|
|
|
BeforeValMarks: []cty.PathValueMarks{
|
|
|
|
|
{
|
|
|
|
|
Path: cty.Path{cty.GetAttrStep{Name: "ami"}},
|
|
|
|
|
Marks: cty.NewValueMarks("sensitive"),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Path: cty.Path{cty.GetAttrStep{Name: "special"}},
|
|
|
|
|
Marks: cty.NewValueMarks("sensitive"),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Path: cty.Path{cty.GetAttrStep{Name: "some_number"}},
|
|
|
|
|
Marks: cty.NewValueMarks("sensitive"),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Path: cty.Path{cty.GetAttrStep{Name: "list_field"}, cty.IndexStep{Key: cty.NumberIntVal(2)}},
|
|
|
|
|
Marks: cty.NewValueMarks("sensitive"),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Path: cty.Path{cty.GetAttrStep{Name: "map_key"}, cty.IndexStep{Key: cty.StringVal("dinner")}},
|
|
|
|
|
Marks: cty.NewValueMarks("sensitive"),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Path: cty.Path{cty.GetAttrStep{Name: "map_whole"}},
|
|
|
|
|
Marks: cty.NewValueMarks("sensitive"),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Path: cty.Path{cty.GetAttrStep{Name: "nested_block"}},
|
|
|
|
|
Marks: cty.NewValueMarks("sensitive"),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Path: cty.Path{cty.GetAttrStep{Name: "nested_block_set"}},
|
|
|
|
|
Marks: cty.NewValueMarks("sensitive"),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
RequiredReplace: cty.NewPathSet(),
|
|
|
|
|
Tainted: false,
|
|
|
|
|
Schema: &configschema.Block{
|
|
|
|
|
Attributes: map[string]*configschema.Attribute{
|
|
|
|
|
"id": {Type: cty.String, Optional: true, Computed: true},
|
|
|
|
|
"ami": {Type: cty.String, Optional: true},
|
|
|
|
|
"list_field": {Type: cty.List(cty.String), Optional: true},
|
|
|
|
|
"special": {Type: cty.Bool, Optional: true},
|
|
|
|
|
"some_number": {Type: cty.Number, Optional: true},
|
|
|
|
|
"map_key": {Type: cty.Map(cty.Number), Optional: true},
|
|
|
|
|
"map_whole": {Type: cty.Map(cty.String), Optional: true},
|
|
|
|
|
},
|
|
|
|
|
BlockTypes: map[string]*configschema.NestedBlock{
|
|
|
|
|
"nested_block": {
|
|
|
|
|
Block: configschema.Block{
|
|
|
|
|
Attributes: map[string]*configschema.Attribute{
|
|
|
|
|
"an_attr": {Type: cty.String, Optional: true},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
Nesting: configschema.NestingList,
|
|
|
|
|
},
|
|
|
|
|
"nested_block_set": {
|
|
|
|
|
Block: configschema.Block{
|
|
|
|
|
Attributes: map[string]*configschema.Attribute{
|
|
|
|
|
"an_attr": {Type: cty.String, Optional: true},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
Nesting: configschema.NestingSet,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
ExpectedOutput: ` # test_instance.example will be updated in-place
|
|
|
|
|
~ resource "test_instance" "example" {
|
|
|
|
|
# Warning: this attribute value will no longer be marked as sensitive
|
|
|
|
|
# after applying this change
|
|
|
|
|
~ ami = (sensitive)
|
|
|
|
|
id = "i-02ae66f368e8518a9"
|
|
|
|
|
~ list_field = [
|
|
|
|
|
# (1 unchanged element hidden)
|
|
|
|
|
"friends",
|
|
|
|
|
- (sensitive),
|
|
|
|
|
+ "!",
|
|
|
|
|
]
|
|
|
|
|
~ map_key = {
|
|
|
|
|
# Warning: this attribute value will no longer be marked as sensitive
|
|
|
|
|
# after applying this change
|
|
|
|
|
~ "dinner" = (sensitive)
|
|
|
|
|
# (1 unchanged element hidden)
|
|
|
|
|
}
|
|
|
|
|
# Warning: this attribute value will no longer be marked as sensitive
|
|
|
|
|
# after applying this change
|
|
|
|
|
~ map_whole = (sensitive)
|
|
|
|
|
# Warning: this attribute value will no longer be marked as sensitive
|
|
|
|
|
# after applying this change
|
|
|
|
|
~ some_number = (sensitive)
|
|
|
|
|
# Warning: this attribute value will no longer be marked as sensitive
|
|
|
|
|
# after applying this change
|
|
|
|
|
~ special = (sensitive)
|
|
|
|
|
|
|
|
|
|
# Warning: this block will no longer be marked as sensitive
|
|
|
|
|
# after applying this change
|
|
|
|
|
~ nested_block {
|
|
|
|
|
# At least one attribute in this block is (or was) sensitive,
|
|
|
|
|
# so its contents will not be displayed.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Warning: this block will no longer be marked as sensitive
|
|
|
|
|
# after applying this change
|
|
|
|
|
~ nested_block_set {
|
|
|
|
|
# At least one attribute in this block is (or was) sensitive,
|
|
|
|
|
# so its contents will not be displayed.
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
`,
|
|
|
|
|
},
|
|
|
|
|
"deletion": {
|
|
|
|
|
|