mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
aws_kinesis_stream: remove limit on DescribeStream
using limit: 1 on DescribeStream will always return 1 shard no matter how many shards there actually are when we call `len()`. so i've removed the limit parameter to get the actual shard list returned remove limits
This commit is contained in:
parent
5eb9b6c74e
commit
b68c23fb42
@ -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 {
|
||||
@ -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 {
|
||||
|
@ -3,6 +3,7 @@ package aws
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"strconv"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
@ -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 {
|
||||
@ -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
|
||||
}
|
||||
@ -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 {
|
||||
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user