feat: add AWS Bedrock access for OpenCode with batch inference support - #14
Merged
Conversation
Add opencode-bedrock IAM user scoped to Anthropic models via foundation model and inference profile ARNs (Opus 4.x requires inference profiles). Batch inference (50% discount vs on-demand) requires CreateModelInvocationJob with a mandatory service role ARN and S3 input/output, so this also adds the bedrock-batch-inference service role, mitw-bedrock-batch bucket, and PassRole/S3 permissions for the user.
OpenTofu Plan |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds AWS Bedrock access for OpenCode (Claude Opus) with full batch inference support for the 50% Batch API discount.
aws-bedrock.tf(new):opencode-bedrockIAM user + access key, scoped to Anthropic models via bothfoundation-model/anthropic.*andinference-profile/*.anthropic.*ARNs — Opus 4.x rejects base model IDs and must be called through inference profilesbedrock-batch-inferenceservice role (trusted bybedrock.amazonaws.com, SourceAccount/SourceArn conditions) —CreateModelInvocationJobrequires aroleArnfor S3 I/Omitw-bedrock-batchS3 bucket (fully private,prevent_destroy) for batch input JSONL and outputCreate/Get/Stop/List), batch S3 data access, andiam:PassRoleconstrained withiam:PassedToService: bedrock.amazonaws.comoutputs.tf:bedrock_opencode_access_key(sensitive), user ARN, batch service role ARN, batch bucket nameREADME.md: regenerated via terraform-docsNotes
Validation
make test— all canonical pre-commit hooks pass (tofu validate with-backend=false, tflint, checkov, fmt, terraform-docs, gitleaks)