Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

fix: Lambda function Tags null #1016

Merged
merged 3 commits into from
Jun 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions resources/services/lambda/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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,
},
},
Expand Down Expand Up @@ -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))
}
3 changes: 3 additions & 0 deletions resources/services/lambda/gen.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ resource "aws" "lambda" "functions" {
skip_prefix = true
}

column "tags" {
generate_resolver = true
}

column "image_config_response" {
skip_prefix = true
Expand Down