variable "enabled" { type = bool default = true description = "Whether to create Bedrock resources" } variable "region" { type = string description = "AWS region" } variable "namespace" { type = string default = "ai" description = "Namespace for resource naming" } variable "lab" { type = string description = "Lab identifier" } variable "stage" { type = string default = "test" description = "Stage" } variable "name" { type = string default = "bedrock" description = "Resource name suffix" } # Knowledge Base settings variable "create_knowledge_base" { type = bool default = false description = "Create a Bedrock Knowledge Base (requires OpenSearch Serverless or other vector store)" } variable "knowledge_base_name" { type = string default = "ai-lab-kb" description = "Name for the Knowledge Base" } variable "knowledge_base_description" { type = string default = "Knowledge Base for AI Lab hands-on exercises" description = "Description for the Knowledge Base" } # Embedding model for Knowledge Base variable "embedding_model_arn" { type = string default = null description = "ARN of the embedding model for Knowledge Base. When null, defaults to amazon.titan-embed-text-v2:0 in the stack's region (computed from data.aws_region)." } variable "knowledge_base_index_ready" { type = bool default = false description = "Set to true after you create the vector index in the OpenSearch Serverless collection. Terraform does not create the index; the Knowledge Base and data source are only created when this is true." } variable "kb_vector_index_name" { type = string default = "bedrock-knowledge-base-default-index" description = "Name of the vector index you create in the OpenSearch Serverless collection" } variable "kb_vector_field_name" { type = string default = "bedrock-knowledge-base-default-vector" description = "Name of the knn_vector field in the vector index" } variable "kb_admin_principal_arns" { type = list(string) default = [] description = "IAM principal ARNs (users or roles) that may manage the OpenSearch Serverless collection and its indexes. When empty, the ARN of the identity running Terraform is used. Set this to your IAM role ARN if you sign in with SSO or another assumed role." } # S3 Data Source settings variable "create_s3_data_source" { type = bool default = false description = "Create S3 bucket as data source for Knowledge Base" } variable "data_source_bucket_arn" { type = string default = null description = "ARN of existing S3 bucket for Knowledge Base data source" } variable "data_source_inclusion_prefixes" { type = list(string) default = [] description = "S3 prefixes to include in the data source (e.g., ['documents/', 'knowledge/'])" } # OpenSearch Serverless settings (vector store for Knowledge Base) variable "opensearch_collection_name" { type = string default = null description = "Name for OpenSearch Serverless collection (auto-generated if null)" } variable "opensearch_standby_replicas" { type = string default = "DISABLED" description = "Standby replicas for OpenSearch collection (ENABLED or DISABLED)" } # Chunking strategy for Knowledge Base variable "chunking_strategy" { type = string default = "FIXED_SIZE" description = "Chunking strategy for documents (FIXED_SIZE, NONE, HIERARCHICAL, SEMANTIC)" } variable "chunk_max_tokens" { type = number default = 300 description = "Maximum tokens per chunk (for FIXED_SIZE strategy)" } variable "chunk_overlap_percentage" { type = number default = 20 description = "Overlap percentage between chunks (for FIXED_SIZE strategy)" } # Guardrails settings variable "create_guardrail" { type = bool default = false description = "Create a Bedrock Guardrail for content filtering" } variable "guardrail_blocked_input_message" { type = string default = "I cannot process this request due to content policy restrictions." description = "Message returned when input is blocked" } variable "guardrail_blocked_output_message" { type = string default = "I cannot provide this response due to content policy restrictions." description = "Message returned when output is blocked" } # Content filter strengths variable "content_filter_config" { type = object({ hate_input_strength = string hate_output_strength = string insults_input_strength = string insults_output_strength = string sexual_input_strength = string sexual_output_strength = string violence_input_strength = string violence_output_strength = string misconduct_input_strength = string misconduct_output_strength = string }) default = { hate_input_strength = "HIGH" hate_output_strength = "HIGH" insults_input_strength = "HIGH" insults_output_strength = "HIGH" sexual_input_strength = "HIGH" sexual_output_strength = "HIGH" violence_input_strength = "MEDIUM" violence_output_strength = "MEDIUM" misconduct_input_strength = "HIGH" misconduct_output_strength = "HIGH" } description = "Content filter configuration for guardrails (NONE, LOW, MEDIUM, HIGH)" } # Model invocation logging variable "enable_model_invocation_logging" { type = bool default = false description = "Enable account-wide (per region) CloudWatch logging of model invocations. This logs the prompts and responses of every model call in the region, so it is off by default." } variable "log_retention_days" { type = number default = 7 description = "Number of days to retain logs" } variable "tags" { type = map(string) default = {} description = "Additional tags" }