Skip to content

Commit

Permalink
Merge pull request #39504 from hashicorp/f-r/aws_kinesis_stream-tag-o…
Browse files Browse the repository at this point in the history
…n-create

r/aws_kinesis_stream: Tag on create
  • Loading branch information
ewbankkit authored Sep 26, 2024
2 parents 956d32b + 62f6693 commit c8ffe25
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .changelog/39504.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_kinesis_stream: Tag on Create to support attribute-based access control (ABAC)
```
2 changes: 1 addition & 1 deletion internal/service/kinesis/generate.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

//go:generate go run ../../generate/tags/main.go -ListTags -ListTagsOp=ListTagsForStream -ListTagsInIDElem=StreamName -ServiceTagsSlice -TagOp=AddTagsToStream -TagOpBatchSize=10 -TagInCustomVal=updatedTags.IgnoreAWS().Map() -TagInIDElem=StreamName -UntagOp=RemoveTagsFromStream -UpdateTags -CreateTags
//go:generate go run ../../generate/tags/main.go -ListTags -ListTagsOp=ListTagsForStream -ListTagsInIDElem=StreamName -ServiceTagsSlice -TagOp=AddTagsToStream -TagOpBatchSize=10 -TagInCustomVal=updatedTags.IgnoreAWS().Map() -TagInIDElem=StreamName -UntagOp=RemoveTagsFromStream -UpdateTags
//go:generate go run ../../generate/servicepackage/main.go
// ONLY generate directives and package declaration! Do not add anything else to this file.

Expand Down
8 changes: 4 additions & 4 deletions internal/service/kinesis/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ func resourceStreamCreate(ctx context.Context, d *schema.ResourceData, meta inte
input.ShardCount = aws.Int32(int32(d.Get("shard_count").(int)))
}

if tags := KeyValueTags(ctx, getTagsIn(ctx)).Map(); len(tags) > 0 {
input.Tags = tags
}

_, err := conn.CreateStream(ctx, input)

if err != nil {
Expand Down Expand Up @@ -240,10 +244,6 @@ func resourceStreamCreate(ctx context.Context, d *schema.ResourceData, meta inte
}
}

if err := createTags(ctx, conn, name, getTagsIn(ctx)); err != nil {
return sdkdiag.AppendErrorf(diags, "setting Kinesis Stream (%s) tags: %s", name, err)
}

return append(diags, resourceStreamRead(ctx, d, meta)...)
}

Expand Down
9 changes: 0 additions & 9 deletions internal/service/kinesis/tags_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c8ffe25

Please sign in to comment.