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

resource/aws_kinesis_stream: Handle tag additions/removals of more than 10 tags #4574

Merged
merged 2 commits into from
May 23, 2018

Conversation

bflad
Copy link
Contributor

@bflad bflad commented May 17, 2018

Fixes #4562

Changes proposed in this pull request:

  • Batch tag additions into groups of 10 to match API requirement
  • Batch tag removals into groups of 10 to match API requirement

Previously:

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSKinesisStream_Tags'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSKinesisStream_Tags -timeout 120m
=== RUN   TestAccAWSKinesisStream_Tags
--- FAIL: TestAccAWSKinesisStream_Tags (26.75s)
	testing.go:518: Step 0 error: Error applying: 1 error(s) occurred:

		* aws_kinesis_stream.test: 1 error(s) occurred:

		* aws_kinesis_stream.test: ValidationException: 1 validation error detected: Value '{tag1=tag1value, tag20=tag20value, tag8=tag8value, tag10=tag10value, tag21=tag21value, tag9=tag9value, tag11=tag11value, tag6=tag6value, tag12=tag12value, tag7=tag7value, tag13=tag13value, tag4=tag4value, tag14=tag14value, tag5=tag5value, tag15=tag15value, tag2=tag2value, tag16=tag16value, tag3=tag3value, tag17=tag17value, tag18=tag18value, tag19=tag19value}' at 'tags' failed to satisfy constraint: Member must have length less than or equal to 10
			status code: 400, request id: dc1bc791-6394-fcfd-8f63-ce1bafcbaf0d
	testing.go:579: Error destroying resource! WARNING: Dangling resources
		may exist. The full state and error is shown below.

		Error: Error refreshing: 1 error(s) occurred:

		* aws_kinesis_stream.test: 1 error(s) occurred:

		* aws_kinesis_stream.test: aws_kinesis_stream.test: [WARN] Error reading Kinesis Stream: "1 validation error(s) found.", code: "InvalidParameter"

		State: <nil>
FAIL
FAIL	github.com/terraform-providers/terraform-provider-aws/aws	26.797s
make: *** [testacc] Error 1

Output from acceptance testing:

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSKinesisStream_Tags'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSKinesisStream_Tags -timeout 120m
=== RUN   TestAccAWSKinesisStream_Tags
--- PASS: TestAccAWSKinesisStream_Tags (108.99s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	109.030s

Full run:

10 tests passed (all tests)
=== RUN   TestAccAWSKinesisStream_encryptionWithoutKmsKeyThrowsError
--- PASS: TestAccAWSKinesisStream_encryptionWithoutKmsKeyThrowsError (62.80s)
=== RUN   TestAccAWSKinesisStream_basic
--- PASS: TestAccAWSKinesisStream_basic (75.04s)
=== RUN   TestAccAWSKinesisStream_importBasic
--- PASS: TestAccAWSKinesisStream_importBasic (75.87s)
=== RUN   TestAccAWSKinesisStream_Tags
--- PASS: TestAccAWSKinesisStream_Tags (89.73s)
=== RUN   TestAccAWSKinesisStream_retentionPeriod
--- PASS: TestAccAWSKinesisStream_retentionPeriod (122.32s)
=== RUN   TestAccAWSKinesisStream_shardLevelMetrics
--- PASS: TestAccAWSKinesisStream_shardLevelMetrics (142.56s)
=== RUN   TestAccAWSKinesisStream_encryption
--- PASS: TestAccAWSKinesisStream_encryption (190.55s)
=== RUN   TestAccAWSKinesisStreamDataSource
--- PASS: TestAccAWSKinesisStreamDataSource (210.89s)
=== RUN   TestAccAWSKinesisStream_createMultipleConcurrentStreams
--- PASS: TestAccAWSKinesisStream_createMultipleConcurrentStreams (315.24s)
=== RUN   TestAccAWSKinesisStream_shardCount
--- PASS: TestAccAWSKinesisStream_shardCount (363.95s)

@bflad bflad added bug Addresses a defect in current functionality. service/kinesis Issues and PRs that pertain to the kinesis service. labels May 17, 2018
@bflad bflad added this to the v1.20.0 milestone May 17, 2018
@bflad bflad requested a review from a team May 17, 2018 22:56
@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label May 17, 2018
Copy link
Member

@mbfrahry mbfrahry left a comment

Choose a reason for hiding this comment

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

LGTM minus the nits

if err != nil {
return err
// Kinesis requires these operations be split into 10 tag batches
tagKeysBatchLimit := 10
Copy link
Member

Choose a reason for hiding this comment

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

Thoughts on pulling this out and making it a constant?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That seems fair -- I'll update 👍

t := make(map[string]*string)

// Kinesis requires these operations be split into 10 tag batches
tagsBatchLimit := 10
Copy link
Member

Choose a reason for hiding this comment

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

Same as above

@bflad
Copy link
Contributor Author

bflad commented May 23, 2018

Acceptance tests pass after migrating to constant -- merging once TravisCI agrees!

make testacc TEST=./aws TESTARGS='-run=TestAccAWSKinesisStream_Tags'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSKinesisStream_Tags -timeout 120m
=== RUN   TestAccAWSKinesisStream_Tags
--- PASS: TestAccAWSKinesisStream_Tags (120.69s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	120.723s

@bflad bflad merged commit c8a0a7b into master May 23, 2018
@bflad bflad deleted the b-aws_kinesis_stream-tagbatches branch May 23, 2018 13:49
bflad added a commit that referenced this pull request May 23, 2018
@bflad
Copy link
Contributor Author

bflad commented May 23, 2018

This has been released in version 1.20.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Apr 5, 2020

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!

@ghost ghost locked and limited conversation to collaborators Apr 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/kinesis Issues and PRs that pertain to the kinesis service. size/L Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't apply more than 10 tags to resource "aws_kinesis_stream"
2 participants