diff --git a/resources/services/lambda/functions.go b/resources/services/lambda/functions.go index fd275d0e8..df102e61c 100644 --- a/resources/services/lambda/functions.go +++ b/resources/services/lambda/functions.go @@ -18,7 +18,7 @@ type AliasWrapper struct { UrlConfig *lambda.GetFunctionUrlConfigOutput } -//go:generate cq-gen --resource ledgers --config gen.hcl --output . +//go:generate cq-gen --resource functions --config gen.hcl --output . func Functions() *schema.Table { return &schema.Table{ Name: "aws_lambda_functions", @@ -375,7 +375,7 @@ func Functions() *schema.Table { Name: "tags", Description: "The function's tags (https://docs.aws.amazon.com/lambda/latest/dg/tagging.html).", Type: schema.TypeJSON, - Resolver: schema.PathResolver("Tags"), + Resolver: resolveFunctionsTags, IgnoreInTests: true, }, }, @@ -1423,6 +1423,10 @@ func resolveFunctionEventSourceMappingsSourceAccessConfigurations(ctx context.Co return diag.WrapError(resource.Set(c.Name, data)) } -// ==================================================================================================================== -// User Defined Helpers -// ==================================================================================================================== +func resolveFunctionsTags(ctx context.Context, meta schema.ClientMeta, resource *schema.Resource, c schema.Column) error { + r := resource.Item.(*lambda.GetFunctionOutput) + if r.Tags == nil { + return diag.WrapError(resource.Set(c.Name, make(map[string]string))) + } + return diag.WrapError(resource.Set(c.Name, r.Tags)) +} diff --git a/resources/services/lambda/gen.hcl b/resources/services/lambda/gen.hcl index aa0b54133..951653c73 100644 --- a/resources/services/lambda/gen.hcl +++ b/resources/services/lambda/gen.hcl @@ -100,6 +100,9 @@ resource "aws" "lambda" "functions" { skip_prefix = true } + column "tags" { + generate_resolver = true + } column "image_config_response" { skip_prefix = true