Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable tags for Lambda functions #13352

Merged
merged 5 commits into from
Aug 27, 2019

Conversation

kvch
Copy link
Contributor

@kvch kvch commented Aug 26, 2019

New option is added to configure tags for functions named tags. It expects key-value pairs.

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

Closes #13080

@kvch kvch requested review from ph and faec August 26, 2019 21:39
Key: name,
Value: val,
}
tags = append(tags, tag)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add validation on the tags see.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html

Looking at the documentation there are limit on lenght and they cannot start with aws:

Key

    The key name of the tag. You can specify a value that is 1 to 127 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.

    Required: Yes

    Type: String
Value

    The value for the tag. You can specify a value that is 1 to 255 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.

    Required: Yes

    Type: String

if strings.HasPrefix(key, "aws:") {
return fmt.Errorf("key '%s' cannot be prefixed with 'aws:'", key)
}
if strings.HasPrefix(val, "aws:") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "aws:" is only a limitation for keys not the values.

Limitation for the value is 255 not 127 (127 is only for the key) as mentioned in the comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"aws:" is limitation for both key and value. But you are right about the lenghts.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah crap you are right about the value, weird, things, I guess they scan the whole structure to make a decision.

Copy link
Contributor

@ph ph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kvch
Copy link
Contributor Author

kvch commented Aug 27, 2019

Failing tests are unrelated.

@kvch kvch merged commit b2d3f6a into elastic:master Aug 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Functionbeat supprt tagging AWS Lambda function
2 participants