Skip to content

Commit

Permalink
terraform: acceptance test for validation error
Browse files Browse the repository at this point in the history
Add an acceptance test where terraform plan should error due
to validation errors.
  • Loading branch information
ceh committed Jan 13, 2015
1 parent 2bc612e commit 071d872
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
16 changes: 16 additions & 0 deletions terraform/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4148,6 +4148,22 @@ func TestContextPlan_varMultiCountOne(t *testing.T) {
}
}

func TestContextPlan_varListErr(t *testing.T) {
m := testModule(t, "plan-var-list-err")
p := testProvider("aws")
ctx := testContext(t, &ContextOpts{
Module: m,
Providers: map[string]ResourceProviderFactory{
"aws": testProviderFuncFixed(p),
},
})

_, err := ctx.Plan(nil)
if err == nil {
t.Fatal("should error")
}
}

func TestContextRefresh(t *testing.T) {
p := testProvider("aws")
m := testModule(t, "refresh-basic")
Expand Down
16 changes: 16 additions & 0 deletions terraform/test-fixtures/plan-var-list-err/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
provider "aws" {
access_key = "a"
secret_key = "b"
region = "us-east-1"
}

resource "aws_instance" "foo" {
ami = "ami-foo"
instance_type = "t2.micro"
security_groups = "${aws_security_group.foo.name}"
}

resource "aws_security_group" "foo" {
name = "foobar"
description = "foobar"
}

0 comments on commit 071d872

Please sign in to comment.