2015-03-05 07:24:14 +01:00
|
|
|
package aws
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"testing"
|
2016-08-16 21:42:06 +02:00
|
|
|
"time"
|
2015-03-05 07:24:14 +01:00
|
|
|
|
2015-06-03 20:36:57 +02:00
|
|
|
"github.com/aws/aws-sdk-go/aws"
|
|
|
|
"github.com/aws/aws-sdk-go/aws/awserr"
|
|
|
|
"github.com/aws/aws-sdk-go/service/ec2"
|
2015-03-05 07:24:14 +01:00
|
|
|
"github.com/hashicorp/terraform/helper/resource"
|
|
|
|
"github.com/hashicorp/terraform/terraform"
|
|
|
|
)
|
|
|
|
|
2015-04-15 17:26:39 +02:00
|
|
|
func TestAccAWSVpnGateway_basic(t *testing.T) {
|
2015-08-17 20:27:16 +02:00
|
|
|
var v, v2 ec2.VpnGateway
|
2015-03-05 07:24:14 +01:00
|
|
|
|
|
|
|
testNotEqual := func(*terraform.State) error {
|
2015-08-17 20:27:16 +02:00
|
|
|
if len(v.VpcAttachments) == 0 {
|
2016-08-07 01:29:51 +02:00
|
|
|
return fmt.Errorf("VPN Gateway A is not attached")
|
2015-03-05 07:24:14 +01:00
|
|
|
}
|
2015-08-17 20:27:16 +02:00
|
|
|
if len(v2.VpcAttachments) == 0 {
|
2016-08-07 01:29:51 +02:00
|
|
|
return fmt.Errorf("VPN Gateway B is not attached")
|
2015-03-05 07:24:14 +01:00
|
|
|
}
|
|
|
|
|
2015-08-17 20:27:16 +02:00
|
|
|
id1 := v.VpcAttachments[0].VpcId
|
|
|
|
id2 := v2.VpcAttachments[0].VpcId
|
2015-03-05 07:24:14 +01:00
|
|
|
if id1 == id2 {
|
|
|
|
return fmt.Errorf("Both attachment IDs are the same")
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
resource.Test(t, resource.TestCase{
|
2016-04-20 21:41:10 +02:00
|
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
|
|
IDRefreshName: "aws_vpn_gateway.foo",
|
|
|
|
Providers: testAccProviders,
|
|
|
|
CheckDestroy: testAccCheckVpnGatewayDestroy,
|
2015-03-05 07:24:14 +01:00
|
|
|
Steps: []resource.TestStep{
|
|
|
|
resource.TestStep{
|
|
|
|
Config: testAccVpnGatewayConfig,
|
|
|
|
Check: resource.ComposeTestCheckFunc(
|
|
|
|
testAccCheckVpnGatewayExists(
|
|
|
|
"aws_vpn_gateway.foo", &v),
|
|
|
|
),
|
|
|
|
},
|
|
|
|
|
|
|
|
resource.TestStep{
|
|
|
|
Config: testAccVpnGatewayConfigChangeVPC,
|
|
|
|
Check: resource.ComposeTestCheckFunc(
|
|
|
|
testAccCheckVpnGatewayExists(
|
|
|
|
"aws_vpn_gateway.foo", &v2),
|
|
|
|
testNotEqual,
|
|
|
|
),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2016-08-16 21:42:06 +02:00
|
|
|
func TestAccAWSVpnGateway_disappears(t *testing.T) {
|
|
|
|
var v ec2.VpnGateway
|
|
|
|
|
|
|
|
resource.Test(t, resource.TestCase{
|
2016-08-22 21:56:07 +02:00
|
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
|
|
Providers: testAccProviders,
|
|
|
|
CheckDestroy: testAccCheckVpnGatewayDestroy,
|
2016-08-16 21:42:06 +02:00
|
|
|
Steps: []resource.TestStep{
|
|
|
|
resource.TestStep{
|
|
|
|
Config: testAccVpnGatewayConfig,
|
|
|
|
Check: resource.ComposeTestCheckFunc(
|
|
|
|
testAccCheckVpnGatewayExists("aws_vpn_gateway.foo", &v),
|
|
|
|
testAccAWSVpnGatewayDisappears(&v),
|
|
|
|
),
|
|
|
|
ExpectNonEmptyPlan: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2016-06-02 19:28:51 +02:00
|
|
|
func TestAccAWSVpnGateway_reattach(t *testing.T) {
|
2016-08-07 01:29:51 +02:00
|
|
|
var vpc1, vpc2 ec2.Vpc
|
|
|
|
var vgw1, vgw2 ec2.VpnGateway
|
2016-06-02 19:28:51 +02:00
|
|
|
|
2016-08-07 01:29:51 +02:00
|
|
|
testAttachmentFunc := func(vgw *ec2.VpnGateway, vpc *ec2.Vpc) func(*terraform.State) error {
|
2016-06-02 19:28:51 +02:00
|
|
|
return func(*terraform.State) error {
|
2016-08-07 01:29:51 +02:00
|
|
|
if len(vgw.VpcAttachments) == 0 {
|
|
|
|
return fmt.Errorf("VPN Gateway %q has no VPC attachments.",
|
|
|
|
*vgw.VpnGatewayId)
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(vgw.VpcAttachments) > 1 {
|
|
|
|
count := 0
|
|
|
|
for _, v := range vgw.VpcAttachments {
|
|
|
|
if *v.State == "attached" {
|
|
|
|
count += 1
|
|
|
|
}
|
2016-06-02 19:28:51 +02:00
|
|
|
}
|
2016-08-07 01:29:51 +02:00
|
|
|
if count > 1 {
|
|
|
|
return fmt.Errorf(
|
|
|
|
"VPN Gateway %q has an unexpected number of VPC attachments (more than 1): %#v",
|
|
|
|
*vgw.VpnGatewayId, vgw.VpcAttachments)
|
2016-06-02 19:28:51 +02:00
|
|
|
}
|
2016-08-07 01:29:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if *vgw.VpcAttachments[0].State != "attached" {
|
|
|
|
return fmt.Errorf("Expected VPN Gateway %q to be attached.",
|
|
|
|
*vgw.VpnGatewayId)
|
|
|
|
}
|
|
|
|
|
|
|
|
if *vgw.VpcAttachments[0].VpcId != *vpc.VpcId {
|
|
|
|
return fmt.Errorf("Expected VPN Gateway %q to be attached to VPC %q, but got: %q",
|
|
|
|
*vgw.VpnGatewayId, *vpc.VpcId, *vgw.VpcAttachments[0].VpcId)
|
2016-06-02 19:28:51 +02:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resource.Test(t, resource.TestCase{
|
|
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
|
|
IDRefreshName: "aws_vpn_gateway.foo",
|
|
|
|
Providers: testAccProviders,
|
|
|
|
CheckDestroy: testAccCheckVpnGatewayDestroy,
|
|
|
|
Steps: []resource.TestStep{
|
|
|
|
resource.TestStep{
|
2016-08-07 01:29:51 +02:00
|
|
|
Config: testAccCheckVpnGatewayConfigReattach,
|
2016-06-02 19:28:51 +02:00
|
|
|
Check: resource.ComposeTestCheckFunc(
|
2016-08-07 01:29:51 +02:00
|
|
|
testAccCheckVpcExists("aws_vpc.foo", &vpc1),
|
|
|
|
testAccCheckVpcExists("aws_vpc.bar", &vpc2),
|
2016-06-02 19:28:51 +02:00
|
|
|
testAccCheckVpnGatewayExists(
|
2016-08-07 01:29:51 +02:00
|
|
|
"aws_vpn_gateway.foo", &vgw1),
|
|
|
|
testAccCheckVpnGatewayExists(
|
|
|
|
"aws_vpn_gateway.bar", &vgw2),
|
|
|
|
testAttachmentFunc(&vgw1, &vpc1),
|
|
|
|
testAttachmentFunc(&vgw2, &vpc2),
|
2016-06-02 19:28:51 +02:00
|
|
|
),
|
|
|
|
},
|
|
|
|
resource.TestStep{
|
2016-08-07 01:29:51 +02:00
|
|
|
Config: testAccCheckVpnGatewayConfigReattachChange,
|
2016-06-02 19:28:51 +02:00
|
|
|
Check: resource.ComposeTestCheckFunc(
|
|
|
|
testAccCheckVpnGatewayExists(
|
2016-08-07 01:29:51 +02:00
|
|
|
"aws_vpn_gateway.foo", &vgw1),
|
|
|
|
testAccCheckVpnGatewayExists(
|
|
|
|
"aws_vpn_gateway.bar", &vgw2),
|
|
|
|
testAttachmentFunc(&vgw2, &vpc1),
|
|
|
|
testAttachmentFunc(&vgw1, &vpc2),
|
2016-06-02 19:28:51 +02:00
|
|
|
),
|
|
|
|
},
|
|
|
|
resource.TestStep{
|
2016-08-07 01:29:51 +02:00
|
|
|
Config: testAccCheckVpnGatewayConfigReattach,
|
2016-06-02 19:28:51 +02:00
|
|
|
Check: resource.ComposeTestCheckFunc(
|
|
|
|
testAccCheckVpnGatewayExists(
|
2016-08-07 01:29:51 +02:00
|
|
|
"aws_vpn_gateway.foo", &vgw1),
|
|
|
|
testAccCheckVpnGatewayExists(
|
|
|
|
"aws_vpn_gateway.bar", &vgw2),
|
|
|
|
testAttachmentFunc(&vgw1, &vpc1),
|
|
|
|
testAttachmentFunc(&vgw2, &vpc2),
|
2016-06-02 19:28:51 +02:00
|
|
|
),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2015-03-05 07:24:14 +01:00
|
|
|
func TestAccAWSVpnGateway_delete(t *testing.T) {
|
2015-08-17 20:27:16 +02:00
|
|
|
var vpnGateway ec2.VpnGateway
|
2015-03-05 07:24:14 +01:00
|
|
|
|
|
|
|
testDeleted := func(r string) resource.TestCheckFunc {
|
|
|
|
return func(s *terraform.State) error {
|
|
|
|
_, ok := s.RootModule().Resources[r]
|
|
|
|
if ok {
|
2016-08-07 01:29:51 +02:00
|
|
|
return fmt.Errorf("VPN Gateway %q should have been deleted.", r)
|
2015-03-05 07:24:14 +01:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resource.Test(t, resource.TestCase{
|
2016-04-20 21:41:10 +02:00
|
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
|
|
IDRefreshName: "aws_vpn_gateway.foo",
|
|
|
|
Providers: testAccProviders,
|
|
|
|
CheckDestroy: testAccCheckVpnGatewayDestroy,
|
2015-03-05 07:24:14 +01:00
|
|
|
Steps: []resource.TestStep{
|
|
|
|
resource.TestStep{
|
|
|
|
Config: testAccVpnGatewayConfig,
|
|
|
|
Check: resource.ComposeTestCheckFunc(
|
|
|
|
testAccCheckVpnGatewayExists("aws_vpn_gateway.foo", &vpnGateway)),
|
|
|
|
},
|
|
|
|
resource.TestStep{
|
|
|
|
Config: testAccNoVpnGatewayConfig,
|
|
|
|
Check: resource.ComposeTestCheckFunc(testDeleted("aws_vpn_gateway.foo")),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2015-07-21 16:42:02 +02:00
|
|
|
func TestAccAWSVpnGateway_tags(t *testing.T) {
|
2015-08-17 20:27:16 +02:00
|
|
|
var v ec2.VpnGateway
|
2015-03-05 07:24:14 +01:00
|
|
|
|
|
|
|
resource.Test(t, resource.TestCase{
|
2016-04-20 21:41:10 +02:00
|
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
|
|
IDRefreshName: "aws_vpn_gateway.foo",
|
|
|
|
Providers: testAccProviders,
|
|
|
|
CheckDestroy: testAccCheckVpnGatewayDestroy,
|
2015-03-05 07:24:14 +01:00
|
|
|
Steps: []resource.TestStep{
|
|
|
|
resource.TestStep{
|
|
|
|
Config: testAccCheckVpnGatewayConfigTags,
|
|
|
|
Check: resource.ComposeTestCheckFunc(
|
|
|
|
testAccCheckVpnGatewayExists("aws_vpn_gateway.foo", &v),
|
2015-05-12 21:58:10 +02:00
|
|
|
testAccCheckTags(&v.Tags, "foo", "bar"),
|
2015-03-05 07:24:14 +01:00
|
|
|
),
|
|
|
|
},
|
|
|
|
resource.TestStep{
|
|
|
|
Config: testAccCheckVpnGatewayConfigTagsUpdate,
|
|
|
|
Check: resource.ComposeTestCheckFunc(
|
|
|
|
testAccCheckVpnGatewayExists("aws_vpn_gateway.foo", &v),
|
2015-05-12 21:58:10 +02:00
|
|
|
testAccCheckTags(&v.Tags, "foo", ""),
|
|
|
|
testAccCheckTags(&v.Tags, "bar", "baz"),
|
2015-03-05 07:24:14 +01:00
|
|
|
),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2016-08-16 21:42:06 +02:00
|
|
|
func testAccAWSVpnGatewayDisappears(gateway *ec2.VpnGateway) resource.TestCheckFunc {
|
|
|
|
return func(s *terraform.State) error {
|
|
|
|
conn := testAccProvider.Meta().(*AWSClient).ec2conn
|
|
|
|
|
|
|
|
_, err := conn.DetachVpnGateway(&ec2.DetachVpnGatewayInput{
|
|
|
|
VpnGatewayId: gateway.VpnGatewayId,
|
|
|
|
VpcId: gateway.VpcAttachments[0].VpcId,
|
|
|
|
})
|
|
|
|
if err != nil {
|
|
|
|
ec2err, ok := err.(awserr.Error)
|
|
|
|
if ok {
|
|
|
|
if ec2err.Code() == "InvalidVpnGatewayID.NotFound" {
|
|
|
|
return nil
|
|
|
|
} else if ec2err.Code() == "InvalidVpnGatewayAttachment.NotFound" {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
opts := &ec2.DeleteVpnGatewayInput{
|
|
|
|
VpnGatewayId: gateway.VpnGatewayId,
|
|
|
|
}
|
|
|
|
if _, err := conn.DeleteVpnGateway(opts); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return resource.Retry(40*time.Minute, func() *resource.RetryError {
|
|
|
|
opts := &ec2.DescribeVpnGatewaysInput{
|
|
|
|
VpnGatewayIds: []*string{gateway.VpnGatewayId},
|
|
|
|
}
|
|
|
|
resp, err := conn.DescribeVpnGateways(opts)
|
|
|
|
if err != nil {
|
|
|
|
cgw, ok := err.(awserr.Error)
|
|
|
|
if ok && cgw.Code() == "InvalidVpnGatewayID.NotFound" {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
if ok && cgw.Code() == "IncorrectState" {
|
|
|
|
return resource.RetryableError(fmt.Errorf(
|
|
|
|
"Waiting for VPN Gateway to be in the correct state: %v", gateway.VpnGatewayId))
|
|
|
|
}
|
|
|
|
return resource.NonRetryableError(
|
|
|
|
fmt.Errorf("Error retrieving VPN Gateway: %s", err))
|
|
|
|
}
|
|
|
|
if *resp.VpnGateways[0].State == "deleted" {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return resource.RetryableError(fmt.Errorf(
|
|
|
|
"Waiting for VPN Gateway: %v", gateway.VpnGatewayId))
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-05 07:24:14 +01:00
|
|
|
func testAccCheckVpnGatewayDestroy(s *terraform.State) error {
|
2015-04-16 22:05:55 +02:00
|
|
|
ec2conn := testAccProvider.Meta().(*AWSClient).ec2conn
|
2015-03-05 07:24:14 +01:00
|
|
|
|
|
|
|
for _, rs := range s.RootModule().Resources {
|
|
|
|
if rs.Type != "aws_vpn_gateway" {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
// Try to find the resource
|
2015-08-17 20:27:16 +02:00
|
|
|
resp, err := ec2conn.DescribeVpnGateways(&ec2.DescribeVpnGatewaysInput{
|
|
|
|
VpnGatewayIds: []*string{aws.String(rs.Primary.ID)},
|
2015-03-10 01:30:29 +01:00
|
|
|
})
|
2015-03-05 07:24:14 +01:00
|
|
|
if err == nil {
|
2016-01-05 23:16:32 +01:00
|
|
|
var v *ec2.VpnGateway
|
|
|
|
for _, g := range resp.VpnGateways {
|
|
|
|
if *g.VpnGatewayId == rs.Primary.ID {
|
|
|
|
v = g
|
|
|
|
}
|
2015-03-05 07:24:14 +01:00
|
|
|
}
|
|
|
|
|
2016-01-05 23:16:32 +01:00
|
|
|
if v == nil {
|
|
|
|
// wasn't found
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
if *v.State != "deleted" {
|
2016-08-07 01:29:51 +02:00
|
|
|
return fmt.Errorf("Expected VPN Gateway to be in deleted state, but was not: %s", v)
|
2016-01-05 23:16:32 +01:00
|
|
|
}
|
2015-03-05 07:24:14 +01:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Verify the error is what we want
|
2015-05-20 13:21:23 +02:00
|
|
|
ec2err, ok := err.(awserr.Error)
|
2015-03-05 07:24:14 +01:00
|
|
|
if !ok {
|
|
|
|
return err
|
|
|
|
}
|
2015-05-20 13:21:23 +02:00
|
|
|
if ec2err.Code() != "InvalidVpnGatewayID.NotFound" {
|
2015-03-05 07:24:14 +01:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2015-08-17 20:27:16 +02:00
|
|
|
func testAccCheckVpnGatewayExists(n string, ig *ec2.VpnGateway) resource.TestCheckFunc {
|
2015-03-05 07:24:14 +01:00
|
|
|
return func(s *terraform.State) error {
|
|
|
|
rs, ok := s.RootModule().Resources[n]
|
|
|
|
if !ok {
|
|
|
|
return fmt.Errorf("Not found: %s", n)
|
|
|
|
}
|
|
|
|
|
|
|
|
if rs.Primary.ID == "" {
|
|
|
|
return fmt.Errorf("No ID is set")
|
|
|
|
}
|
|
|
|
|
2015-04-16 22:05:55 +02:00
|
|
|
ec2conn := testAccProvider.Meta().(*AWSClient).ec2conn
|
2015-08-17 20:27:16 +02:00
|
|
|
resp, err := ec2conn.DescribeVpnGateways(&ec2.DescribeVpnGatewaysInput{
|
|
|
|
VpnGatewayIds: []*string{aws.String(rs.Primary.ID)},
|
2015-03-10 01:30:29 +01:00
|
|
|
})
|
2015-03-05 07:24:14 +01:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2015-08-17 20:27:16 +02:00
|
|
|
if len(resp.VpnGateways) == 0 {
|
2016-08-07 01:29:51 +02:00
|
|
|
return fmt.Errorf("VPN Gateway not found")
|
2015-03-05 07:24:14 +01:00
|
|
|
}
|
|
|
|
|
2015-08-17 20:27:16 +02:00
|
|
|
*ig = *resp.VpnGateways[0]
|
2015-03-05 07:24:14 +01:00
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const testAccNoVpnGatewayConfig = `
|
|
|
|
resource "aws_vpc" "foo" {
|
|
|
|
cidr_block = "10.1.0.0/16"
|
|
|
|
}
|
|
|
|
`
|
|
|
|
|
|
|
|
const testAccVpnGatewayConfig = `
|
|
|
|
resource "aws_vpc" "foo" {
|
|
|
|
cidr_block = "10.1.0.0/16"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_vpn_gateway" "foo" {
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
|
|
|
}
|
|
|
|
`
|
|
|
|
|
|
|
|
const testAccVpnGatewayConfigChangeVPC = `
|
|
|
|
resource "aws_vpc" "bar" {
|
|
|
|
cidr_block = "10.2.0.0/16"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_vpn_gateway" "foo" {
|
|
|
|
vpc_id = "${aws_vpc.bar.id}"
|
|
|
|
}
|
|
|
|
`
|
|
|
|
|
2016-08-07 01:29:51 +02:00
|
|
|
const testAccCheckVpnGatewayConfigTags = `
|
2016-06-02 19:28:51 +02:00
|
|
|
resource "aws_vpc" "foo" {
|
|
|
|
cidr_block = "10.1.0.0/16"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_vpn_gateway" "foo" {
|
2016-08-07 01:29:51 +02:00
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
|
|
|
tags {
|
|
|
|
foo = "bar"
|
|
|
|
}
|
2016-06-02 19:28:51 +02:00
|
|
|
}
|
|
|
|
`
|
|
|
|
|
2016-08-07 01:29:51 +02:00
|
|
|
const testAccCheckVpnGatewayConfigTagsUpdate = `
|
2015-03-05 07:24:14 +01:00
|
|
|
resource "aws_vpc" "foo" {
|
|
|
|
cidr_block = "10.1.0.0/16"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_vpn_gateway" "foo" {
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
|
|
|
tags {
|
2016-08-07 01:29:51 +02:00
|
|
|
bar = "baz"
|
2015-03-05 07:24:14 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
`
|
|
|
|
|
2016-08-07 01:29:51 +02:00
|
|
|
const testAccCheckVpnGatewayConfigReattach = `
|
2015-03-05 07:24:14 +01:00
|
|
|
resource "aws_vpc" "foo" {
|
|
|
|
cidr_block = "10.1.0.0/16"
|
|
|
|
}
|
|
|
|
|
2016-08-07 01:29:51 +02:00
|
|
|
resource "aws_vpc" "bar" {
|
|
|
|
cidr_block = "10.2.0.0/16"
|
|
|
|
}
|
|
|
|
|
2015-03-05 07:24:14 +01:00
|
|
|
resource "aws_vpn_gateway" "foo" {
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
2016-08-07 01:29:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_vpn_gateway" "bar" {
|
|
|
|
vpc_id = "${aws_vpc.bar.id}"
|
|
|
|
}
|
|
|
|
`
|
|
|
|
|
|
|
|
const testAccCheckVpnGatewayConfigReattachChange = `
|
|
|
|
resource "aws_vpc" "foo" {
|
|
|
|
cidr_block = "10.1.0.0/16"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_vpc" "bar" {
|
|
|
|
cidr_block = "10.2.0.0/16"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_vpn_gateway" "foo" {
|
|
|
|
vpc_id = "${aws_vpc.bar.id}"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_vpn_gateway" "bar" {
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
2015-03-05 07:24:14 +01:00
|
|
|
}
|
|
|
|
`
|