Skip to content

Gate AWS Lambda role/external-id requirement behind --aws-lambda-skip-role-and-external-id - #1140

Merged
mani-j9 merged 3 commits into
mainfrom
mani/relax-lambda-role-eid-validation
Aug 5, 2026
Merged

Gate AWS Lambda role/external-id requirement behind --aws-lambda-skip-role-and-external-id#1140
mani-j9 merged 3 commits into
mainfrom
mani/relax-lambda-role-eid-validation

Conversation

@mani-j9

@mani-j9 mani-j9 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

What changed?

Why

create-version and update-version-compute-config currently require --aws-lambda-assume-role-arn and --aws-lambda-assume-role-external-id whenever --aws-lambda-function-arn is set. The Temporal server governs whether these are actually mandatory via the global require_role_and_external_id setting (default true), so a role-less config is valid against servers where that setting is disabled — e.g. local dev against LocalStack. CLI's validation needs to be relaxed to allow role less config creation.

How

This PR allows the role less config by adding a new CLI parameter --aws-lambda-skip-role-and-external-id. By default the CLI keeps requiring both(role and id) fields and fails fast with an actionable client-side error that names the missing flag. Passing the flag specifically opts out of the client-side check and defers entirely to the server's policy.

Testing

With flag set as default true

mani@manis-MacBook-Pro temporal-cli % ./temporal worker deployment create-version --address 127.0.0.1:7333 --deployment-name test-deploy --build-id b-noRole \
  --aws-lambda-function-arn arn:aws:lambda:us-east-1:123456789012:function:MyExampleFunction:1
Error: missing required AWS Lambda provider detail: role

mani@manis-MacBook-Pro temporal-cli % ./temporal worker deployment create-version --address 127.0.0.1:7333 --deployment-name test-deploy --build-id b-noEid \
  --aws-lambda-function-arn arn:aws:lambda:us-east-1:123456789012:function:MyExampleFunction:1 \
  --aws-lambda-assume-role-arn arn:aws:iam::123456789012:role/MyServiceRole
Error: missing required AWS Lambda provider detail: role_external_id

mani@manis-MacBook-Pro temporal-cli % ./temporal worker deployment create-version --address 127.0.0.1:7333 --deployment-name test-deploy --build-id b-skipRole \
  --aws-lambda-function-arn arn:aws:lambda:us-east-1:123456789012:function:MyExampleFunction:1 \
  --aws-lambda-assume-role-arn arn:aws:iam::123456789012:role/MyServiceRole \
  --aws-lambda-skip-role-and-external-id
Error: AWS Lambda provider detail "role" must not be set when --aws-lambda-skip-role-and-external-id is passed

mani@manis-MacBook-Pro temporal-cli % ./temporal worker deployment create-version --address 127.0.0.1:7333 --deployment-name test-deploy --build-id b-skipOnly \
  --aws-lambda-function-arn arn:aws:lambda:us-east-1:123456789012:function:MyExampleFunction:1 \
  --aws-lambda-skip-role-and-external-id
Error: error creating worker deployment version: no Worker Deployment found with name 'test-deploy'; does your Worker Deployment have pollers?

mani@manis-MacBook-Pro temporal-cli % ./temporal worker deployment create-version --address 127.0.0.1:7333 --deployment-name test-deploy --build-id b-skipEid \
  --aws-lambda-function-arn arn:aws:lambda:us-east-1:123456789012:function:MyExampleFunction:1 \
  --aws-lambda-assume-role-external-id external-id \
  --aws-lambda-skip-role-and-external-id
Error: AWS Lambda provider detail "role_external_id" must not be set when --aws-lambda-skip-role-and-external-id is passed

mani@manis-MacBook-Pro temporal-cli % ./temporal worker deployment update-version-compute-config --address 127.0.0.1:7333 --deployment-name test-deploy --build-id b-skipRole \
  --aws-lambda-function-arn arn:aws:lambda:us-east-1:123456789012:function:MyExampleFunction:1 \
  --aws-lambda-assume-role-arn arn:aws:iam::123456789012:role/MyServiceRole \
  --aws-lambda-skip-role-and-external-id
Error: AWS Lambda provider detail "role" must not be set when --aws-lambda-skip-role-and-external-id is passed

mani@manis-MacBook-Pro temporal-cli % ./temporal worker deployment update-version-compute-config --address 127.0.0.1:7333 --deployment-name test-deploy --build-id b-skipOnly \
  --aws-lambda-function-arn arn:aws:lambda:us-east-1:123456789012:function:MyExampleFunction:1 \
  --aws-lambda-skip-role-and-external-id
