-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds Kinesis Stream Consumer resource and data source (third time) #17149
Adds Kinesis Stream Consumer resource and data source (third time) #17149
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welcome @anthonyroach 👋
It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTING guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.
Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.
Thanks again, and welcome to the community! 😃
Hi @anthonyroach, thank you for this PR! Since it extends #10487, I've merged in commits from that PR into here so that the contributor gets credit for their work, nevertheless your commits should appear unchanged (if you have any questions please reach out!). Quick note, to get this highly requested PR into an upcoming release, I'm going to provide a review and may make some changes to bring the work inline with current provider conventions if needed. |
Thanks. Unfortunately merging the branches seems to have broken some things due to conflicting changes. I suppose in retrospect I should have not squashed the change like I did. Not sure what the best way to fix this is. |
Ohh @anthonyroach are you referring to the |
Yeah the failing CI checks, but looking more closely those aren't lines the original author or I changed, and I'm not able to reproduce the failure locally:
|
Oh, I see, the failures are coming from main which this branch is being rebased onto as part of the CI checks. Makes sense. |
045c510
to
f4d9746
Compare
Adapted from original commits from @rockycore at yomagroup:feature/kinesis-stream-consumer. Changes on top of the original commits: * rebased onto master, and squashed * added warning resource removal on not found during read * set the resource id immediately after creation * fixed import id syntax to match the documentation * added an import test * removed Optional from arn output in schema
cn := d.Get("name").(string) | ||
sa := d.Get("stream_arn").(string) | ||
|
||
state, err := readKinesisStreamConsumerState(conn, cn, sa) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can expand the search functionality (by name and/or arn, as well as neither) by using the ListStreamConsumers
API method, so I'll update here w/usage
func TestAccAWSKinesisStreamConsumerDataSource_basic(t *testing.T) { | ||
var stream kinesis.StreamDescription | ||
var consumer kinesis.ConsumerDescription | ||
config := createAccKinesisStreamConsumerConfig() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting usage! just for maintainability, and current recommendations, we should however prefer to reference functions that are more explicit when defining resources and/or data-sources. I'll update these tests with updated examples.
Delete: schema.DefaultTimeout(120 * time.Minute), | ||
}, | ||
|
||
Importer: &schema.ResourceImporter{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since the DescribeStreamConsumer
and Deregister
API methods support searching by ARN, we can set the ID with the determined ARN for easier lookup throughout 👍
Read: resourceAwsKinesisStreamConsumerRead, | ||
Delete: resourceAwsKinesisStreamConsumerDelete, | ||
|
||
Timeouts: &schema.ResourceTimeout{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generally, we prefer to handle timeout settings within the status and waiter functions on create/delete in place of operator-defined timeouts
d.Set("arn", arn) | ||
|
||
// No error, wait for ACTIVE state | ||
stateConf := &resource.StateChangeConf{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is great! just moving this out into the service package
cn := d.Get("name").(string) | ||
sa := d.Get("stream_arn").(string) | ||
|
||
state, err := readKinesisStreamConsumerState(conn, cn, sa) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we'll have the ARN stored as the ID, resource lookup will be updated to use that attribute and will be relocated in the service package as well
f4d9746
to
897d5a8
Compare
897d5a8
to
46a1b6f
Compare
46a1b6f
to
48bf260
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again @anthonyroach 🚀 !
Output of acceptance tests (commercial):
--- PASS: TestAccAWSKinesisStreamConsumer_disappears (80.92s)
--- PASS: TestAccAWSKinesisStreamConsumerDataSource_Arn (83.21s)
--- PASS: TestAccAWSKinesisStreamConsumerDataSource_Name (83.12s)
--- PASS: TestAccAWSKinesisStreamConsumer_basic (84.88s)
--- PASS: TestAccAWSKinesisStream_shardLevelMetrics (129.77s)
--- PASS: TestAccAWSKinesisStreamConsumerDataSource_basic (135.51s)
--- PASS: TestAccAWSKinesisStream_encryptionWithoutKmsKeyThrowsError (149.59s)
--- PASS: TestAccAWSKinesisStream_retentionPeriod (150.75s)
--- PASS: TestAccAWSKinesisStream_shardCount (163.92s)
--- PASS: TestAccAWSKinesisStream_basic (171.69s)
--- PASS: TestAccAWSKinesisStream_enforceConsumerDeletion (173.03s)
--- PASS: TestAccAWSKinesisStream_UpdateKmsKeyId (174.11s)
--- PASS: TestAccAWSKinesisStreamConsumer_MaxConcurrentConsumers (178.19s)
--- PASS: TestAccAWSKinesisStream_encryption (183.20s)
--- PASS: TestAccAWSKinesisStream_createMultipleConcurrentStreams (192.18s)
--- PASS: TestAccAWSKinesisStreamConsumer_ExceedMaxConcurrentConsumers (200.52s)
--- PASS: TestAccAWSKinesisStream_Tags (217.47s)
--- PASS: TestAccAWSKinesisStreamDataSource_basic (224.17s)
Gov cloud:
--- PASS: TestAccAWSKinesisStreamConsumerDataSource_Name (74.85s)
--- PASS: TestAccAWSKinesisStreamConsumer_MaxConcurrentConsumers (81.56s)
--- PASS: TestAccAWSKinesisStreamConsumerDataSource_basic (82.01s)
--- PASS: TestAccAWSKinesisStream_encryptionWithoutKmsKeyThrowsError (83.29s)
--- PASS: TestAccAWSKinesisStream_basic (85.14s)
--- PASS: TestAccAWSKinesisStreamConsumerDataSource_Arn (90.26s)
--- PASS: TestAccAWSKinesisStreamConsumer_disappears (91.88s)
--- PASS: TestAccAWSKinesisStreamConsumer_ExceedMaxConcurrentConsumers (98.85s)
--- PASS: TestAccAWSKinesisStream_retentionPeriod (99.19s)
--- PASS: TestAccAWSKinesisStreamConsumer_basic (103.76s)
--- PASS: TestAccAWSKinesisStreamDataSource_basic (105.31s)
--- PASS: TestAccAWSKinesisStream_shardCount (114.16s)
--- PASS: TestAccAWSKinesisStream_shardLevelMetrics (119.68s)
--- PASS: TestAccAWSKinesisStream_createMultipleConcurrentStreams (120.71s)
--- PASS: TestAccAWSKinesisStream_enforceConsumerDeletion (49.79s)
--- PASS: TestAccAWSKinesisStream_encryption (137.24s)
--- PASS: TestAccAWSKinesisStream_Tags (94.82s)
--- PASS: TestAccAWSKinesisStream_UpdateKmsKeyId (94.31s)
Type: schema.TypeString, | ||
Required: true, | ||
ForceNew: true, | ||
ValidateFunc: validateArn, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can add additional validation here with the method validateArn
This has been released in version 3.33.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks! |
Awesome! Thanks @anGie44 |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
This adds support for AWS Kinesis Stream Consumers, that allow for a dedicated consumer using enhanced fan-out.
Changes proposed in this pull request:
Adds aws_kinesis_stream_consumer as new resource
Adds aws_kinesis_stream_consumer as new data source
It is based on the original contribution of #10487
Changes on top of #10487:
arn
output in schemaCommunity Note
Closes #7611
Release note for CHANGELOG:
Output from acceptance testing: