Merge pull request #13135 from hashicorp/p-aws-randomize-test-names
P aws randomize test names
This commit is contained in:
commit
d20783d2e5
|
@ -3,19 +3,20 @@ package aws
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform/helper/acctest"
|
||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccAWSCustomerGateway_importBasic(t *testing.T) {
|
func TestAccAWSCustomerGateway_importBasic(t *testing.T) {
|
||||||
resourceName := "aws_customer_gateway.foo"
|
resourceName := "aws_customer_gateway.foo"
|
||||||
|
randInt := acctest.RandInt()
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
Providers: testAccProviders,
|
Providers: testAccProviders,
|
||||||
CheckDestroy: testAccCheckCustomerGatewayDestroy,
|
CheckDestroy: testAccCheckCustomerGatewayDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
resource.TestStep{
|
resource.TestStep{
|
||||||
Config: testAccCustomerGatewayConfig,
|
Config: testAccCustomerGatewayConfig(randInt),
|
||||||
},
|
},
|
||||||
|
|
||||||
resource.TestStep{
|
resource.TestStep{
|
||||||
|
|
|
@ -3,11 +3,13 @@ package aws
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform/helper/acctest"
|
||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccAWSEFSFileSystem_importBasic(t *testing.T) {
|
func TestAccAWSEFSFileSystem_importBasic(t *testing.T) {
|
||||||
resourceName := "aws_efs_file_system.foo-with-tags"
|
resourceName := "aws_efs_file_system.foo-with-tags"
|
||||||
|
rInt := acctest.RandInt()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
@ -15,7 +17,7 @@ func TestAccAWSEFSFileSystem_importBasic(t *testing.T) {
|
||||||
CheckDestroy: testAccCheckEfsFileSystemDestroy,
|
CheckDestroy: testAccCheckEfsFileSystemDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
resource.TestStep{
|
resource.TestStep{
|
||||||
Config: testAccAWSEFSFileSystemConfigWithTags,
|
Config: testAccAWSEFSFileSystemConfigWithTags(rInt),
|
||||||
},
|
},
|
||||||
|
|
||||||
resource.TestStep{
|
resource.TestStep{
|
||||||
|
|
|
@ -10,12 +10,14 @@ import (
|
||||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform/helper/acctest"
|
||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
"github.com/hashicorp/terraform/terraform"
|
"github.com/hashicorp/terraform/terraform"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccAWSCustomerGateway_basic(t *testing.T) {
|
func TestAccAWSCustomerGateway_basic(t *testing.T) {
|
||||||
var gateway ec2.CustomerGateway
|
var gateway ec2.CustomerGateway
|
||||||
|
randInt := acctest.RandInt()
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
IDRefreshName: "aws_customer_gateway.foo",
|
IDRefreshName: "aws_customer_gateway.foo",
|
||||||
|
@ -23,19 +25,19 @@ func TestAccAWSCustomerGateway_basic(t *testing.T) {
|
||||||
CheckDestroy: testAccCheckCustomerGatewayDestroy,
|
CheckDestroy: testAccCheckCustomerGatewayDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccCustomerGatewayConfig,
|
Config: testAccCustomerGatewayConfig(randInt),
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
testAccCheckCustomerGateway("aws_customer_gateway.foo", &gateway),
|
testAccCheckCustomerGateway("aws_customer_gateway.foo", &gateway),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Config: testAccCustomerGatewayConfigUpdateTags,
|
Config: testAccCustomerGatewayConfigUpdateTags(randInt),
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
testAccCheckCustomerGateway("aws_customer_gateway.foo", &gateway),
|
testAccCheckCustomerGateway("aws_customer_gateway.foo", &gateway),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Config: testAccCustomerGatewayConfigForceReplace,
|
Config: testAccCustomerGatewayConfigForceReplace(randInt),
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
testAccCheckCustomerGateway("aws_customer_gateway.foo", &gateway),
|
testAccCheckCustomerGateway("aws_customer_gateway.foo", &gateway),
|
||||||
),
|
),
|
||||||
|
@ -46,6 +48,7 @@ func TestAccAWSCustomerGateway_basic(t *testing.T) {
|
||||||
|
|
||||||
func TestAccAWSCustomerGateway_similarAlreadyExists(t *testing.T) {
|
func TestAccAWSCustomerGateway_similarAlreadyExists(t *testing.T) {
|
||||||
var gateway ec2.CustomerGateway
|
var gateway ec2.CustomerGateway
|
||||||
|
randInt := acctest.RandInt()
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
IDRefreshName: "aws_customer_gateway.foo",
|
IDRefreshName: "aws_customer_gateway.foo",
|
||||||
|
@ -53,13 +56,13 @@ func TestAccAWSCustomerGateway_similarAlreadyExists(t *testing.T) {
|
||||||
CheckDestroy: testAccCheckCustomerGatewayDestroy,
|
CheckDestroy: testAccCheckCustomerGatewayDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccCustomerGatewayConfig,
|
Config: testAccCustomerGatewayConfig(randInt),
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
testAccCheckCustomerGateway("aws_customer_gateway.foo", &gateway),
|
testAccCheckCustomerGateway("aws_customer_gateway.foo", &gateway),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Config: testAccCustomerGatewayConfigIdentical,
|
Config: testAccCustomerGatewayConfigIdentical(randInt),
|
||||||
ExpectError: regexp.MustCompile("An existing customer gateway"),
|
ExpectError: regexp.MustCompile("An existing customer gateway"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -68,13 +71,14 @@ func TestAccAWSCustomerGateway_similarAlreadyExists(t *testing.T) {
|
||||||
|
|
||||||
func TestAccAWSCustomerGateway_disappears(t *testing.T) {
|
func TestAccAWSCustomerGateway_disappears(t *testing.T) {
|
||||||
var gateway ec2.CustomerGateway
|
var gateway ec2.CustomerGateway
|
||||||
|
randInt := acctest.RandInt()
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
Providers: testAccProviders,
|
Providers: testAccProviders,
|
||||||
CheckDestroy: testAccCheckCustomerGatewayDestroy,
|
CheckDestroy: testAccCheckCustomerGatewayDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccCustomerGatewayConfig,
|
Config: testAccCustomerGatewayConfig(randInt),
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
testAccCheckCustomerGateway("aws_customer_gateway.foo", &gateway),
|
testAccCheckCustomerGateway("aws_customer_gateway.foo", &gateway),
|
||||||
testAccAWSCustomerGatewayDisappears(&gateway),
|
testAccAWSCustomerGatewayDisappears(&gateway),
|
||||||
|
@ -190,59 +194,67 @@ func testAccCheckCustomerGateway(gatewayResource string, cgw *ec2.CustomerGatewa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const testAccCustomerGatewayConfig = `
|
func testAccCustomerGatewayConfig(randInt int) string {
|
||||||
resource "aws_customer_gateway" "foo" {
|
return fmt.Sprintf(`
|
||||||
bgp_asn = 65000
|
resource "aws_customer_gateway" "foo" {
|
||||||
ip_address = "172.0.0.1"
|
bgp_asn = 65000
|
||||||
type = "ipsec.1"
|
ip_address = "172.0.0.1"
|
||||||
tags {
|
type = "ipsec.1"
|
||||||
Name = "foo-gateway"
|
tags {
|
||||||
}
|
Name = "foo-gateway-%d"
|
||||||
}
|
}
|
||||||
`
|
|
||||||
|
|
||||||
const testAccCustomerGatewayConfigIdentical = `
|
|
||||||
resource "aws_customer_gateway" "foo" {
|
|
||||||
bgp_asn = 65000
|
|
||||||
ip_address = "172.0.0.1"
|
|
||||||
type = "ipsec.1"
|
|
||||||
tags {
|
|
||||||
Name = "foo-gateway"
|
|
||||||
}
|
}
|
||||||
|
`, randInt)
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_customer_gateway" "identical" {
|
func testAccCustomerGatewayConfigIdentical(randInt int) string {
|
||||||
bgp_asn = 65000
|
return fmt.Sprintf(`
|
||||||
ip_address = "172.0.0.1"
|
resource "aws_customer_gateway" "foo" {
|
||||||
type = "ipsec.1"
|
bgp_asn = 65000
|
||||||
tags {
|
ip_address = "172.0.0.1"
|
||||||
Name = "foo-gateway-identical"
|
type = "ipsec.1"
|
||||||
}
|
tags {
|
||||||
|
Name = "foo-gateway-%d"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_customer_gateway" "identical" {
|
||||||
|
bgp_asn = 65000
|
||||||
|
ip_address = "172.0.0.1"
|
||||||
|
type = "ipsec.1"
|
||||||
|
tags {
|
||||||
|
Name = "foo-gateway-identical-%d"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`, randInt, randInt)
|
||||||
}
|
}
|
||||||
`
|
|
||||||
|
|
||||||
// Add the Another: "tag" tag.
|
// Add the Another: "tag" tag.
|
||||||
const testAccCustomerGatewayConfigUpdateTags = `
|
func testAccCustomerGatewayConfigUpdateTags(randInt int) string {
|
||||||
resource "aws_customer_gateway" "foo" {
|
return fmt.Sprintf(`
|
||||||
bgp_asn = 65000
|
resource "aws_customer_gateway" "foo" {
|
||||||
ip_address = "172.0.0.1"
|
bgp_asn = 65000
|
||||||
type = "ipsec.1"
|
ip_address = "172.0.0.1"
|
||||||
tags {
|
type = "ipsec.1"
|
||||||
Name = "foo-gateway"
|
tags {
|
||||||
Another = "tag"
|
Name = "foo-gateway-%d"
|
||||||
}
|
Another = "tag-%d"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`, randInt, randInt)
|
||||||
}
|
}
|
||||||
`
|
|
||||||
|
|
||||||
// Change the ip_address.
|
// Change the ip_address.
|
||||||
const testAccCustomerGatewayConfigForceReplace = `
|
func testAccCustomerGatewayConfigForceReplace(randInt int) string {
|
||||||
resource "aws_customer_gateway" "foo" {
|
return fmt.Sprintf(`
|
||||||
bgp_asn = 65000
|
resource "aws_customer_gateway" "foo" {
|
||||||
ip_address = "172.10.10.1"
|
bgp_asn = 65000
|
||||||
type = "ipsec.1"
|
ip_address = "172.10.10.1"
|
||||||
tags {
|
type = "ipsec.1"
|
||||||
Name = "foo-gateway"
|
tags {
|
||||||
Another = "tag"
|
Name = "foo-gateway-%d"
|
||||||
|
Another = "tag-%d"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
`, randInt, randInt)
|
||||||
}
|
}
|
||||||
`
|
|
||||||
|
|
|
@ -169,7 +169,7 @@ resource "aws_dms_replication_instance" "dms_replication_instance" {
|
||||||
func dmsReplicationInstanceConfigUpdate(randId string) string {
|
func dmsReplicationInstanceConfigUpdate(randId string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "aws_iam_role" "dms_iam_role" {
|
resource "aws_iam_role" "dms_iam_role" {
|
||||||
name = "dms-vpc-role"
|
name = "dms-vpc-role-%[1]s"
|
||||||
assume_role_policy = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"dms.amazonaws.com\"},\"Action\":\"sts:AssumeRole\"}]}"
|
assume_role_policy = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"dms.amazonaws.com\"},\"Action\":\"sts:AssumeRole\"}]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ func dmsReplicationSubnetGroupDestroy(s *terraform.State) error {
|
||||||
func dmsReplicationSubnetGroupConfig(randId string) string {
|
func dmsReplicationSubnetGroupConfig(randId string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "aws_iam_role" "dms_iam_role" {
|
resource "aws_iam_role" "dms_iam_role" {
|
||||||
name = "dms-vpc-role"
|
name = "dms-vpc-role-%[1]s"
|
||||||
assume_role_policy = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"dms.amazonaws.com\"},\"Action\":\"sts:AssumeRole\"}]}"
|
assume_role_policy = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"dms.amazonaws.com\"},\"Action\":\"sts:AssumeRole\"}]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ func dmsReplicationTaskDestroy(s *terraform.State) error {
|
||||||
func dmsReplicationTaskConfig(randId string) string {
|
func dmsReplicationTaskConfig(randId string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "aws_iam_role" "dms_iam_role" {
|
resource "aws_iam_role" "dms_iam_role" {
|
||||||
name = "dms-vpc-role"
|
name = "dms-vpc-role-%[1]s"
|
||||||
assume_role_policy = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"dms.amazonaws.com\"},\"Action\":\"sts:AssumeRole\"}]}"
|
assume_role_policy = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"dms.amazonaws.com\"},\"Action\":\"sts:AssumeRole\"}]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,7 @@ func TestResourceAWSEFSFileSystem_hasEmptyFileSystems(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAccAWSEFSFileSystem_basic(t *testing.T) {
|
func TestAccAWSEFSFileSystem_basic(t *testing.T) {
|
||||||
|
rInt := acctest.RandInt()
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
Providers: testAccProviders,
|
Providers: testAccProviders,
|
||||||
|
@ -104,7 +105,7 @@ func TestAccAWSEFSFileSystem_basic(t *testing.T) {
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Config: testAccAWSEFSFileSystemConfigWithTags,
|
Config: testAccAWSEFSFileSystemConfigWithTags(rInt),
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
testAccCheckEfsFileSystem(
|
testAccCheckEfsFileSystem(
|
||||||
"aws_efs_file_system.foo-with-tags",
|
"aws_efs_file_system.foo-with-tags",
|
||||||
|
@ -116,7 +117,7 @@ func TestAccAWSEFSFileSystem_basic(t *testing.T) {
|
||||||
testAccCheckEfsFileSystemTags(
|
testAccCheckEfsFileSystemTags(
|
||||||
"aws_efs_file_system.foo-with-tags",
|
"aws_efs_file_system.foo-with-tags",
|
||||||
map[string]string{
|
map[string]string{
|
||||||
"Name": "foo-efs",
|
"Name": fmt.Sprintf("foo-efs-%d", rInt),
|
||||||
"Another": "tag",
|
"Another": "tag",
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -143,13 +144,14 @@ func TestAccAWSEFSFileSystem_basic(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAccAWSEFSFileSystem_pagedTags(t *testing.T) {
|
func TestAccAWSEFSFileSystem_pagedTags(t *testing.T) {
|
||||||
|
rInt := acctest.RandInt()
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
Providers: testAccProviders,
|
Providers: testAccProviders,
|
||||||
CheckDestroy: testAccCheckEfsFileSystemDestroy,
|
CheckDestroy: testAccCheckEfsFileSystemDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccAWSEFSFileSystemConfigPagedTags,
|
Config: testAccAWSEFSFileSystemConfigPagedTags(rInt),
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
resource.TestCheckResourceAttr(
|
resource.TestCheckResourceAttr(
|
||||||
"aws_efs_file_system.foo",
|
"aws_efs_file_system.foo",
|
||||||
|
@ -312,34 +314,38 @@ resource "aws_efs_file_system" "foo" {
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
const testAccAWSEFSFileSystemConfigPagedTags = `
|
func testAccAWSEFSFileSystemConfigPagedTags(rInt int) string {
|
||||||
resource "aws_efs_file_system" "foo" {
|
return fmt.Sprintf(`
|
||||||
creation_token = "radeksimko"
|
resource "aws_efs_file_system" "foo" {
|
||||||
tags {
|
creation_token = "radeksimko"
|
||||||
Name = "foo-efs"
|
tags {
|
||||||
Another = "tag"
|
Name = "foo-efs-%d"
|
||||||
Test = "yes"
|
Another = "tag"
|
||||||
User = "root"
|
Test = "yes"
|
||||||
Page = "1"
|
User = "root"
|
||||||
Environment = "prod"
|
Page = "1"
|
||||||
CostCenter = "terraform"
|
Environment = "prod"
|
||||||
AcceptanceTest = "PagedTags"
|
CostCenter = "terraform"
|
||||||
CreationToken = "radek"
|
AcceptanceTest = "PagedTags"
|
||||||
PerfMode = "max"
|
CreationToken = "radek"
|
||||||
Region = "us-west-2"
|
PerfMode = "max"
|
||||||
|
Region = "us-west-2"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
`, rInt)
|
||||||
}
|
}
|
||||||
`
|
|
||||||
|
|
||||||
const testAccAWSEFSFileSystemConfigWithTags = `
|
func testAccAWSEFSFileSystemConfigWithTags(rInt int) string {
|
||||||
resource "aws_efs_file_system" "foo-with-tags" {
|
return fmt.Sprintf(`
|
||||||
creation_token = "yada_yada"
|
resource "aws_efs_file_system" "foo-with-tags" {
|
||||||
tags {
|
creation_token = "yada_yada"
|
||||||
Name = "foo-efs"
|
tags {
|
||||||
Another = "tag"
|
Name = "foo-efs-%d"
|
||||||
|
Another = "tag"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
`, rInt)
|
||||||
}
|
}
|
||||||
`
|
|
||||||
|
|
||||||
const testAccAWSEFSFileSystemConfigWithPerformanceMode = `
|
const testAccAWSEFSFileSystemConfigWithPerformanceMode = `
|
||||||
resource "aws_efs_file_system" "foo-with-performance-mode" {
|
resource "aws_efs_file_system" "foo-with-performance-mode" {
|
||||||
|
|
|
@ -661,7 +661,7 @@ resource "aws_elastic_beanstalk_environment" "tfenvtest" {
|
||||||
func testAccBeanstalkWorkerEnvConfig(rInt int) string {
|
func testAccBeanstalkWorkerEnvConfig(rInt int) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "aws_iam_instance_profile" "tftest" {
|
resource "aws_iam_instance_profile" "tftest" {
|
||||||
name = "tftest_profile"
|
name = "tftest_profile-%d"
|
||||||
roles = ["${aws_iam_role.tftest.name}"]
|
roles = ["${aws_iam_role.tftest.name}"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -693,7 +693,7 @@ func testAccBeanstalkWorkerEnvConfig(rInt int) string {
|
||||||
name = "IamInstanceProfile"
|
name = "IamInstanceProfile"
|
||||||
value = "${aws_iam_instance_profile.tftest.name}"
|
value = "${aws_iam_instance_profile.tftest.name}"
|
||||||
}
|
}
|
||||||
}`, rInt, rInt)
|
}`, rInt, rInt, rInt)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccBeanstalkEnvCnamePrefixConfig(randString string, rInt int) string {
|
func testAccBeanstalkEnvCnamePrefixConfig(randString string, rInt int) string {
|
||||||
|
@ -937,24 +937,24 @@ resource "aws_s3_bucket_object" "default" {
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_elastic_beanstalk_application" "default" {
|
resource "aws_elastic_beanstalk_application" "default" {
|
||||||
name = "tf-test-name"
|
name = "tf-test-name-%d"
|
||||||
description = "tf-test-desc"
|
description = "tf-test-desc"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_elastic_beanstalk_application_version" "default" {
|
resource "aws_elastic_beanstalk_application_version" "default" {
|
||||||
application = "tf-test-name"
|
application = "tf-test-name-%d"
|
||||||
name = "tf-test-version-label"
|
name = "tf-test-version-label"
|
||||||
bucket = "${aws_s3_bucket.default.id}"
|
bucket = "${aws_s3_bucket.default.id}"
|
||||||
key = "${aws_s3_bucket_object.default.id}"
|
key = "${aws_s3_bucket_object.default.id}"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_elastic_beanstalk_environment" "default" {
|
resource "aws_elastic_beanstalk_environment" "default" {
|
||||||
name = "tf-test-name"
|
name = "tf-test-name-%d"
|
||||||
application = "${aws_elastic_beanstalk_application.default.name}"
|
application = "${aws_elastic_beanstalk_application.default.name}"
|
||||||
version_label = "${aws_elastic_beanstalk_application_version.default.name}"
|
version_label = "${aws_elastic_beanstalk_application_version.default.name}"
|
||||||
solution_stack_name = "64bit Amazon Linux running Python"
|
solution_stack_name = "64bit Amazon Linux running Python"
|
||||||
}
|
}
|
||||||
`, randInt)
|
`, randInt, randInt, randInt, randInt)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccBeanstalkEnvApplicationVersionConfigUpdate(randInt int) string {
|
func testAccBeanstalkEnvApplicationVersionConfigUpdate(randInt int) string {
|
||||||
|
@ -970,22 +970,22 @@ resource "aws_s3_bucket_object" "default" {
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_elastic_beanstalk_application" "default" {
|
resource "aws_elastic_beanstalk_application" "default" {
|
||||||
name = "tf-test-name"
|
name = "tf-test-name-%d"
|
||||||
description = "tf-test-desc"
|
description = "tf-test-desc"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_elastic_beanstalk_application_version" "default" {
|
resource "aws_elastic_beanstalk_application_version" "default" {
|
||||||
application = "tf-test-name"
|
application = "tf-test-name-%d"
|
||||||
name = "tf-test-version-label-v2"
|
name = "tf-test-version-label-v2"
|
||||||
bucket = "${aws_s3_bucket.default.id}"
|
bucket = "${aws_s3_bucket.default.id}"
|
||||||
key = "${aws_s3_bucket_object.default.id}"
|
key = "${aws_s3_bucket_object.default.id}"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_elastic_beanstalk_environment" "default" {
|
resource "aws_elastic_beanstalk_environment" "default" {
|
||||||
name = "tf-test-name"
|
name = "tf-test-name-%d"
|
||||||
application = "${aws_elastic_beanstalk_application.default.name}"
|
application = "${aws_elastic_beanstalk_application.default.name}"
|
||||||
version_label = "${aws_elastic_beanstalk_application_version.default.name}"
|
version_label = "${aws_elastic_beanstalk_application_version.default.name}"
|
||||||
solution_stack_name = "64bit Amazon Linux running Python"
|
solution_stack_name = "64bit Amazon Linux running Python"
|
||||||
}
|
}
|
||||||
`, randInt)
|
`, randInt, randInt, randInt, randInt)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/service/ses"
|
"github.com/aws/aws-sdk-go/service/ses"
|
||||||
|
"github.com/hashicorp/terraform/helper/acctest"
|
||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
"github.com/hashicorp/terraform/terraform"
|
"github.com/hashicorp/terraform/terraform"
|
||||||
)
|
)
|
||||||
|
@ -42,7 +43,7 @@ func testAccCheckSESConfigurationSetDestroy(s *terraform.State) error {
|
||||||
|
|
||||||
found := false
|
found := false
|
||||||
for _, element := range response.ConfigurationSets {
|
for _, element := range response.ConfigurationSets {
|
||||||
if *element.Name == "some-configuration-set" {
|
if *element.Name == fmt.Sprintf("some-configuration-set-%d", escRandomInteger) {
|
||||||
found = true
|
found = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,7 +78,7 @@ func testAccCheckAwsSESConfigurationSetExists(n string) resource.TestCheckFunc {
|
||||||
|
|
||||||
found := false
|
found := false
|
||||||
for _, element := range response.ConfigurationSets {
|
for _, element := range response.ConfigurationSets {
|
||||||
if *element.Name == "some-configuration-set" {
|
if *element.Name == fmt.Sprintf("some-configuration-set-%d", escRandomInteger) {
|
||||||
found = true
|
found = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,8 +91,9 @@ func testAccCheckAwsSESConfigurationSetExists(n string) resource.TestCheckFunc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const testAccAWSSESConfigurationSetConfig = `
|
var escRandomInteger = acctest.RandInt()
|
||||||
|
var testAccAWSSESConfigurationSetConfig = fmt.Sprintf(`
|
||||||
resource "aws_ses_configuration_set" "test" {
|
resource "aws_ses_configuration_set" "test" {
|
||||||
name = "some-configuration-set"
|
name = "some-configuration-set-%d"
|
||||||
}
|
}
|
||||||
`
|
`, escRandomInteger)
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/service/ses"
|
"github.com/aws/aws-sdk-go/service/ses"
|
||||||
|
"github.com/hashicorp/terraform/helper/acctest"
|
||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
"github.com/hashicorp/terraform/terraform"
|
"github.com/hashicorp/terraform/terraform"
|
||||||
)
|
)
|
||||||
|
@ -46,7 +47,7 @@ func testAccCheckSESEventDestinationDestroy(s *terraform.State) error {
|
||||||
|
|
||||||
found := false
|
found := false
|
||||||
for _, element := range response.ConfigurationSets {
|
for _, element := range response.ConfigurationSets {
|
||||||
if *element.Name == "some-configuration-set" {
|
if *element.Name == fmt.Sprintf("some-configuration-set-%d", edRandomInteger) {
|
||||||
found = true
|
found = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,7 +82,7 @@ func testAccCheckAwsSESEventDestinationExists(n string) resource.TestCheckFunc {
|
||||||
|
|
||||||
found := false
|
found := false
|
||||||
for _, element := range response.ConfigurationSets {
|
for _, element := range response.ConfigurationSets {
|
||||||
if *element.Name == "some-configuration-set" {
|
if *element.Name == fmt.Sprintf("some-configuration-set-%d", edRandomInteger) {
|
||||||
found = true
|
found = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,7 +95,8 @@ func testAccCheckAwsSESEventDestinationExists(n string) resource.TestCheckFunc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const testAccAWSSESEventDestinationConfig = `
|
var edRandomInteger = acctest.RandInt()
|
||||||
|
var testAccAWSSESEventDestinationConfig = fmt.Sprintf(`
|
||||||
resource "aws_s3_bucket" "bucket" {
|
resource "aws_s3_bucket" "bucket" {
|
||||||
bucket = "tf-test-bucket-format"
|
bucket = "tf-test-bucket-format"
|
||||||
acl = "private"
|
acl = "private"
|
||||||
|
@ -155,7 +157,7 @@ data "aws_iam_policy_document" "fh_felivery_document" {
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_ses_configuration_set" "test" {
|
resource "aws_ses_configuration_set" "test" {
|
||||||
name = "some-configuration-set"
|
name = "some-configuration-set-%d"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_ses_event_destination" "kinesis" {
|
resource "aws_ses_event_destination" "kinesis" {
|
||||||
|
@ -182,4 +184,4 @@ resource "aws_ses_event_destination" "cloudwatch" {
|
||||||
value_source = "emailHeader"
|
value_source = "emailHeader"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`
|
`, edRandomInteger)
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||||
"github.com/aws/aws-sdk-go/service/ses"
|
"github.com/aws/aws-sdk-go/service/ses"
|
||||||
|
"github.com/hashicorp/terraform/helper/acctest"
|
||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
"github.com/hashicorp/terraform/terraform"
|
"github.com/hashicorp/terraform/terraform"
|
||||||
)
|
)
|
||||||
|
@ -111,7 +112,7 @@ func testAccCheckAwsSESReceiptRuleExists(n string) resource.TestCheckFunc {
|
||||||
|
|
||||||
params := &ses.DescribeReceiptRuleInput{
|
params := &ses.DescribeReceiptRuleInput{
|
||||||
RuleName: aws.String("basic"),
|
RuleName: aws.String("basic"),
|
||||||
RuleSetName: aws.String("test-me"),
|
RuleSetName: aws.String(fmt.Sprintf("test-me-%d", srrsRandomInt)),
|
||||||
}
|
}
|
||||||
|
|
||||||
response, err := conn.DescribeReceiptRule(params)
|
response, err := conn.DescribeReceiptRule(params)
|
||||||
|
@ -153,7 +154,7 @@ func testAccCheckAwsSESReceiptRuleOrder(n string) resource.TestCheckFunc {
|
||||||
conn := testAccProvider.Meta().(*AWSClient).sesConn
|
conn := testAccProvider.Meta().(*AWSClient).sesConn
|
||||||
|
|
||||||
params := &ses.DescribeReceiptRuleSetInput{
|
params := &ses.DescribeReceiptRuleSetInput{
|
||||||
RuleSetName: aws.String("test-me"),
|
RuleSetName: aws.String(fmt.Sprintf("test-me-%d", srrsRandomInt)),
|
||||||
}
|
}
|
||||||
|
|
||||||
response, err := conn.DescribeReceiptRuleSet(params)
|
response, err := conn.DescribeReceiptRuleSet(params)
|
||||||
|
@ -185,8 +186,8 @@ func testAccCheckAwsSESReceiptRuleActions(n string) resource.TestCheckFunc {
|
||||||
conn := testAccProvider.Meta().(*AWSClient).sesConn
|
conn := testAccProvider.Meta().(*AWSClient).sesConn
|
||||||
|
|
||||||
params := &ses.DescribeReceiptRuleInput{
|
params := &ses.DescribeReceiptRuleInput{
|
||||||
RuleName: aws.String("actions"),
|
RuleName: aws.String("actions4"),
|
||||||
RuleSetName: aws.String("test-me"),
|
RuleSetName: aws.String(fmt.Sprintf("test-me-%d", srrsRandomInt)),
|
||||||
}
|
}
|
||||||
|
|
||||||
response, err := conn.DescribeReceiptRule(params)
|
response, err := conn.DescribeReceiptRule(params)
|
||||||
|
@ -227,9 +228,10 @@ func testAccCheckAwsSESReceiptRuleActions(n string) resource.TestCheckFunc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const testAccAWSSESReceiptRuleBasicConfig = `
|
var srrsRandomInt = acctest.RandInt()
|
||||||
|
var testAccAWSSESReceiptRuleBasicConfig = fmt.Sprintf(`
|
||||||
resource "aws_ses_receipt_rule_set" "test" {
|
resource "aws_ses_receipt_rule_set" "test" {
|
||||||
rule_set_name = "test-me"
|
rule_set_name = "test-me-%d"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_ses_receipt_rule" "basic" {
|
resource "aws_ses_receipt_rule" "basic" {
|
||||||
|
@ -240,11 +242,11 @@ resource "aws_ses_receipt_rule" "basic" {
|
||||||
scan_enabled = true
|
scan_enabled = true
|
||||||
tls_policy = "Require"
|
tls_policy = "Require"
|
||||||
}
|
}
|
||||||
`
|
`, srrsRandomInt)
|
||||||
|
|
||||||
const testAccAWSSESReceiptRuleOrderConfig = `
|
var testAccAWSSESReceiptRuleOrderConfig = fmt.Sprintf(`
|
||||||
resource "aws_ses_receipt_rule_set" "test" {
|
resource "aws_ses_receipt_rule_set" "test" {
|
||||||
rule_set_name = "test-me"
|
rule_set_name = "test-me-%d"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_ses_receipt_rule" "second" {
|
resource "aws_ses_receipt_rule" "second" {
|
||||||
|
@ -257,36 +259,36 @@ resource "aws_ses_receipt_rule" "first" {
|
||||||
name = "first"
|
name = "first"
|
||||||
rule_set_name = "${aws_ses_receipt_rule_set.test.rule_set_name}"
|
rule_set_name = "${aws_ses_receipt_rule_set.test.rule_set_name}"
|
||||||
}
|
}
|
||||||
`
|
`, srrsRandomInt)
|
||||||
|
|
||||||
const testAccAWSSESReceiptRuleActionsConfig = `
|
var testAccAWSSESReceiptRuleActionsConfig = fmt.Sprintf(`
|
||||||
resource "aws_s3_bucket" "emails" {
|
resource "aws_s3_bucket" "emails" {
|
||||||
bucket = "ses-terraform-emails"
|
bucket = "ses-terraform-emails"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_ses_receipt_rule_set" "test" {
|
resource "aws_ses_receipt_rule_set" "test" {
|
||||||
rule_set_name = "test-me"
|
rule_set_name = "test-me-%d"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_ses_receipt_rule" "actions" {
|
resource "aws_ses_receipt_rule" "actions" {
|
||||||
name = "actions"
|
name = "actions4"
|
||||||
rule_set_name = "${aws_ses_receipt_rule_set.test.rule_set_name}"
|
rule_set_name = "${aws_ses_receipt_rule_set.test.rule_set_name}"
|
||||||
|
|
||||||
add_header_action {
|
add_header_action {
|
||||||
header_name = "Added-By"
|
header_name = "Added-By"
|
||||||
header_value = "Terraform"
|
header_value = "Terraform"
|
||||||
position = 1
|
position = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
add_header_action {
|
add_header_action {
|
||||||
header_name = "Another-Header"
|
header_name = "Another-Header"
|
||||||
header_value = "First"
|
header_value = "First"
|
||||||
position = 0
|
position = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_action {
|
stop_action {
|
||||||
scope = "RuleSet"
|
scope = "RuleSet"
|
||||||
position = 2
|
position = 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`
|
`, srrsRandomInt)
|
||||||
|
|
Loading…
Reference in New Issue