Skip to content
New issue

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

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

Already on GitHub? # to your account

Update Lambda and IAM role ARN validation rules #229

Merged
merged 2 commits into from
Mar 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,21 +1,37 @@
import { FormFieldInput } from '@restate/ui/form-field';
import { useRegisterDeploymentContext } from './Context';
import { InlineTooltip } from '@restate/ui/tooltip';

export function AssumeARNRole() {
const { updateAssumeRoleArn, assumeRoleArn } = useRegisterDeploymentContext();

return (
<FormFieldInput
name="assume_role_arn"
placeholder="arn:aws:sts::{acc}:assumed-role/{role}/{func}"
pattern="^arn:aws:sts::(\d{12}):assumed-role\/([^\/]+)\/([^\/]+)$"
placeholder="arn:aws:iam::{account}:role/{role-name}"
pattern="^arn:aws:iam::\d{12}:role(\/[\w-]+)*\/[\w+-]+$"
value={assumeRoleArn}
onChange={updateAssumeRoleArn}
label={
<>
<span slot="title">Assume role ARN</span>
<span slot="title">
<InlineTooltip
title="Assumed role"
description={
<p>
This role must exist in your account, it must trust Restate
Cloud to assume it, and it must have permission to invoke the
Lambda function containing the handler.
</p>
}
learnMoreHref="https://docs.restate.dev/deploy/server/cloud#aws-lambda-services"
>
Role ARN
</InlineTooltip>
</span>
<span slot="description" className="leading-5 text-code block">
ARN of a role to use when invoking the Lambda
AWS role ARN that Restate Cloud can assume to invoke the Lambda
function
</span>
</>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export function RegistrationForm() {
</ServiceDeploymentExplainer>
</>
}
description="Please provide the HTTP endpoint or Lambda ARN where your service is running:"
description="Please provide the HTTP endpoint or Lambda function version ARN where your service is running:"
>
<EndpointForm />
</Container>
Expand Down Expand Up @@ -138,13 +138,13 @@ function EndpointForm() {
type={isLambda ? 'text' : 'url'}
{...(isLambda && {
pattern:
'^arn:aws:lambda:[a-z0-9\\-]+:\\d+:function:[a-zA-Z0-9\\-_]+:\\d+$',
'^arn:aws:lambda:[a-z0-9\\-]+:\\d+:function:[a-zA-Z0-9\\-_]+:.+$',
})}
name="endpoint"
className="[&_.error]:absolute [&_.error]:pt-1 [&_input:not([type=radio])]:absolute left-0 right-0 my-2 [&_input:not([type=radio])]:pr-[4.75rem]"
placeholder={
isLambda
? 'arn:aws:lambda:{reg}:{acc}:function:{func}:{version}'
? 'arn:aws:lambda:{region}:{account}:function:{function-name}:{version}'
: 'http://localhost:9080'
}
label={isLambda ? 'Lambda ARN' : 'HTTP endpoint'}
Expand Down
Loading