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