Commit e574f73f authored by James Bardin's avatar James Bardin
Browse files

test with marked, unknown, planned values

parent ea077cbd
Showing with 56 additions and 0 deletions
+56 -0
......@@ -508,3 +508,59 @@ output "out" {
}
}
}
func TestContext2Apply_ignoreImpureFunctionChanges(t *testing.T) {
// Ensure we're not trying to double-mark values decoded from state
m := testModuleInline(t, map[string]string{
"main.tf": `
variable "pw" {
sensitive = true
default = "foo"
}
resource "test_object" "x" {
test_map = {
string = "X${bcrypt(var.pw)}"
}
lifecycle {
ignore_changes = [ test_map["string"] ]
}
}
`,
})
p := simpleMockProvider()
ctx := testContext2(t, &ContextOpts{
Config: m,
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("test"): testProviderFuncFixed(p),
},
})
_, diags := ctx.Plan()
if diags.HasErrors() {
t.Fatal(diags.ErrWithWarnings())
}
_, diags = ctx.Apply()
if diags.HasErrors() {
t.Fatal(diags.ErrWithWarnings())
}
// FINAL PLAN:
plan, diags := ctx.Plan()
if diags.HasErrors() {
t.Fatal(diags.ErrWithWarnings())
}
// make sure the same marks are compared in the next plan as well
for _, c := range plan.Changes.Resources {
if c.Action != plans.NoOp {
t.Logf("marks before: %#v", c.BeforeValMarks)
t.Logf("marks after: %#v", c.AfterValMarks)
t.Errorf("Unexpcetd %s change for %s", c.Action, c.Addr)
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment