|
| 1 | +# Terraform AWS ARC Bedrock Module Usage Guide |
| 2 | + |
| 3 | +## Introduction |
| 4 | + |
| 5 | +### Purpose of the Document |
| 6 | + |
| 7 | +This document provides guidelines and instructions for users looking to implement Terraform module for Bedrock agents |
| 8 | + |
| 9 | +### Module Overview |
| 10 | + |
| 11 | +The [terraform-aws-arc-bedrock](https://github.com/sourcefuse/terraform-aws-arc-bedrock) module provides a reusable and scalable way to deploy AWS Bedrock Agents along with their associated components, including collaborators, action groups, and IAM roles. It allows users to define agents with configurable foundation models, instructions, and collaboration settings. |
| 12 | + |
| 13 | +### Prerequisites |
| 14 | + |
| 15 | +Before using this module, ensure you have the following: |
| 16 | + |
| 17 | +- AWS credentials configured. |
| 18 | +- Terraform installed. |
| 19 | +- A working knowledge of AWS Bedrock Agent |
| 20 | + |
| 21 | +## Getting Started |
| 22 | + |
| 23 | +### Module Source |
| 24 | + |
| 25 | +To use the module in your Terraform configuration, include the following source block: |
| 26 | + |
| 27 | +```hcl |
| 28 | +module "bedrock_agent" { |
| 29 | + source = "sourcefuse/arc-bedrock/aws" |
| 30 | + version = "0.0.1" |
| 31 | + # insert the required variables here |
| 32 | +} |
| 33 | +``` |
| 34 | + |
| 35 | +### Integration with Existing Terraform Configurations |
| 36 | + |
| 37 | +Integrate the module with your existing Terraform mono repo configuration, follow the steps below: |
| 38 | + |
| 39 | +1. Create a new folder in `terraform/` named `bedrock`. |
| 40 | +2. Create the required files, see the [examples](https://github.com/sourcefuse/terraform-aws-arc-bedrock/tree/main/examples/bedrock_agent) to base off of. |
| 41 | +3. Configure with your backend |
| 42 | + - Create the environment backend configuration file: `config.<environment>.hcl` |
| 43 | + - **region**: Where the backend resides |
| 44 | + - **key**: `<working_directory>/terraform.tfstate` |
| 45 | + - **bucket**: Bucket name where the terraform state will reside |
| 46 | + - **dynamodb_table**: Lock table so there are not duplicate tfplans in the mix |
| 47 | + - **encrypt**: Encrypt all traffic to and from the backend |
| 48 | + |
| 49 | +### Required AWS Permissions |
| 50 | + |
| 51 | +Ensure that the AWS credentials used to execute Terraform have the necessary permissions to create Bedrock Agent |
| 52 | + |
| 53 | +## Module Configuration |
| 54 | + |
| 55 | +### Input Variables |
| 56 | + |
| 57 | +For a list of input variables, see the README [Inputs](https://github.com/sourcefuse/terraform-aws-arc-bedrock?tab=readme-ov-file#inputs) section. |
| 58 | + |
| 59 | +### Output Values |
| 60 | + |
| 61 | +For a list of outputs, see the README [Outputs](https://github.com/sourcefuse/terraform-aws-arc-bedrock?tab=readme-ov-file#outputs) section. |
| 62 | + |
| 63 | +## Module Usage |
| 64 | + |
| 65 | +### Bedrock Agents |
| 66 | + |
| 67 | +For usage, see the [example](https://github.com/sourcefuse/terraform-aws-arc-bedrock/tree/main/examples/bedrock-agent) folder. |
| 68 | + |
| 69 | +This example will create: |
| 70 | + |
| 71 | +- **Bedrock Agent**: Creates and configures AWS Bedrock Agents with foundation models, collaboration settings, and execution policies. |
| 72 | +- **Agent Collaborators**: Defines collaborators with specific roles and permissions to interact with the Bedrock Agent. |
| 73 | +- **Action Groups**: Configures action groups with execution logic, enabling custom behaviors via AWS Lambda functions. |
| 74 | +- **IAM Roles & Policies**: Creates IAM roles and policies required for agents, collaborators, and action groups to interact securely. |
| 75 | +- **Agent Aliases**: Manages agent versions and aliases for controlled deployment and rollback strategies. |
| 76 | + |
| 77 | +### Tips and Recommendations |
| 78 | + |
| 79 | +- Currently, there is an issue when multiple collaborators are created simultaneously. To resolve this, use the `-parallelism=1` flag: |
| 80 | +```hcl |
| 81 | +terraform apply -parallelism=1 |
| 82 | +``` |
| 83 | + |
| 84 | +Other Option is to use individual module block for each colloborator agents |
| 85 | + |
| 86 | +**Error** : |
| 87 | +``` |
| 88 | +Prepare operation can't be performed on Agent when it is |
| 89 | +│ in Preparing state. Retry the request when the agent is in a valid state. |
| 90 | +``` |
| 91 | + |
| 92 | +## Troubleshooting |
| 93 | + |
| 94 | +### Reporting Issues |
| 95 | + |
| 96 | +If you encounter a bug or issue, please report it on the [GitHub repository](https://github.com/sourcefuse/terraform-aws-arc-bedrock/issues). |
| 97 | + |
| 98 | +## Security Considerations |
| 99 | + |
| 100 | +Understand the security considerations related to Bedrock Agents |
| 101 | + |
| 102 | +## Contributing and Community Support |
| 103 | + |
| 104 | +### Contributing Guidelines |
| 105 | + |
| 106 | +Contribute to the module by following the guidelines outlined in the [CONTRIBUTING.md](https://github.com/sourcefuse/terraform-aws-arc-bedrock/blob/main/CONTRIBUTING.md) file. |
| 107 | + |
| 108 | +### Reporting Bugs and Issues |
| 109 | + |
| 110 | +If you find a bug or issue, report it on the [GitHub repository](https://github.com/sourcefuse/terraform-aws-arc-bedrock/issues). |
| 111 | + |
| 112 | +## License |
| 113 | + |
| 114 | +### License Information |
| 115 | + |
| 116 | +This module is licensed under the Apache 2.0 license. Refer to the [LICENSE](https://github.com/sourcefuse/terraform-aws-arc-bedrock/blob/main/LICENSE) file for more details. |
| 117 | + |
| 118 | +### Open Source Contribution |
| 119 | + |
| 120 | +Contribute to open source by using and enhancing this module. Your contributions are welcome! |
0 commit comments