Skip to content

feat(coderd_ai_provider): add Bedrock role_arn for cross-account assume-role#372

Open
ethanndickson wants to merge 1 commit into
ethan/agents-model-resourcefrom
ethan/bedrock-role-arn
Open

feat(coderd_ai_provider): add Bedrock role_arn for cross-account assume-role#372
ethanndickson wants to merge 1 commit into
ethan/agents-model-resourcefrom
ethan/bedrock-role-arn

Conversation

@ethanndickson

@ethanndickson ethanndickson commented Jun 26, 2026

Copy link
Copy Markdown
Member

Background

A customer running AWS Bedrock needs runtime IAM role assumption across multiple AWS accounts so usage bills to the correct account: a pod starts with its ambient AWS identity (IRSA / EKS Pod Identity / instance profile), then assumes a downstream role in another account via STS before calling Bedrock, with temp credentials cached and rotated by the AWS SDK. Static keys are not acceptable, and the base identity alone is insufficient since it's shared across providers.

This gap (AIGOV-371) was fixed server-side in coder/coder#26527 (backend: assume a configured role ARN via STS before calling Bedrock; cross-account is just the role's trust policy, and multiple accounts means multiple providers) and coder/coder#26578 (web UI follow-up). The only piece reaching this provider is one new role_arn field on codersdk.AIProviderBedrockSettings, plus server-side ARN validation. Everything else lives in aibridge / coderd / cli / UI, which this provider doesn't import.

What this PR does

Adds an optional role_arn to coderd_ai_provider's settings.bedrock block so the cross-account workflow is configurable via Terraform, not only the UI. Several roles means several providers; omitting it preserves today's behavior. Also updates the example and regenerates docs/.

SDK bump

role_arn isn't in any tagged codersdk release yet (latest v2.34.3 predates it), so go.mod is pinned to a pseudo-version of the coder/coder#26527 merge commit; re-pin to a real tag once one ships.

Closes CODAGT-607. Refs AIGOV-371. Refs coder/coder#26527, coder/coder#26578.

ethanndickson commented Jun 26, 2026

Copy link
Copy Markdown
Member Author

@linear-code

linear-code Bot commented Jun 26, 2026

Copy link
Copy Markdown

AIGOV-371

CODAGT-607

- `credentials_wo_version` (Number) Version for Bedrock write-only credentials. Bump this value to send, rotate, or clear credentials.
- `model` (String) Primary Bedrock model identifier.
- `region` (String) AWS region for Bedrock. If omitted, derived from the canonical Bedrock `base_url` attribute.
- `role_arn` (String) ARN of an AWS IAM role to assume via STS before calling Bedrock. The base identity (the AWS SDK default credential chain or the write-only credentials) signs the AssumeRole call, and the temporary credentials sign Bedrock requests. Enables cross-account Bedrock by pointing each provider at a role in the target account. Omit to call Bedrock with the base identity directly.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Few nits:

  • We use the term static credentials instead of write-only credentials, although the latter may make sense in the context of Terraform.
  • "Enables cross-account Bedrock by pointing each provider at a role in the target account." — I think this is too specific. Cross-account access is just one use case. Customers can configure any IAM role they want, including a role in the same AWS account. Docs: https://coder.com/docs/@main/ai-coder/ai-gateway/providers#amazon-bedrock

small_fast_model = "anthropic.claude-3-5-haiku-20241022-v1:0"
// Optional: assume an IAM role via STS before calling Bedrock. Point each
// provider at a role in the target account for cross-account Bedrock billing.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit:

  • cross-account Bedrock billing — again, this is too specific. RoleARN simply instructs AI Gateway to assume the specified IAM role. It has no notion of whether the role is cross-account, used for billing, or any other particular use case.

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.

2 participants