diff --git a/terraform/context_apply_test.go b/terraform/context_apply_test.go index 52b06a6bf6..c77464a336 100644 --- a/terraform/context_apply_test.go +++ b/terraform/context_apply_test.go @@ -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) { m := testModule(t, "apply-resource-count-one-list") p := testProvider("null") diff --git a/terraform/test-fixtures/apply-escape/main.tf b/terraform/test-fixtures/apply-escape/main.tf new file mode 100644 index 0000000000..bca2c9b7e2 --- /dev/null +++ b/terraform/test-fixtures/apply-escape/main.tf @@ -0,0 +1,3 @@ +resource "aws_instance" "bar" { + foo = "${"\"bar\""}" +}