-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Lambda S3 object version defaults to $LATEST if unspecified #4770
Lambda S3 object version defaults to $LATEST if unspecified #4770
Conversation
When you don't specify the version in the API, it is set to resource "aws_lambda_function" "test" {
...
s3_object_version = "$LATEST"
...
} It would be nice to have an acceptance test confirming this behaviour. Otherwise I'm happy to merge this, but I'd hold off until we merge #3825 |
If I recall, you can only explicitly set a 'proper' object version, and |
Understood, I wonder what comes back from the If user decides to manage versions outside of terraform, yet still reference/output/display current version we also may want to make Ping me if you need any help with writing the test. |
@radeksimko pretty busy these days, it's probably going to take a couple more days before I can get around to finishing this up |
No problem, I'm also busy, currently Fosdem + CfgMgmt Camp, I'll probably get back to Lambda PRs by the end of this week. |
@radeksimko I took a stab at it, lmk |
if strings.HasSuffix(fname, "s3") && *c.Version != "$LATEST" { | ||
return fmt.Errorf("Expected version $LATEST, got %s", *c.Version) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to separate this function out into more generic ones instead of hardcoding values, e.g.
testAccCheckAWSLambdaFunctionName(expectedName string, function *lambda.GetFunctionOutput)
testAccCheckAWSLambdaFunctionVersion(expectedVersion string, function *lambda.GetFunctionOutput)
Except the nitpick in the acceptance test case this is looking good. 👍 I spent some time reading the Lambda docs, specifically the part about versioning and I'd like to note though that i.e. That acceptance test doesn't do any harm, it tests the schema at least, but checking We don't expose |
@radeksimko refactored as per your comments. I don't have too much more time to put in this, so feel free to fork & make any necessary edits |
Thanks for the modifications.
No problem, I think this now looks ok on the first sight. I will do a final review by the end of this week, after #3825 is merged. |
@radeksimko is this blocked by #3825? |
Merged via #5370 |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Turns out
S3ObjectVersion
is not required by the S3 API. Since there's no way to get an object's version in terraform (afaik), it's useful to be able to leave it out.