Skip to content

Commit

Permalink
Merge pull request #2986 from tphummel/aws_kinesis_stream-shard_count
Browse files Browse the repository at this point in the history
aws_kinesis_stream: shard_count state fix
  • Loading branch information
catsby committed Aug 31, 2015
2 parents b7c79d3 + b68c23f commit 03aba6f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 0 additions & 2 deletions builtin/providers/aws/resource_aws_kinesis_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ func resourceAwsKinesisStreamRead(d *schema.ResourceData, meta interface{}) erro
conn := meta.(*AWSClient).kinesisconn
describeOpts := &kinesis.DescribeStreamInput{
StreamName: aws.String(d.Get("name").(string)),
Limit: aws.Int64(1),
}
resp, err := conn.DescribeStream(describeOpts)
if err != nil {
Expand Down Expand Up @@ -138,7 +137,6 @@ func streamStateRefreshFunc(conn *kinesis.Kinesis, sn string) resource.StateRefr
return func() (interface{}, string, error) {
describeOpts := &kinesis.DescribeStreamInput{
StreamName: aws.String(sn),
Limit: aws.Int64(1),
}
resp, err := conn.DescribeStream(describeOpts)
if err != nil {
Expand Down
9 changes: 6 additions & 3 deletions builtin/providers/aws/resource_aws_kinesis_stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package aws
import (
"fmt"
"math/rand"
"strconv"
"strings"
"testing"
"time"
Expand Down Expand Up @@ -46,7 +47,6 @@ func testAccCheckKinesisStreamExists(n string, stream *kinesis.StreamDescription
conn := testAccProvider.Meta().(*AWSClient).kinesisconn
describeOpts := &kinesis.DescribeStreamInput{
StreamName: aws.String(rs.Primary.Attributes["name"]),
Limit: aws.Int64(1),
}
resp, err := conn.DescribeStream(describeOpts)
if err != nil {
Expand All @@ -71,6 +71,10 @@ func testAccCheckAWSKinesisStreamAttributes(stream *kinesis.StreamDescription) r
if *stream.StreamARN != rs.Primary.Attributes["arn"] {
return fmt.Errorf("Bad Stream ARN\n\t expected: %s\n\tgot: %s\n", rs.Primary.Attributes["arn"], *stream.StreamARN)
}
shard_count := strconv.Itoa(len(stream.Shards))
if shard_count != rs.Primary.Attributes["shard_count"] {
return fmt.Errorf("Bad Stream Shard Count\n\t expected: %s\n\tgot: %s\n", rs.Primary.Attributes["shard_count"], shard_count)
}
}
return nil
}
Expand All @@ -84,7 +88,6 @@ func testAccCheckKinesisStreamDestroy(s *terraform.State) error {
conn := testAccProvider.Meta().(*AWSClient).kinesisconn
describeOpts := &kinesis.DescribeStreamInput{
StreamName: aws.String(rs.Primary.Attributes["name"]),
Limit: aws.Int64(1),
}
resp, err := conn.DescribeStream(describeOpts)
if err == nil {
Expand All @@ -103,6 +106,6 @@ func testAccCheckKinesisStreamDestroy(s *terraform.State) error {
var testAccKinesisStreamConfig = fmt.Sprintf(`
resource "aws_kinesis_stream" "test_stream" {
name = "terraform-kinesis-test-%d"
shard_count = 1
shard_count = 2
}
`, rand.New(rand.NewSource(time.Now().UnixNano())).Int())

0 comments on commit 03aba6f

Please sign in to comment.