provider/aws: aws_ses_receipt_rule: fix off-by-one errors (#12961)

In function `resourceAwsSesReceiptRuleRead` the position of the receipt
rules in the rule set was taken directly from the index of the rule's
position in the slice returned by the AWS API call. As the slice is
zero-based and the ruleset is one-based, this results in an incorrect
representation.

This manifests as `aws_ses_receipt_rule` resources always showing a
diff during plan or apply.
This commit is contained in:
Doug Neal 2017-03-27 13:56:57 +01:00 committed by Paul Stack
parent 3e8a8c5e23
commit e7e35b5c07
1 changed files with 7 additions and 7 deletions

View File

@ -443,7 +443,7 @@ func resourceAwsSesReceiptRuleRead(d *schema.ResourceData, meta interface{}) err
addHeaderAction := map[string]interface{}{ addHeaderAction := map[string]interface{}{
"header_name": *element.AddHeaderAction.HeaderName, "header_name": *element.AddHeaderAction.HeaderName,
"header_value": *element.AddHeaderAction.HeaderValue, "header_value": *element.AddHeaderAction.HeaderValue,
"position": i, "position": i + 1,
} }
addHeaderActionList = append(addHeaderActionList, addHeaderAction) addHeaderActionList = append(addHeaderActionList, addHeaderAction)
} }
@ -453,7 +453,7 @@ func resourceAwsSesReceiptRuleRead(d *schema.ResourceData, meta interface{}) err
"message": *element.BounceAction.Message, "message": *element.BounceAction.Message,
"sender": *element.BounceAction.Sender, "sender": *element.BounceAction.Sender,
"smtp_reply_code": *element.BounceAction.SmtpReplyCode, "smtp_reply_code": *element.BounceAction.SmtpReplyCode,
"position": i, "position": i + 1,
} }
if element.BounceAction.StatusCode != nil { if element.BounceAction.StatusCode != nil {
@ -470,7 +470,7 @@ func resourceAwsSesReceiptRuleRead(d *schema.ResourceData, meta interface{}) err
if element.LambdaAction != nil { if element.LambdaAction != nil {
lambdaAction := map[string]interface{}{ lambdaAction := map[string]interface{}{
"function_arn": *element.LambdaAction.FunctionArn, "function_arn": *element.LambdaAction.FunctionArn,
"position": i, "position": i + 1,
} }
if element.LambdaAction.InvocationType != nil { if element.LambdaAction.InvocationType != nil {
@ -487,7 +487,7 @@ func resourceAwsSesReceiptRuleRead(d *schema.ResourceData, meta interface{}) err
if element.S3Action != nil { if element.S3Action != nil {
s3Action := map[string]interface{}{ s3Action := map[string]interface{}{
"bucket_name": *element.S3Action.BucketName, "bucket_name": *element.S3Action.BucketName,
"position": i, "position": i + 1,
} }
if element.S3Action.KmsKeyArn != nil { if element.S3Action.KmsKeyArn != nil {
@ -508,7 +508,7 @@ func resourceAwsSesReceiptRuleRead(d *schema.ResourceData, meta interface{}) err
if element.SNSAction != nil { if element.SNSAction != nil {
snsAction := map[string]interface{}{ snsAction := map[string]interface{}{
"topic_arn": *element.SNSAction.TopicArn, "topic_arn": *element.SNSAction.TopicArn,
"position": i, "position": i + 1,
} }
snsActionList = append(snsActionList, snsAction) snsActionList = append(snsActionList, snsAction)
@ -517,7 +517,7 @@ func resourceAwsSesReceiptRuleRead(d *schema.ResourceData, meta interface{}) err
if element.StopAction != nil { if element.StopAction != nil {
stopAction := map[string]interface{}{ stopAction := map[string]interface{}{
"scope": *element.StopAction.Scope, "scope": *element.StopAction.Scope,
"position": i, "position": i + 1,
} }
if element.StopAction.TopicArn != nil { if element.StopAction.TopicArn != nil {
@ -530,7 +530,7 @@ func resourceAwsSesReceiptRuleRead(d *schema.ResourceData, meta interface{}) err
if element.WorkmailAction != nil { if element.WorkmailAction != nil {
workmailAction := map[string]interface{}{ workmailAction := map[string]interface{}{
"organization_arn": *element.WorkmailAction.OrganizationArn, "organization_arn": *element.WorkmailAction.OrganizationArn,
"position": i, "position": i + 1,
} }
if element.WorkmailAction.TopicArn != nil { if element.WorkmailAction.TopicArn != nil {