From 14ea3a33a42134871cc277074f67aff0302a6c02 Mon Sep 17 00:00:00 2001 From: Christopher Tiwald Date: Sun, 3 May 2015 18:29:42 -0400 Subject: [PATCH 1/4] aws: Fix LB cookie stickiness policy acceptance test. This needs to run in us-west-2 and contained a few syntactical errors that prevented it from working. --- ...ce_aws_lb_cookie_stickiness_policy_test.go | 27 ++++++++----------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/builtin/providers/aws/resource_aws_lb_cookie_stickiness_policy_test.go b/builtin/providers/aws/resource_aws_lb_cookie_stickiness_policy_test.go index 028b0317d..6a43496de 100644 --- a/builtin/providers/aws/resource_aws_lb_cookie_stickiness_policy_test.go +++ b/builtin/providers/aws/resource_aws_lb_cookie_stickiness_policy_test.go @@ -6,11 +6,12 @@ import ( "github.com/awslabs/aws-sdk-go/aws" "github.com/awslabs/aws-sdk-go/service/elb" + "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" ) -func TestAccAWSLBCookieStickinessPolicy(t *testing.T) { +func TestAccAwsLBCookieStickinessPolicy(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, @@ -30,7 +31,7 @@ func TestAccAWSLBCookieStickinessPolicy(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckLBCookieStickinessPolicy( "aws_elb.lb", - "aws_lb_cookie_stickiness_policy.bar", + "aws_lb_cookie_stickiness_policy.foo", ), ), }, @@ -80,7 +81,7 @@ func testAccCheckLBCookieStickinessPolicy(elbResource string, policyResource str const testAccLBCookieStickinessPolicyConfig = ` resource "aws_elb" "lb" { name = "test-lb" - availability_zones = ["us-east-1a"] + availability_zones = ["us-west-2a"] listener { instance_port = 8000 instance_protocol = "http" @@ -90,17 +91,18 @@ resource "aws_elb" "lb" { } resource "aws_lb_cookie_stickiness_policy" "foo" { - name = "foo_policy" - load_balancer = "${aws_elb.lb}" + name = "foo-policy" + load_balancer = "${aws_elb.lb.id}" lb_port = 80 cookie_expiration_period = 600 } ` +// Sets the cookie_expiration_period to 300s. const testAccLBCookieStickinessPolicyConfigUpdate = ` resource "aws_elb" "lb" { name = "test-lb" - availability_zones = ["us-east-1a"] + availability_zones = ["us-west-2a"] listener { instance_port = 8000 instance_protocol = "http" @@ -110,16 +112,9 @@ resource "aws_elb" "lb" { } resource "aws_lb_cookie_stickiness_policy" "foo" { - name = "foo_policy" - load_balancer = "${aws_elb.lb}" + name = "foo-policy" + load_balancer = "${aws_elb.lb.id}" lb_port = 80 - cookie_expiration_period = 600 -} - -resource "aws_lb_cookie_stickiness_policy" "bar" { - name = "bar_policy" - load_balancer = "${aws_elb.lb}" - lb_port = 80 - cookie_expiration_period = 600 + cookie_expiration_period = 300 } ` From f31466a60e41aa2389edda20b49caffcb7bffbd3 Mon Sep 17 00:00:00 2001 From: Christopher Tiwald Date: Sun, 3 May 2015 18:31:58 -0400 Subject: [PATCH 2/4] aws: Fix app cookie stickiness policy acceptance test. This used the wrong AZ and contained a few syntactical errors in configuration. --- ...e_aws_app_cookie_stickiness_policy_test.go | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/builtin/providers/aws/resource_aws_app_cookie_stickiness_policy_test.go b/builtin/providers/aws/resource_aws_app_cookie_stickiness_policy_test.go index 3846fb68e..3e99ab71d 100644 --- a/builtin/providers/aws/resource_aws_app_cookie_stickiness_policy_test.go +++ b/builtin/providers/aws/resource_aws_app_cookie_stickiness_policy_test.go @@ -6,6 +6,7 @@ import ( "github.com/awslabs/aws-sdk-go/aws" "github.com/awslabs/aws-sdk-go/service/elb" + "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" ) @@ -30,7 +31,7 @@ func TestAccAWSAppCookieStickinessPolicy(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckAppCookieStickinessPolicy( "aws_elb.lb", - "aws_app_cookie_stickiness_policy.bar", + "aws_app_cookie_stickiness_policy.foo", ), ), }, @@ -80,7 +81,7 @@ func testAccCheckAppCookieStickinessPolicy(elbResource string, policyResource st const testAccAppCookieStickinessPolicyConfig = ` resource "aws_elb" "lb" { name = "test-lb" - availability_zones = ["us-east-1a"] + availability_zones = ["us-west-2a"] listener { instance_port = 8000 instance_protocol = "http" @@ -90,17 +91,18 @@ resource "aws_elb" "lb" { } resource "aws_app_cookie_stickiness_policy" "foo" { - name = "foo_policy" - load_balancer = "${aws_elb.lb}" + name = "foo-policy" + load_balancer = "${aws_elb.lb.id}" lb_port = 80 cookie_name = "MyAppCookie" } ` +// Change the cookie_name to "MyOtherAppCookie". const testAccAppCookieStickinessPolicyConfigUpdate = ` resource "aws_elb" "lb" { name = "test-lb" - availability_zones = ["us-east-1a"] + availability_zones = ["us-west-2a"] listener { instance_port = 8000 instance_protocol = "http" @@ -110,16 +112,9 @@ resource "aws_elb" "lb" { } resource "aws_app_cookie_stickiness_policy" "foo" { - name = "foo_policy" - load_balancer = "${aws_elb.lb}" + name = "foo-policy" + load_balancer = "${aws_elb.lb.id}" lb_port = 80 - cookie_name = "MyAppCookie" -} - -resource "aws_app_cookie_stickiness_policy" "bar" { - name = "bar_policy" - load_balancer = "${aws_elb.lb}" - lb_port = 80 - cookie_name = "MyAppCookie" + cookie_name = "MyOtherAppCookie" } ` From 47305c9c5d6ef4a8ccabd2cb2b2940eb332ec7a9 Mon Sep 17 00:00:00 2001 From: Christopher Tiwald Date: Sun, 3 May 2015 18:35:01 -0400 Subject: [PATCH 3/4] aws: Fix customer gateway acceptance test. This test contained a few syntactical errors. --- .../aws/resource_aws_customer_gateway_test.go | 43 +++++++++++++------ 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/builtin/providers/aws/resource_aws_customer_gateway_test.go b/builtin/providers/aws/resource_aws_customer_gateway_test.go index 1d64bbd6b..2a51eb112 100644 --- a/builtin/providers/aws/resource_aws_customer_gateway_test.go +++ b/builtin/providers/aws/resource_aws_customer_gateway_test.go @@ -6,6 +6,7 @@ import ( "github.com/awslabs/aws-sdk-go/aws" "github.com/awslabs/aws-sdk-go/service/ec2" + "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" ) @@ -25,10 +26,18 @@ func TestAccCustomerGateway(t *testing.T) { ), }, resource.TestStep{ - Config: testAccCustomerGatewayUpdate, + Config: testAccCustomerGatewayConfigUpdateTags, Check: resource.ComposeTestCheckFunc( testAccCheckCustomerGateway( - "aws_customer_gateway.bar", + "aws_customer_gateway.foo", + ), + ), + }, + resource.TestStep{ + Config: testAccCustomerGatewayConfigForceReplace, + Check: resource.ComposeTestCheckFunc( + testAccCheckCustomerGateway( + "aws_customer_gateway.foo", ), ), }, @@ -82,29 +91,35 @@ const testAccCustomerGatewayConfig = ` resource "aws_customer_gateway" "foo" { bgp_asn = 60000 ip_address = "172.0.0.1" - type = ipsec.1 + type = "ipsec.1" tags { Name = "foo-gateway" } } ` -const testAccCustomerGatewayUpdate = ` +// Add the Another: "tag" tag. +const testAccCustomerGatewayConfigUpdateTags = ` resource "aws_customer_gateway" "foo" { bgp_asn = 60000 ip_address = "172.0.0.1" - type = ipsec.1 - tags { - Name = "foo-gateway" - } -} - -resource "aws_customer_gateway" "bar" { - bgp_asn = 60000 - ip_address = "172.0.0.1" - type = ipsec.1 + type = "ipsec.1" tags { Name = "foo-gateway" + Another = "tag" + } +} +` + +// Change the ip_address. +const testAccCustomerGatewayConfigForceReplace = ` +resource "aws_customer_gateway" "foo" { + bgp_asn = 60000 + ip_address = "172.10.10.1" + type = "ipsec.1" + tags { + Name = "foo-gateway" + Another = "tag" } } ` From 4727260987505e7997f7745fa269a53d2e333656 Mon Sep 17 00:00:00 2001 From: Christopher Tiwald Date: Sun, 3 May 2015 18:40:10 -0400 Subject: [PATCH 4/4] aws: fix VPN connection acceptance test. This corrects syntactical errors and uses distinct IP addresses for each configuration. --- .../aws/resource_aws_vpn_connection_test.go | 34 +++++++------------ .../aws/r/vpn_connection.html.markdown | 2 +- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/builtin/providers/aws/resource_aws_vpn_connection_test.go b/builtin/providers/aws/resource_aws_vpn_connection_test.go index e416606a9..6b61d97e4 100644 --- a/builtin/providers/aws/resource_aws_vpn_connection_test.go +++ b/builtin/providers/aws/resource_aws_vpn_connection_test.go @@ -35,7 +35,7 @@ func TestAccAwsVpnConnection(t *testing.T) { "aws_vpc.vpc", "aws_vpn_gateway.vpn_gateway", "aws_customer_gateway.customer_gateway", - "aws_vpn_connection.bar", + "aws_vpn_connection.foo", ), ), }, @@ -85,18 +85,16 @@ func testAccAwsVpnConnection( } const testAccAwsVpnConnectionConfig = ` -resource "aws_vpc" "vpc" { - cidr_block = "10.0.0.0/16" -} - resource "aws_vpn_gateway" "vpn_gateway" { - vpc_id = "${aws_vpc.vpc.id}" + tags { + Name = "vpn_gateway" + } } resource "aws_customer_gateway" "customer_gateway" { bgp_asn = 60000 - ip_address = "172.0.0.1" - type = ipsec.1 + ip_address = "178.0.0.1" + type = "ipsec.1" } resource "aws_vpn_connection" "foo" { @@ -107,29 +105,21 @@ resource "aws_vpn_connection" "foo" { } ` +// Change static_routes_only to be false, forcing a refresh. const testAccAwsVpnConnectionConfigUpdate = ` -resource "aws_vpc" "vpc" { - cidr_block = "10.0.0.0/16" -} - resource "aws_vpn_gateway" "vpn_gateway" { - vpc_id = "${aws_vpc.vpc.id}" + tags { + Name = "vpn_gateway" + } } resource "aws_customer_gateway" "customer_gateway" { bgp_asn = 60000 - ip_address = "172.0.0.1" - type = ipsec.1 + ip_address = "178.0.0.1" + type = "ipsec.1" } resource "aws_vpn_connection" "foo" { - vpn_gateway_id = "${aws_vpn_gateway.vpn_gateway.id}" - customer_gateway_id = "${aws_customer_gateway.customer_gateway.id}" - type = "ipsec.1" - static_routes_only = true -} - -resource "aws_vpn_connection" "bar" { vpn_gateway_id = "${aws_vpn_gateway.vpn_gateway.id}" customer_gateway_id = "${aws_customer_gateway.customer_gateway.id}" type = "ipsec.1" diff --git a/website/source/docs/providers/aws/r/vpn_connection.html.markdown b/website/source/docs/providers/aws/r/vpn_connection.html.markdown index ce4182cb3..dd4a9ecea 100644 --- a/website/source/docs/providers/aws/r/vpn_connection.html.markdown +++ b/website/source/docs/providers/aws/r/vpn_connection.html.markdown @@ -1,7 +1,7 @@ --- layout: "aws" page_title: "AWS: aws_vpn_connection" -sidebar_current: "docs-aws-vpn-connection" +sidebar_current: "docs-aws-resource-vpn-connection" description: |- Provides a VPN connection connected to a VPC. These objects can be connected to customer gateways, and allow you to establish tunnels between your network and the VPC. ---