Skip to content

Commit 2767bdb

Browse files
committed
Fix 'acctest.ConfigBedrockAgentKnowledgeBaseRDSBase'.
1 parent a511066 commit 2767bdb

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

internal/acctest/configs.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -752,17 +752,22 @@ resource "aws_iam_role_policy_attachment" "secrets_manager_read_write" {
752752
policy_arn = "arn:${data.aws_partition.current.partition}:iam::${data.aws_partition.current.partition}:policy/SecretsManagerReadWrite"
753753
}
754754
755+
data "aws_rds_orderable_db_instance" "test" {
756+
engine = "aurora-postgresql"
757+
engine_latest_version = true
758+
preferred_instance_classes = ["db.serverless"]
759+
}
760+
755761
resource "aws_rds_cluster" "test" {
756762
cluster_identifier = %[1]q
757-
engine = "aurora-postgresql"
758-
engine_mode = "provisioned"
759-
engine_version = "15.4"
760-
database_name = "test"
761763
master_username = "test"
762764
manage_master_user_password = true
765+
database_name = "test"
766+
skip_final_snapshot = true
767+
engine = data.aws_rds_orderable_db_instance.test.engine
768+
engine_version = data.aws_rds_orderable_db_instance.test.engine_version
763769
enable_http_endpoint = true
764770
vpc_security_group_ids = [aws_security_group.test.id]
765-
skip_final_snapshot = true
766771
db_subnet_group_name = aws_db_subnet_group.test.name
767772
768773
serverlessv2_scaling_configuration {
@@ -846,7 +851,7 @@ resource "null_resource" "db_setup" {
846851
psql -h ${aws_rds_cluster.test.endpoint} -U ${aws_rds_cluster.test.master_username} -d ${aws_rds_cluster.test.database_name} -c "CREATE SCHEMA IF NOT EXISTS bedrock_new;"
847852
psql -h ${aws_rds_cluster.test.endpoint} -U ${aws_rds_cluster.test.master_username} -d ${aws_rds_cluster.test.database_name} -c "CREATE ROLE bedrock_user WITH PASSWORD '$PGPASSWORD' LOGIN;"
848853
psql -h ${aws_rds_cluster.test.endpoint} -U ${aws_rds_cluster.test.master_username} -d ${aws_rds_cluster.test.database_name} -c "GRANT ALL ON SCHEMA bedrock_integration TO bedrock_user;"
849-
psql -h ${aws_rds_cluster.test.endpoint} -U ${aws_rds_cluster.test.master_username} -d ${aws_rds_cluster.test.database_name} -c "CREATE TABLE bedrock_integration.bedrock_kb (id uuid PRIMARY KEY, embedding vector(1536), chunks text, metadata json);"
854+
psql -h ${aws_rds_cluster.test.endpoint} -U ${aws_rds_cluster.test.master_username} -d ${aws_rds_cluster.test.database_name} -c "CREATE TABLE bedrock_integration.bedrock_kb (id uuid PRIMARY KEY, embedding vector(1536), chunks text, metadata json, custom_metadata jsonb);"
850855
psql -h ${aws_rds_cluster.test.endpoint} -U ${aws_rds_cluster.test.master_username} -d ${aws_rds_cluster.test.database_name} -c "CREATE INDEX ON bedrock_integration.bedrock_kb USING hnsw (embedding vector_cosine_ops);"
851856
psql -h ${aws_rds_cluster.test.endpoint} -U ${aws_rds_cluster.test.master_username} -d ${aws_rds_cluster.test.database_name} -c "CREATE INDEX ON bedrock_integration.bedrock_kb USING gin (to_tsvector('simple', chunks));"
852857
EOT

0 commit comments

Comments
 (0)