terraform: test for interpolation escapes

This commit is contained in:
Mitchell Hashimoto 2016-11-20 21:14:16 -08:00
parent 943b41b90f
commit e7d59ab245
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
2 changed files with 32 additions and 0 deletions

View File

@ -47,6 +47,35 @@ func TestContext2Apply_basic(t *testing.T) {
} }
} }
func TestContext2Apply_escape(t *testing.T) {
m := testModule(t, "apply-escape")
p := testProvider("aws")
p.ApplyFn = testApplyFn
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Module: m,
Providers: map[string]ResourceProviderFactory{
"aws": testProviderFuncFixed(p),
},
})
if _, err := ctx.Plan(); err != nil {
t.Fatalf("err: %s", err)
}
state, err := ctx.Apply()
if err != nil {
t.Fatalf("err: %s", err)
}
checkStateString(t, state, `
aws_instance.bar:
ID = foo
foo = "bar"
type = aws_instance
`)
}
func TestContext2Apply_resourceCountOneList(t *testing.T) { func TestContext2Apply_resourceCountOneList(t *testing.T) {
m := testModule(t, "apply-resource-count-one-list") m := testModule(t, "apply-resource-count-one-list")
p := testProvider("null") p := testProvider("null")

View File

@ -0,0 +1,3 @@
resource "aws_instance" "bar" {
foo = "${"\"bar\""}"
}