mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Add randomness to vpn connection test
This commit is contained in:
parent
0aa9d71f7f
commit
fae435c5d8
@ -8,11 +8,13 @@ import (
|
||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||
"github.com/aws/aws-sdk-go/service/ec2"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccAWSVpnConnection_basic(t *testing.T) {
|
||||
rInt := acctest.RandInt()
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
IDRefreshName: "aws_vpn_connection.foo",
|
||||
@ -31,7 +33,7 @@ func TestAccAWSVpnConnection_basic(t *testing.T) {
|
||||
),
|
||||
},
|
||||
{
|
||||
Config: testAccAwsVpnConnectionConfigUpdate,
|
||||
Config: testAccAwsVpnConnectionConfigUpdate(rInt),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccAwsVpnConnection(
|
||||
"aws_vpc.vpc",
|
||||
@ -46,6 +48,7 @@ func TestAccAWSVpnConnection_basic(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAccAWSVpnConnection_withoutStaticRoutes(t *testing.T) {
|
||||
rInt := acctest.RandInt()
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
IDRefreshName: "aws_vpn_connection.foo",
|
||||
@ -53,7 +56,7 @@ func TestAccAWSVpnConnection_withoutStaticRoutes(t *testing.T) {
|
||||
CheckDestroy: testAccAwsVpnConnectionDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccAwsVpnConnectionConfigUpdate,
|
||||
Config: testAccAwsVpnConnectionConfigUpdate(rInt),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccAwsVpnConnection(
|
||||
"aws_vpc.vpc",
|
||||
@ -171,6 +174,9 @@ resource "aws_customer_gateway" "customer_gateway" {
|
||||
bgp_asn = 65000
|
||||
ip_address = "178.0.0.1"
|
||||
type = "ipsec.1"
|
||||
tags {
|
||||
Name = "main-customer-gateway"
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_vpn_connection" "foo" {
|
||||
@ -182,7 +188,8 @@ resource "aws_vpn_connection" "foo" {
|
||||
`
|
||||
|
||||
// Change static_routes_only to be false, forcing a refresh.
|
||||
const testAccAwsVpnConnectionConfigUpdate = `
|
||||
func testAccAwsVpnConnectionConfigUpdate(rInt int) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "aws_vpn_gateway" "vpn_gateway" {
|
||||
tags {
|
||||
Name = "vpn_gateway"
|
||||
@ -193,6 +200,9 @@ resource "aws_customer_gateway" "customer_gateway" {
|
||||
bgp_asn = 65000
|
||||
ip_address = "178.0.0.1"
|
||||
type = "ipsec.1"
|
||||
tags {
|
||||
Name = "main-customer-gateway-%d"
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_vpn_connection" "foo" {
|
||||
@ -201,7 +211,8 @@ resource "aws_vpn_connection" "foo" {
|
||||
type = "ipsec.1"
|
||||
static_routes_only = false
|
||||
}
|
||||
`
|
||||
`, rInt)
|
||||
}
|
||||
|
||||
// Test our VPN tunnel config XML parsing
|
||||
const testAccAwsVpnTunnelInfoXML = `
|
||||
|
Loading…
Reference in New Issue
Block a user