Skip to content

Commit

Permalink
make tags configurable for aws lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
kvch committed Aug 26, 2019
1 parent c3ca82d commit 71a97eb
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
12 changes: 12 additions & 0 deletions x-pack/functionbeat/_meta/beat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ functionbeat.provider.aws.functions:
# Dead letter queue configuration, this must be set to an ARN pointing to a SQS queue.
#dead_letter_config.target_arn:

# Tags are key-value pairs attached to the function.
#tags:
# department: ops

# Optional fields that you can specify to add additional information to the
# output. Fields can be scalar values, arrays, dictionaries, or any nested
# combination of these.
Expand Down Expand Up @@ -92,6 +96,10 @@ functionbeat.provider.aws.functions:
# Dead letter queue configuration, this must be set to an ARN pointing to a SQS queue.
#dead_letter_config.target_arn:

# Tags are key-value pairs attached to the function.
#tags:
# department: ops

# Optional fields that you can specify to add additional information to the
# output. Fields can be scalar values, arrays, dictionaries, or any nested
# combination of these.
Expand Down Expand Up @@ -142,6 +150,10 @@ functionbeat.provider.aws.functions:
# Dead letter queue configuration, this must be set to an ARN pointing to a SQS queue.
#dead_letter_config.target_arn:

# Tags are key-value pairs attached to the function.
#tags:
# department: ops

# Optional fields that you can specify to add additional information to the
# output. Fields can be scalar values, arrays, dictionaries, or any nested
# combination of these.
Expand Down
12 changes: 12 additions & 0 deletions x-pack/functionbeat/functionbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ functionbeat.provider.aws.functions:
# Dead letter queue configuration, this must be set to an ARN pointing to a SQS queue.
#dead_letter_config.target_arn:

# Tags are key-value pairs attached to the function.
#tags:
# department: ops

# Optional fields that you can specify to add additional information to the
# output. Fields can be scalar values, arrays, dictionaries, or any nested
# combination of these.
Expand Down Expand Up @@ -92,6 +96,10 @@ functionbeat.provider.aws.functions:
# Dead letter queue configuration, this must be set to an ARN pointing to a SQS queue.
#dead_letter_config.target_arn:

# Tags are key-value pairs attached to the function.
#tags:
# department: ops

# Optional fields that you can specify to add additional information to the
# output. Fields can be scalar values, arrays, dictionaries, or any nested
# combination of these.
Expand Down Expand Up @@ -142,6 +150,10 @@ functionbeat.provider.aws.functions:
# Dead letter queue configuration, this must be set to an ARN pointing to a SQS queue.
#dead_letter_config.target_arn:

# Tags are key-value pairs attached to the function.
#tags:
# department: ops

# Optional fields that you can specify to add additional information to the
# output. Fields can be scalar values, arrays, dictionaries, or any nested
# combination of these.
Expand Down
10 changes: 10 additions & 0 deletions x-pack/functionbeat/manager/aws/template_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,15 @@ func (d *defaultTemplateBuilder) template(function installer, name, codeLoc stri
}
}

var tags []cloudformation.Tag
for name, val := range lambdaConfig.Tags {
tag := cloudformation.Tag{
Key: name,
Value: val,
}
tags = append(tags, tag)
}

// Create the lambda
// Doc: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html
template.Resources[prefix("")] = &AWSLambdaFunction{
Expand All @@ -190,6 +199,7 @@ func (d *defaultTemplateBuilder) template(function installer, name, codeLoc stri
MemorySize: lambdaConfig.MemorySize.Megabytes(),
ReservedConcurrentExecutions: lambdaConfig.Concurrency,
Timeout: int(lambdaConfig.Timeout.Seconds()),
Tags: tags,
},
DependsOn: dependsOn,
}
Expand Down
1 change: 1 addition & 0 deletions x-pack/functionbeat/provider/aws/aws/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type LambdaConfig struct {
Timeout time.Duration `config:"timeout" validate:"nonzero,positive"`
Role string `config:"role"`
VPCConfig *vpcConfig `config:"virtual_private_cloud"`
Tags map[string]string `config:"tags"`
}

// Validate checks a LambdaConfig
Expand Down

0 comments on commit 71a97eb

Please sign in to comment.