Add randomness to ses receipt rule

This commit is contained in:
= 2017-03-27 14:26:30 -06:00
parent dfb34c85b9
commit 63cd65d138
1 changed files with 13 additions and 11 deletions

View File

@ -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)
@ -186,7 +187,7 @@ func testAccCheckAwsSESReceiptRuleActions(n string) resource.TestCheckFunc {
params := &ses.DescribeReceiptRuleInput{ params := &ses.DescribeReceiptRuleInput{
RuleName: aws.String("actions"), RuleName: aws.String("actions"),
RuleSetName: aws.String("test-me"), RuleSetName: aws.String(fmt.Sprintf("test-me")),
} }
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,9 +259,9 @@ 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"
} }
@ -289,4 +291,4 @@ resource "aws_ses_receipt_rule" "actions" {
position = 2 position = 2
} }
} }
` `)