Error: error updating worker deployment version compute config: build ID 'b-skipOnly' not found in Worker Deployment 'test-deploy'
mani@manis-MacBook-Pro temporal-cli % 

for when the local server's require_role_and_external_id flag is set to false

mani@manis-MacBook-Pro temporal-cli % ./temporal worker deployment create-version --address 127.0.0.1:7333 --deployment-name skip-demo --build-id skip-test-1 \
  --aws-lambda-function-arn arn:aws:lambda:us-east-1:123456789012:function:MyExampleFunction:1 \
  --aws-lambda-skip-role-and-external-id
Error: error creating worker deployment version: no Worker Deployment found with name 'skip-demo'; does your Worker Deployment have pollers?
mani@manis-MacBook-Pro temporal-cli % ./temporal worker deployment create-version --address 127.0.0.1:7333 --deployment-name skip-demo --build-id role-test-1 \
  --aws-lambda-function-arn arn:aws:lambda:us-east-1:123456789012:function:MyExampleFunction:1 \
  --aws-lambda-assume-role-arn arn:aws:iam::123456789012:role/MyServiceRole \
  --aws-lambda-assume-role-external-id external-id
Error: error creating worker deployment version: no Worker Deployment found with name 'skip-demo'; does your Worker Deployment have pollers?
mani@manis-MacBook-Pro temporal-cli % ./temporal worker deployment create-version --address 127.0.0.1:7333 --deployment-name skip-demo --build-id skip-neg-1 \
  --aws-lambda-function-arn arn:aws:lambda:us-east-1:123456789012:function:MyExampleFunction:1 \
  --aws-lambda-assume-role-arn arn:aws:iam::123456789012:role/MyServiceRole \
  --aws-lambda-skip-role-and-external-id
Error: AWS Lambda provider detail "role" must not be set when --aws-lambda-skip-role-and-external-id is passed

mani@manis-MacBook-Pro temporal-cli % ./temporal worker deployment update-version-compute-config --address 127.0.0.1:7333 --deployment-name skip-demo --build-id poller-build --aws-lambda-function-arn arn:aws:lambda:us-east-1:123456789012:function:MyExampleFunction:1 --aws-lambda-skip-role-and-external-id

Error: error updating worker deployment version compute config: default: lambda GetFunction failed: operation error Lambda: GetFunction, get identity: get credentials: failed to refresh cached credentials, no EC2 IMDS role found, operation error ec2imds: GetMetadata, request canceled, context deadline exceeded
mani@manis-MacBook-Pro temporal-cli % 

@mani-j9
mani-j9 requested a review from a team as a code owner July 28, 2026 17:29
@CLAassistant

CLAassistant commented Jul 28, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


mani seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@mani-j9
mani-j9 force-pushed the mani/relax-lambda-role-eid-validation branch from 137d686 to dc3da76 Compare July 29, 2026 16:14
@mani-j9
mani-j9 requested a review from Copilot July 29, 2026 17:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR removes client-side enforcement of AWS Lambda assume-role ARN and external ID when configuring Worker Deployment compute settings, relying instead on Temporal server-side policy (require_role_and_external_id) so that role-less configurations (e.g., LocalStack/dev setups) are not blocked by the CLI.

Changes:

  • Relaxed CLI validation so AWS Lambda compute provider details only require the function ARN.
  • Updated CLI flag documentation/help text to no longer claim role/external ID are always required when a function ARN is set.
  • Updated create-version error tests to assert server-side rejection when role/external ID are omitted under default server settings.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
internal/temporalcli/commands.yaml Updated flag descriptions to remove unconditional “required” wording for AWS Lambda role/external ID.
internal/temporalcli/commands.worker.deployment.go Relaxed AWS Lambda provider-details validation to only require ARN.
internal/temporalcli/commands.worker.deployment_test.go Updated error expectations to match server-side validation messages.
internal/temporalcli/commands.gen.go Regenerated/updated Cobra flag help strings consistent with updated YAML descriptions.
Comments suppressed due to low confidence (3)

internal/temporalcli/commands.yaml:1487

  • The update-version compute config command has the same documentation issue: clarify that this flag only applies when --aws-lambda-function-arn is being used, and that server-side settings may still require it.
          AWS IAM role ARN that the Temporal server will assume when invoking
          the Lambda function that spawns a new Worker in this Worker
          Deployment Version.

