terraform: acceptance test for validation error
Add an acceptance test where terraform plan should error due to validation errors.
This commit is contained in:
parent
2bc612e6f8
commit
071d872dc2
|
@ -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) {
|
func TestContextRefresh(t *testing.T) {
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
m := testModule(t, "refresh-basic")
|
m := testModule(t, "refresh-basic")
|
||||||
|
|
|
@ -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"
|
||||||
|
}
|
Loading…
Reference in New Issue