Skip to content
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

r/aws_kinesis_stream: Prevent long retries when quotas would be exceeded #40499

Merged
merged 15 commits into from
Dec 10, 2024

Conversation

ewbankkit
Copy link
Contributor

@ewbankkit ewbankkit commented Dec 9, 2024

Description

  • Adds plan-time validation that creation of an on-demand stream would not exceed the AWS account's data stream quota.
  • Adds plan-time validation that shard_count would not exceed the AWS account's shard quota when the data stream capacity mode is PROVISIONED.

Relations

Closes #40494.
Closes #38094.

Output from Acceptance Testing

```console
% make testacc TESTARGS='-run=TestAccKinesisStream_\|TestAccKinesisStreamDataSource_' PKG=kinesis ACCTEST_PARALLELISM=2
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.3 test ./internal/service/kinesis/... -v -count 1 -parallel 2  -run=TestAccKinesisStream_\|TestAccKinesisStreamDataSource_ -timeout 360m
2024/12/10 08:56:00 Initializing Terraform AWS Provider...
=== RUN   TestAccKinesisStreamDataSource_basic
=== PAUSE TestAccKinesisStreamDataSource_basic
=== RUN   TestAccKinesisStreamDataSource_encryption
=== PAUSE TestAccKinesisStreamDataSource_encryption
=== RUN   TestAccKinesisStreamDataSource_pagedShards
=== PAUSE TestAccKinesisStreamDataSource_pagedShards
=== RUN   TestAccKinesisStream_basic
=== PAUSE TestAccKinesisStream_basic
=== RUN   TestAccKinesisStream_disappears
=== PAUSE TestAccKinesisStream_disappears
=== RUN   TestAccKinesisStream_createMultipleConcurrentStreams
=== PAUSE TestAccKinesisStream_createMultipleConcurrentStreams
=== RUN   TestAccKinesisStream_encryptionWithoutKMSKeyThrowsError
=== PAUSE TestAccKinesisStream_encryptionWithoutKMSKeyThrowsError
=== RUN   TestAccKinesisStream_encryption
=== PAUSE TestAccKinesisStream_encryption
=== RUN   TestAccKinesisStream_shardCount
=== PAUSE TestAccKinesisStream_shardCount
=== RUN   TestAccKinesisStream_retentionPeriod
=== PAUSE TestAccKinesisStream_retentionPeriod
=== RUN   TestAccKinesisStream_shardLevelMetrics
=== PAUSE TestAccKinesisStream_shardLevelMetrics
=== RUN   TestAccKinesisStream_enforceConsumerDeletion
=== PAUSE TestAccKinesisStream_enforceConsumerDeletion
=== RUN   TestAccKinesisStream_tags
=== PAUSE TestAccKinesisStream_tags
=== RUN   TestAccKinesisStream_updateKMSKeyID
=== PAUSE TestAccKinesisStream_updateKMSKeyID
=== RUN   TestAccKinesisStream_basicOnDemand
=== PAUSE TestAccKinesisStream_basicOnDemand
=== RUN   TestAccKinesisStream_updateStreamModeOnDemandToProvisionedStartWithNone
=== PAUSE TestAccKinesisStream_updateStreamModeOnDemandToProvisionedStartWithNone
=== RUN   TestAccKinesisStream_updateStreamModeOnDemandToProvisionedStartWithProvisioned
=== PAUSE TestAccKinesisStream_updateStreamModeOnDemandToProvisionedStartWithProvisioned
=== RUN   TestAccKinesisStream_updateStreamModeProvisionedToOnDemand
=== PAUSE TestAccKinesisStream_updateStreamModeProvisionedToOnDemand
=== RUN   TestAccKinesisStream_failOnBadStreamCountAndStreamModeCombination
=== PAUSE TestAccKinesisStream_failOnBadStreamCountAndStreamModeCombination
=== CONT  TestAccKinesisStreamDataSource_basic
=== CONT  TestAccKinesisStream_shardLevelMetrics
--- PASS: TestAccKinesisStreamDataSource_basic (94.14s)
=== CONT  TestAccKinesisStream_createMultipleConcurrentStreams
--- PASS: TestAccKinesisStream_shardLevelMetrics (94.59s)
=== CONT  TestAccKinesisStream_retentionPeriod
--- PASS: TestAccKinesisStream_retentionPeriod (84.57s)
=== CONT  TestAccKinesisStream_shardCount
--- PASS: TestAccKinesisStream_createMultipleConcurrentStreams (130.17s)
=== CONT  TestAccKinesisStream_encryption
--- PASS: TestAccKinesisStream_encryption (106.24s)
=== CONT  TestAccKinesisStream_encryptionWithoutKMSKeyThrowsError
--- PASS: TestAccKinesisStream_encryptionWithoutKMSKeyThrowsError (37.68s)
=== CONT  TestAccKinesisStream_updateStreamModeOnDemandToProvisionedStartWithNone
--- PASS: TestAccKinesisStream_updateStreamModeOnDemandToProvisionedStartWithNone (150.98s)
=== CONT  TestAccKinesisStream_failOnBadStreamCountAndStreamModeCombination
--- PASS: TestAccKinesisStream_failOnBadStreamCountAndStreamModeCombination (47.79s)
=== CONT  TestAccKinesisStream_updateStreamModeProvisionedToOnDemand
--- PASS: TestAccKinesisStream_updateStreamModeProvisionedToOnDemand (62.44s)
=== CONT  TestAccKinesisStream_updateStreamModeOnDemandToProvisionedStartWithProvisioned
--- PASS: TestAccKinesisStream_updateStreamModeOnDemandToProvisionedStartWithProvisioned (65.83s)
=== CONT  TestAccKinesisStream_basic
--- PASS: TestAccKinesisStream_basic (46.02s)
=== CONT  TestAccKinesisStream_disappears
--- PASS: TestAccKinesisStream_disappears (43.84s)
=== CONT  TestAccKinesisStream_updateKMSKeyID
--- PASS: TestAccKinesisStream_updateKMSKeyID (78.47s)
=== CONT  TestAccKinesisStream_basicOnDemand
--- PASS: TestAccKinesisStream_shardCount (720.13s)
=== CONT  TestAccKinesisStream_tags
--- PASS: TestAccKinesisStream_basicOnDemand (45.04s)
=== CONT  TestAccKinesisStream_enforceConsumerDeletion
--- PASS: TestAccKinesisStream_enforceConsumerDeletion (46.06s)
=== CONT  TestAccKinesisStreamDataSource_pagedShards
--- PASS: TestAccKinesisStream_tags (64.38s)
=== CONT  TestAccKinesisStreamDataSource_encryption
--- PASS: TestAccKinesisStreamDataSource_pagedShards (66.72s)
--- PASS: TestAccKinesisStreamDataSource_encryption (60.32s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/kinesis	1029.079s

…reamName cannot be provided together` errors when the data stream has more than 1000 shards.
…-demand stream would not exceed the AWS account's [data stream quota](https://docs.aws.amazon.com/streams/latest/dev/service-sizes-and-limits.html), preventing the provider from retrying for 1 hour in the case that the quota is exceeded. This change requires the `kinesis:DescribeLimits` IAM permission.
Copy link

