provider/aws: Cleanups on Kinesis naming
This commit is contained in:
parent
214ed23974
commit
9a1ae44475
|
@ -55,9 +55,6 @@ func resourceAwsKinesisStreamCreate(d *schema.ResourceData, meta interface{}) er
|
|||
return err
|
||||
}
|
||||
|
||||
// set name as ID for now. Kinesis stream names are unique per account+region
|
||||
d.SetId(sn)
|
||||
|
||||
stateConf := &resource.StateChangeConf{
|
||||
Pending: []string{"CREATING"},
|
||||
Target: "ACTIVE",
|
||||
|
@ -75,7 +72,8 @@ func resourceAwsKinesisStreamCreate(d *schema.ResourceData, meta interface{}) er
|
|||
}
|
||||
|
||||
s := streamRaw.(*kinesis.StreamDescription)
|
||||
d.Set("arn", *s.StreamARN)
|
||||
d.SetId(*s.StreamARN)
|
||||
d.Set("arn", s.StreamARN)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -83,7 +81,7 @@ func resourceAwsKinesisStreamCreate(d *schema.ResourceData, meta interface{}) er
|
|||
func resourceAwsKinesisStreamRead(d *schema.ResourceData, meta interface{}) error {
|
||||
conn := meta.(*AWSClient).kinesisconn
|
||||
describeOpts := &kinesis.DescribeStreamInput{
|
||||
StreamName: aws.String(d.Id()),
|
||||
StreamName: aws.String(d.Get("name").(string)),
|
||||
Limit: aws.Long(1),
|
||||
}
|
||||
resp, err := conn.DescribeStream(describeOpts)
|
||||
|
@ -107,8 +105,9 @@ func resourceAwsKinesisStreamRead(d *schema.ResourceData, meta interface{}) erro
|
|||
|
||||
func resourceAwsKinesisStreamDelete(d *schema.ResourceData, meta interface{}) error {
|
||||
conn := meta.(*AWSClient).kinesisconn
|
||||
sn := d.Get("name").(string)
|
||||
_, err := conn.DeleteStream(&kinesis.DeleteStreamInput{
|
||||
StreamName: aws.String(d.Id()),
|
||||
StreamName: aws.String(sn),
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
|
@ -118,7 +117,7 @@ func resourceAwsKinesisStreamDelete(d *schema.ResourceData, meta interface{}) er
|
|||
stateConf := &resource.StateChangeConf{
|
||||
Pending: []string{"DELETING"},
|
||||
Target: "DESTROYED",
|
||||
Refresh: streamStateRefreshFunc(conn, d.Id()),
|
||||
Refresh: streamStateRefreshFunc(conn, sn),
|
||||
Timeout: 5 * time.Minute,
|
||||
Delay: 10 * time.Second,
|
||||
MinTimeout: 3 * time.Second,
|
||||
|
@ -128,17 +127,17 @@ func resourceAwsKinesisStreamDelete(d *schema.ResourceData, meta interface{}) er
|
|||
if err != nil {
|
||||
return fmt.Errorf(
|
||||
"Error waiting for Stream (%s) to be destroyed: %s",
|
||||
d.Id(), err)
|
||||
sn, err)
|
||||
}
|
||||
|
||||
d.SetId("")
|
||||
return nil
|
||||
}
|
||||
|
||||
func streamStateRefreshFunc(conn *kinesis.Kinesis, streamName string) resource.StateRefreshFunc {
|
||||
func streamStateRefreshFunc(conn *kinesis.Kinesis, sn string) resource.StateRefreshFunc {
|
||||
return func() (interface{}, string, error) {
|
||||
describeOpts := &kinesis.DescribeStreamInput{
|
||||
StreamName: aws.String(streamName),
|
||||
StreamName: aws.String(sn),
|
||||
Limit: aws.Long(1),
|
||||
}
|
||||
resp, err := conn.DescribeStream(describeOpts)
|
||||
|
|
|
@ -45,7 +45,7 @@ func testAccCheckKinesisStreamExists(n string, stream *kinesis.StreamDescription
|
|||
|
||||
conn := testAccProvider.Meta().(*AWSClient).kinesisconn
|
||||
describeOpts := &kinesis.DescribeStreamInput{
|
||||
StreamName: aws.String(rs.Primary.ID),
|
||||
StreamName: aws.String(rs.Primary.Attributes["name"]),
|
||||
Limit: aws.Long(1),
|
||||
}
|
||||
resp, err := conn.DescribeStream(describeOpts)
|
||||
|
@ -83,7 +83,7 @@ func testAccCheckKinesisStreamDestroy(s *terraform.State) error {
|
|||
}
|
||||
conn := testAccProvider.Meta().(*AWSClient).kinesisconn
|
||||
describeOpts := &kinesis.DescribeStreamInput{
|
||||
StreamName: aws.String(rs.Primary.ID),
|
||||
StreamName: aws.String(rs.Primary.Attributes["name"]),
|
||||
Limit: aws.Long(1),
|
||||
}
|
||||
resp, err := conn.DescribeStream(describeOpts)
|
||||
|
|
Loading…
Reference in New Issue