internal/temporalcli/commands.yaml:1493

  • Likewise, clarify that the external ID is only applicable alongside the AWS Lambda function ARN (and role ARN), and may still be required depending on server configuration.
          Temporal server will enforce that the AWS IAM trust policy associated
          with the AWS IAM role specified in --aws-lambda-assume-role-arn has
          an aws:ExternalId condition that matches the supplied value.

internal/temporalcli/commands.gen.go:4039

  • Same documentation concern for update-version-compute-config: the help text should clarify these flags are only applicable with --aws-lambda-function-arn, and that server-side configuration may still require them.
	s.Command.Flags().StringVar(&s.AwsLambdaAssumeRoleArn, "aws-lambda-assume-role-arn", "", "AWS IAM role ARN that the Temporal server will assume when invoking the Lambda function that spawns a new Worker in this Worker Deployment Version.")
	s.Command.Flags().StringVar(&s.AwsLambdaAssumeRoleExternalId, "aws-lambda-assume-role-external-id", "", "Temporal server will enforce that the AWS IAM trust policy associated with the AWS IAM role specified in --aws-lambda-assume-role-arn has an aws:ExternalId condition that matches the supplied value.")

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/temporalcli/commands.yaml Outdated
Comment thread internal/temporalcli/commands.worker.deployment.go Outdated
Comment thread internal/temporalcli/commands.yaml Outdated
Comment thread internal/temporalcli/commands.gen.go Outdated

@02strich 02strich left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I am sorry for the long delay on review. Instead of making the existing flags optional, I would prefer to have a new flag that indicates that the user wants to disable the security setting - and then either that or the external ID flag need to be set. That way there is no oopsie moment risk.

@mani-j9
mani-j9 force-pushed the mani/relax-lambda-role-eid-validation branch from 087599d to 7e56bd9 Compare July 30, 2026 19:08
@mani-j9 mani-j9 changed the title Make AWS Lambda role and external ID optional in create-version Gate AWS Lambda role/external-id requirement behind --aws-lambda-skip-role-and-external-id Jul 30, 2026
@mani-j9
mani-j9 force-pushed the mani/relax-lambda-role-eid-validation branch from dbac0fc to e0eeaf1 Compare July 30, 2026 19:31
…ment

create-version and update-version-compute-config require
--aws-lambda-assume-role-arn and --aws-lambda-assume-role-external-id
whenever --aws-lambda-function-arn is specified. The Temporal server
governs whether these are actually mandatory via its global
require_role_and_external_id setting (default true), so a role-less
config is valid against servers where that setting is disabled (e.g.
local dev against LocalStack).

--aws-lambda-skip-role-and-external-id (bool, default false) opts out of
the client-side requirement, so the CLI defers that policy to the server.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mani-j9
mani-j9 force-pushed the mani/relax-lambda-role-eid-validation branch from e0eeaf1 to 5f42868 Compare July 30, 2026 19:40
Comment thread internal/temporalcli/commands.worker.deployment.go Outdated
Comment thread internal/temporalcli/commands.worker.deployment_test.go
Comment thread internal/temporalcli/commands.worker.deployment.go Outdated
Comment thread internal/temporalcli/commands.yaml Outdated
description: |
Permit omitting --aws-lambda-assume-role-arn and
--aws-lambda-assume-role-external-id when --aws-lambda-function-arn
is specified. Both are required unless this flag is passed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Continue from a previous comment: I think this should clarify whether the two flags (or one of them) can still be passed if this flag is passed? i.e., which of these:

Both are required unless this flag is passed, in which case both must be omitted. (may need to reword)

vs.

Both are required if this flag is not provided, otherwise they are treated as optional.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done, reworded this to specfically call out that the optional bit, let me know if you had any suggestions on the latest revision.

- Reject --aws-lambda-assume-role-arn / --aws-lambda-assume-role-external-id
  when --aws-lambda-skip-role-and-external-id is passed (validated in
  validateAWSLambdaProviderDetails alongside the required-detail checks).
- Reword the flag descriptions to state that the role and external ID are
  required unless the skip flag is passed, in which case both must be omitted.
- Drop a verbose inline comment.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mani-j9
mani-j9 force-pushed the mani/relax-lambda-role-eid-validation branch 2 times, most recently from cd64725 to 2da04af Compare August 5, 2026 18:10
@mani-j9
mani-j9 added this pull request to the merge queue Aug 5, 2026
Merged via the queue into main with commit 6e3ae1e Aug 5, 2026
11 checks passed
@mani-j9
mani-j9 deleted the mani/relax-lambda-role-eid-validation branch August 5, 2026 20:18
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.

5 participants