github-actions bot commented Dec 9, 2024

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/kinesis Issues and PRs that pertain to the kinesis service. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. labels Dec 9, 2024
% make testacc TESTARGS='-run=TestAccKinesisStream_updateStreamMode' PKG=kinesis ACCTEST_PARALLELISM=1
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.3 test ./internal/service/kinesis/... -v -count 1 -parallel 1  -run=TestAccKinesisStream_updateStreamMode -timeout 360m
2024/12/10 08:48:23 Initializing Terraform AWS Provider...
=== RUN   TestAccKinesisStream_updateStreamModeOnDemandToProvisionedStartWithNone
=== PAUSE TestAccKinesisStream_updateStreamModeOnDemandToProvisionedStartWithNone
=== RUN   TestAccKinesisStream_updateStreamModeOnDemandToProvisionedStartWithProvisioned
=== PAUSE TestAccKinesisStream_updateStreamModeOnDemandToProvisionedStartWithProvisioned
=== RUN   TestAccKinesisStream_updateStreamModeProvisionedToOnDemand
=== PAUSE TestAccKinesisStream_updateStreamModeProvisionedToOnDemand
=== CONT  TestAccKinesisStream_updateStreamModeOnDemandToProvisionedStartWithNone
--- PASS: TestAccKinesisStream_updateStreamModeOnDemandToProvisionedStartWithNone (152.21s)
=== CONT  TestAccKinesisStream_updateStreamModeProvisionedToOnDemand
--- PASS: TestAccKinesisStream_updateStreamModeProvisionedToOnDemand (62.36s)
=== CONT  TestAccKinesisStream_updateStreamModeOnDemandToProvisionedStartWithProvisioned
--- PASS: TestAccKinesisStream_updateStreamModeOnDemandToProvisionedStartWithProvisioned (62.41s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/kinesis	282.127s
@ewbankkit ewbankkit marked this pull request as ready for review December 10, 2024 13:55
@ewbankkit ewbankkit requested a review from a team as a code owner December 10, 2024 13:55
jar-b
jar-b previously approved these changes Dec 10, 2024
Copy link
Member

@jar-b jar-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

% make testacc PKG=kinesis TESTS="TestAccKinesisStream_|TestAccKinesisStreamDataSource_"
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.3 test ./internal/service/kinesis/... -v -count 1 -parallel 20 -run='TestAccKinesisStream_|TestAccKinesisStreamDataSource_'  -timeout 360m
2024/12/10 10:25:24 Initializing Terraform AWS Provider...

=== NAME  TestAccKinesisStreamDataSource_pagedShards
    stream_data_source_test.go:97: skipping tests; shard count (1100) > shard limit quota (500)
--- SKIP: TestAccKinesisStreamDataSource_pagedShards (0.79s)
--- PASS: TestAccKinesisStream_encryptionWithoutKMSKeyThrowsError (44.26s)
--- PASS: TestAccKinesisStream_disappears (54.17s)
--- PASS: TestAccKinesisStream_basic (62.08s)
--- PASS: TestAccKinesisStream_failOnBadStreamCountAndStreamModeCombination (68.59s)
--- PASS: TestAccKinesisStream_basicOnDemand (70.43s)
--- PASS: TestAccKinesisStreamDataSource_encryption (71.43s)
--- PASS: TestAccKinesisStream_enforceConsumerDeletion (71.98s)
--- PASS: TestAccKinesisStream_tags (76.74s)
--- PASS: TestAccKinesisStream_updateStreamModeOnDemandToProvisionedStartWithProvisioned (77.90s)
--- PASS: TestAccKinesisStream_updateStreamModeProvisionedToOnDemand (88.38s)
--- PASS: TestAccKinesisStream_updateKMSKeyID (98.87s)
--- PASS: TestAccKinesisStream_retentionPeriod (103.59s)
--- PASS: TestAccKinesisStreamDataSource_basic (104.98s)
--- PASS: TestAccKinesisStream_shardLevelMetrics (108.09s)
--- PASS: TestAccKinesisStream_encryption (121.26s)
--- PASS: TestAccKinesisStream_updateStreamModeOnDemandToProvisionedStartWithNone (163.60s)
--- PASS: TestAccKinesisStream_createMultipleConcurrentStreams (232.57s)
--- PASS: TestAccKinesisStream_shardCount (768.31s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/kinesis    773.572s

@ewbankkit ewbankkit merged commit 3b42cff into main Dec 10, 2024
35 checks passed
@ewbankkit ewbankkit deleted the b-aws_kinesis_stream-fixes branch December 10, 2024 18:29
@github-actions github-actions bot added this to the v5.81.0 milestone Dec 10, 2024
terraform-aws-provider bot pushed a commit that referenced this pull request Dec 10, 2024
Copy link

This functionality has been released in v5.81.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. Thank you!

@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service/kinesis Issues and PRs that pertain to the kinesis service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
2 participants