diff --git a/internal/service/lambda/function_test.go b/internal/service/lambda/function_test.go index 167410a562c..8d9a66b3b45 100644 --- a/internal/service/lambda/function_test.go +++ b/internal/service/lambda/function_test.go @@ -3734,11 +3734,6 @@ resource "aws_s3_bucket" "artifacts" { force_destroy = true } -resource "aws_s3_bucket_acl" "artifacts" { - bucket = aws_s3_bucket.artifacts.id - acl = "private" -} - resource "aws_s3_bucket_versioning" "artifacts" { bucket = aws_s3_bucket.artifacts.id versioning_configuration { @@ -3795,11 +3790,6 @@ resource "aws_s3_bucket" "artifacts" { force_destroy = true } -resource "aws_s3_bucket_acl" "artifacts" { - bucket = aws_s3_bucket.artifacts.id - acl = "private" -} - resource "aws_s3_object" "o" { bucket = aws_s3_bucket.artifacts.bucket key = %[2]q diff --git a/internal/service/lambda/generate.go b/internal/service/lambda/generate.go index 7d4c92a90e2..92e529c5dc8 100644 --- a/internal/service/lambda/generate.go +++ b/internal/service/lambda/generate.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -//go:generate go run ../../generate/tags/main.go -ServiceTagsMap -TagInIDElem=Resource -UpdateTags -AWSSDKVersion=2 -KVTValues -SkipTypesImp +//go:generate go run ../../generate/tags/main.go -ServiceTagsMap -TagInIDElem=Resource -UpdateTags -ListTags -ListTagsInIDElem=Resource -ListTagsOp=ListTags -AWSSDKVersion=2 -KVTValues -SkipTypesImp //go:generate go run ../../generate/servicepackage/main.go // ONLY generate directives and package declaration! Do not add anything else to this file. diff --git a/internal/service/lambda/tags_gen.go b/internal/service/lambda/tags_gen.go index ce01b6ca5e8..5db48123832 100644 --- a/internal/service/lambda/tags_gen.go +++ b/internal/service/lambda/tags_gen.go @@ -13,6 +13,39 @@ import ( "github.com/hashicorp/terraform-provider-aws/names" ) +// listTags lists lambda service tags. +// The identifier is typically the Amazon Resource Name (ARN), although +// it may also be a different identifier depending on the service. +func listTags(ctx context.Context, conn *lambda.Client, identifier string) (tftags.KeyValueTags, error) { + input := &lambda.ListTagsInput{ + Resource: aws.String(identifier), + } + + output, err := conn.ListTags(ctx, input) + + if err != nil { + return tftags.New(ctx, nil), err + } + + return KeyValueTags(ctx, output.Tags), nil +} + +// ListTags lists lambda service tags and set them in Context. +// It is called from outside this package. +func (p *servicePackage) ListTags(ctx context.Context, meta any, identifier string) error { + tags, err := listTags(ctx, meta.(*conns.AWSClient).LambdaClient(ctx), identifier) + + if err != nil { + return err + } + + if inContext, ok := tftags.FromContext(ctx); ok { + inContext.TagsOut = types.Some(tags) + } + + return nil +} + // map[string]string handling // Tags returns lambda service tags.