@@ -6974,7 +6974,7 @@ func TestContext2Plan_variableCustomValidationsCrossRef(t *testing.T) {
69746974 }
69756975}
69766976
6977- func TestContext2Plan_variableCustomValidationsSensitive (t * testing.T ) {
6977+ func TestContext2Plan_variableCustomValidationsChildSensitive (t * testing.T ) {
69786978 m := testModule (t , "validate-variable-custom-validations-child-sensitive" )
69796979
69806980 p := testProvider ("test" )
@@ -6993,6 +6993,39 @@ func TestContext2Plan_variableCustomValidationsSensitive(t *testing.T) {
69936993 }
69946994}
69956995
6996+ func TestContext2Plan_variableCustomValidationsSensitive (t * testing.T ) {
6997+ m := testModule (t , "validate-variable-custom-validations-sensitive" )
6998+
6999+ p := testProvider ("test" )
7000+ ctx := testContext2 (t , & ContextOpts {
7001+ Providers : map [addrs.Provider ]providers.Factory {
7002+ addrs .NewDefaultProvider ("test" ): testProviderFuncFixed (p ),
7003+ },
7004+ })
7005+
7006+ _ , diags := ctx .Plan (m , states .NewState (), SimplePlanOpts (plans .NormalMode , InputValues {
7007+ "input" : {
7008+ Value : cty .StringVal ("short" ),
7009+ },
7010+ }))
7011+ if len (diags ) != 1 {
7012+ t .Fatal ("wanted exactly one error" )
7013+ }
7014+ if diff := cmp .Diff (diags [0 ].Description (), tfdiags.Description {
7015+ Summary : "Invalid value for variable" ,
7016+ Detail : "too short\n \n This was checked by the validation rule at testdata/validate-variable-custom-validations-sensitive/validate-variable-custom-validations-sensitive.tf:4,3-13." ,
7017+ }); len (diff ) > 0 {
7018+ t .Error (diff )
7019+ }
7020+
7021+ vars := diags [0 ].FromExpr ().EvalContext .Variables ["var" ].AsValueMap ()
7022+
7023+ _ , ms := vars ["input" ].Unmark ()
7024+ if _ , ok := ms [marks .Sensitive ]; ! ok {
7025+ t .Error ("should have been marked as sensitive" )
7026+ }
7027+ }
7028+
69967029func TestContext2Plan_nullOutputNoOp (t * testing.T ) {
69977030 // this should always plan a NoOp change for the output
69987031 m := testModuleInline (t , map [string ]string {
0 commit comments