Skip to content

Commit

Permalink
Fix schema error
Browse files Browse the repository at this point in the history
  • Loading branch information
appilon committed May 20, 2020
1 parent e080efc commit 02ab8ec
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion aws/resource_aws_sns_topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package aws
import (
"fmt"
"log"
"strconv"
"strings"

"github.com/aws/aws-sdk-go/aws"
Expand Down Expand Up @@ -233,7 +234,13 @@ func resourceAwsSnsTopicRead(d *schema.ResourceData, meta interface{}) error {
if attributeOutput.Attributes != nil && len(attributeOutput.Attributes) > 0 {
attrmap := attributeOutput.Attributes
for terraformAttrName, snsAttrName := range SNSAttributeMap {
d.Set(terraformAttrName, attrmap[snsAttrName])
v, err := strconv.ParseInt(aws.StringValue(attrmap[snsAttrName], 10, 64))
// if the attribute is an integer the schema is probably an integer
if err == nil {
d.Set(terraformAttrName, v)
} else {
d.Set(terraformAttrName, aws.StringValue(attrmap[snsAttrName]))
}
}
} else {
for terraformAttrName := range SNSAttributeMap {
Expand Down

0 comments on commit 02ab8ec

Please sign in to comment.