From 77697b9936c68fdcbe2a3491af3de7fa4ae131a0 Mon Sep 17 00:00:00 2001 From: Jack Pearkes Date: Tue, 29 Jul 2014 19:09:17 -0400 Subject: [PATCH] providers/aws: add failing test for aws region validation cc/ @jorgeng87 --- .../providers/aws/resource_provider_test.go | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/builtin/providers/aws/resource_provider_test.go b/builtin/providers/aws/resource_provider_test.go index eb0fb9b68..d3393caeb 100644 --- a/builtin/providers/aws/resource_provider_test.go +++ b/builtin/providers/aws/resource_provider_test.go @@ -54,6 +54,26 @@ func TestResourceProvider_Configure(t *testing.T) { } } +func TestResourceProvider_ConfigureBadRegion(t *testing.T) { + rp := new(ResourceProvider) + + raw := map[string]interface{}{ + "access_key": "foo", + "secret_key": "bar", + "region": "blah", + } + + rawConfig, err := config.NewRawConfig(raw) + if err != nil { + t.Fatalf("err: %s", err) + } + + err = rp.Configure(terraform.NewResourceConfig(rawConfig)) + if err == nil { + t.Fatalf("should have err: bad region") + } +} + func testAccPreCheck(t *testing.T) { if v := os.Getenv("AWS_ACCESS_KEY"); v == "" { t.Fatal("AWS_ACCESS_KEY must be set for acceptance tests")