-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
feat(cloudfront): define lambda@edge as resolvable resource #2861
Conversation
@rix0rrr Would you mind to review the second part of the lambda@edge support? |
c11b70c
to
c1f2e76
Compare
@rix0rrr I've integrated all your required changes |
4c4e3a8
to
2dc398b
Compare
@rix0rrr At least everything compiles now and the test look fine. I'm not sure if this is working, since using this in our project with the current CDK build and |
* @param versionArn The version ARN to create this version from | ||
*/ | ||
public static fromVersionArn(scope: Construct, id: string, versionArn: string): IVersion { | ||
return Version.fromVersionAttributes(scope, id, { |
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.
What you did here is correct, but the VersionArn now renders to something super silly, as you can tell from the test output.
It renders to Join(":", [Select(0, Split(":", Arn)), Select(1, Split(":", Arn)), ..., Select(6, Split(":", Arn))]) + ":" + Select(7, Split(":", Arn))
, which is just a very roundabout way of getting the same value again.
Could you do something similar to the class Import
block defined in the function below, and obtain functionName
and functionArn
in a more direct way (with fewer splits)?
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.
I can only assume that the version ARN is the function ARN with appended :version
and split it with typescript code. That will fail if one puts in a reference here, but that might be okay?
Otherwise I cannot assume anything about the content of versionArn
. Therefore I used the cdk Fn helper to split and concat parts 0-6 (not 0-7), but jepp - thats kind of silly.
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.
@rix0rrr I think it is not a valid assumtion that the value of versionArn
is a literal string. The case described in the unit test by itself already fails that assumtion. So maybe we should keep the silly thing? At least it splits the version from the given ARN.
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.
I think it is not a valid assumtion that the value of
versionArn
is a literal string.
No, but the passed versionArn
could go directly into functionArn
.
The only thing that then would need splitting is functionName
, which can be obtained by Fn.select(6, Fn.split(':', versionArn))
.
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.
I've updated the implementation in addition with a rebase.
Unfortunately I couldn't compile the actual master so I haven't run (or updated) the tests.
@rix0rrr Do you have an option to get around the open issue/change? I have no idea to solve this. Could you please rereview? |
5292fa9
to
0171ac9
Compare
@rix0rrr I've rebased this to the latest release. |
This declaration is required for deploying custom resources as lamdba association, which by itself is required to deploy a lambda@edge for a stack which is in a different region as 'us-east-1'. Relates to aws#1575
This commit allows to reference a lambda from a different region and use that as function association.
0171ac9
to
a819402
Compare
Pull Request Checklist
|
Pull Request Checklist
|
Codebuild (Continuous Integration) build failed for current commits. Please check log and resolve before PR is merged. |
Temporarily not merging while we are releasing. |
Thank you for contributing! Your pull request is now being automatically merged. |
Thank you for contributing! Your pull request is now being automatically merged. |
Thank you for contributing! Your pull request is now being automatically merged. |
This declaration is required for deploying custom resources as lamdba
association, which by itself is required to deploy a lambda@edge for a
stack which is in a different region as 'us-east-1'.
Relates to #1575
Pull Request Checklist
design
folderBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license.