From f85582e7a1f3bd1da1cc0f90fb99434bcf4f0a84 Mon Sep 17 00:00:00 2001 From: Michael Handler Date: Tue, 22 Aug 2017 21:25:52 -0700 Subject: [PATCH] Fix SNS subscription sub/unsub/sub bug. --- aws/resource_aws_sns_topic_subscription.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws/resource_aws_sns_topic_subscription.go b/aws/resource_aws_sns_topic_subscription.go index ff8c8e70b4c..9efdb4b67b7 100644 --- a/aws/resource_aws_sns_topic_subscription.go +++ b/aws/resource_aws_sns_topic_subscription.go @@ -105,7 +105,7 @@ func resourceAwsSnsTopicSubscriptionUpdate(d *schema.ResourceData, meta interfac snsconn := meta.(*AWSClient).snsconn // If any changes happened, un-subscribe and re-subscribe - if d.HasChange("protocol") || d.HasChange("endpoint") || d.HasChange("topic_arn") { + if !d.IsNewResource() && (d.HasChange("protocol") || d.HasChange("endpoint") || d.HasChange("topic_arn")) { log.Printf("[DEBUG] Updating subscription %s", d.Id()) // Unsubscribe _, err := snsconn.Unsubscribe(&sns.UnsubscribeInput{