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

feat(stepfunctions-tasks): add optional role property to EvaluateExpressionProps #29288

Closed

Conversation

lagroujl
Copy link

@lagroujl lagroujl commented Feb 28, 2024

Issue # (if applicable)

Closes #29350.

Reason for this change

This change enables customers who need more control over IAM roles and whose environments do not allow them to use auto-generated roles to use EvaluateExpression.

Description of changes

Added a role property to EvaluateExpressionProps that allows customers to bring their own role. This would replace the role that is auto-generated by SingletonFunction when creating the Lambda Function used inside EvaluateExpression.

Description of how you validated changes

Added new unit test that validates created Function uses role created externally

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team February 28, 2024 00:08
@github-actions github-actions bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK p2 labels Feb 28, 2024
@lagroujl lagroujl changed the title feat(stepfunctions-tasks): add optional role property to allow customers to bring their own role feat(stepfunctions-tasks): add optional role property to EvaluateExpressionProps allow customers to bring their own role Feb 28, 2024
@lagroujl lagroujl changed the title feat(stepfunctions-tasks): add optional role property to EvaluateExpressionProps allow customers to bring their own role feat(stepfunctions-tasks): add optional role property to EvaluateExpressionProps to allow customers to bring their own role Feb 28, 2024
@lagroujl lagroujl changed the title feat(stepfunctions-tasks): add optional role property to EvaluateExpressionProps to allow customers to bring their own role feat(stepfunctions-tasks): add optional role property to EvaluateExpressionProps Feb 28, 2024
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@aws-cdk-automation aws-cdk-automation dismissed their stale review February 28, 2024 15:14

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

}

if (props.role) {
uuid += props.role.node.addr;
Copy link
Author

Choose a reason for hiding this comment

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

I am not totally sure if this is the right way to go about this. But the point is, I want the role to be part of the signature of the function created, so if I want to use different roles in one part of the stack or don't set a role at all, it will create different functions, instead of the first occurrence blocking all of the others.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a risk of this uuid being too long?

Copy link
Author

@lagroujl lagroujl Mar 20, 2024

Choose a reason for hiding this comment

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

I could not find one documented. Also, addr should have a fixed length of 42. SingletonFunction eventually passes it to tryFindChild. So that is where a length constraint could potentially come up, but otherwise, I think the risk is very low/none.

Copy link
Author

Choose a reason for hiding this comment

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

More likely, what I'm worried about is this addr value changing between deployments and deleting/recreating the function. I'm not sure I understand how the value of addr is calculated well enough to guarantee that won't happen

Copy link
Contributor

Choose a reason for hiding this comment

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

Are you able to test that? Does it change?

Copy link
Contributor

@paulhcsun paulhcsun Apr 26, 2024

Choose a reason for hiding this comment

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

What is the value of props.role.node.addr? Could we use the props.role.roleName/roleArn instead?

Copy link
Author

Choose a reason for hiding this comment

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

What is the value of props.role.node.addr?

https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.Node.html#addr

tl:dr; SHA-1 of the components of the construct path.

Could we use the props.role.roleName/roleArn instead?

No. this could be a token and change between deployments.

Copy link
Contributor

Choose a reason for hiding this comment

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

Were you able to test if the value of props.role.node.addr changes between deployments? From the description, Addresses are calculated using a SHA-1 of the components of the construct path., I'm not confident that it would be the same between deployments.

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Feb 28, 2024
@github-actions github-actions bot added the feature-request A feature should be added or improved. label Mar 4, 2024
}

if (props.role) {
uuid += props.role.node.addr;
Copy link
Contributor

@paulhcsun paulhcsun Apr 26, 2024

Choose a reason for hiding this comment

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

What is the value of props.role.node.addr? Could we use the props.role.roleName/roleArn instead?

Copy link
Contributor

@paulhcsun paulhcsun left a comment

Choose a reason for hiding this comment

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

Just one question and docstring change.

@aws-cdk-automation
Copy link
Collaborator

This PR has been in the MERGE CONFLICTS state for 3 weeks, and looks abandoned. To keep this PR from being closed, please continue work on it. If not, it will automatically be closed in a week.

@lagroujl
Copy link
Author

What is the value of props.role.node.addr?

https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.Node.html#addr

tl:dr; SHA-1 of the components of the construct path.

Could we use the props.role.roleName/roleArn instead?

No. this could be a token and change between deployments.

@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

@lagroujl lagroujl force-pushed the stepfunctions-tasks-evaluate-expression-role branch 2 times, most recently from da1d06c to 6d82f21 Compare June 17, 2024 13:15
@lagroujl lagroujl force-pushed the stepfunctions-tasks-evaluate-expression-role branch from 6d82f21 to 695a608 Compare June 17, 2024 13:16
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@aws-cdk-automation aws-cdk-automation dismissed their stale review June 17, 2024 15:06

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 04d2a2d
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

1 similar comment
@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

@aws-cdk-automation
Copy link
Collaborator

This PR has been in the MERGE CONFLICTS state for 3 weeks, and looks abandoned. To keep this PR from being closed, please continue work on it. If not, it will automatically be closed in a week.

@aws-cdk-automation
Copy link
Collaborator

This PR has been deemed to be abandoned, and will be automatically closed. Please create a new PR for these changes if you think this decision has been made in error.

@aws-cdk-automation aws-cdk-automation added the closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. label Jul 21, 2024
Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(stepfunctions-tasks): support bring your own role for Lambda created by EvaluteExpression
4 participants