Skip to content

Commit 807fe50

Browse files
committed
bedrockagent: gate tests which depend on Amazon Titan foundation models
```console % make t K=bedrockagent T=TestAccBedrockAgent_serial/DataSource make: Verifying source code with gofmt... ==> Checking that code complies with gofmt requirements... make: Running acceptance tests on branch: 🌿 td-bedrock-nova 🌿... TF_ACC=1 go1.26.2 test ./internal/service/bedrockagent/... -v -count 1 -parallel 20 -run='TestAccBedrockAgent_serial/DataSource' -timeout 360m -vet=off 2026/05/08 15:06:01 Creating Terraform AWS Provider (SDKv2-style)... 2026/05/08 15:06:01 Initializing Terraform AWS Provider (SDKv2-style)... === RUN TestAccBedrockAgent_serial === PAUSE TestAccBedrockAgent_serial === CONT TestAccBedrockAgent_serial === RUN TestAccBedrockAgent_serial/DataSource === RUN TestAccBedrockAgent_serial/DataSource/disappears data_source_test.go:351: skipping test; environment variable TF_AWS_BEDROCK_TITAN_MODELS_ALLOWED must be set === RUN TestAccBedrockAgent_serial/DataSource/update data_source_test.go:378: skipping test; environment variable TF_AWS_BEDROCK_TITAN_MODELS_ALLOWED must be set === RUN TestAccBedrockAgent_serial/DataSource/hierarchical data_source_test.go:148: skipping test; environment variable TF_AWS_BEDROCK_TITAN_MODELS_ALLOWED must be set === RUN TestAccBedrockAgent_serial/DataSource/parsingModality data_source_test.go:297: skipping test; environment variable TF_AWS_BEDROCK_TITAN_MODELS_ALLOWED must be set === RUN TestAccBedrockAgent_serial/DataSource/webConfiguration data_source_test.go:439: skipping test; environment variable TF_AWS_BEDROCK_TITAN_MODELS_ALLOWED must be set === RUN TestAccBedrockAgent_serial/DataSource/basic data_source_test.go:21: skipping test; environment variable TF_AWS_BEDROCK_TITAN_MODELS_ALLOWED must be set === RUN TestAccBedrockAgent_serial/DataSource/full data_source_test.go:51: skipping test; environment variable TF_AWS_BEDROCK_TITAN_MODELS_ALLOWED must be set === RUN TestAccBedrockAgent_serial/DataSource/semantic data_source_test.go:99: skipping test; environment variable TF_AWS_BEDROCK_TITAN_MODELS_ALLOWED must be set === RUN TestAccBedrockAgent_serial/DataSource/parsing data_source_test.go:246: skipping test; environment variable TF_AWS_BEDROCK_TITAN_MODELS_ALLOWED must be set === RUN TestAccBedrockAgent_serial/DataSource/bedrockDataAutomation data_source_test.go:483: skipping test; environment variable TF_AWS_BEDROCK_TITAN_MODELS_ALLOWED must be set === RUN TestAccBedrockAgent_serial/DataSource/customTransformation data_source_test.go:198: skipping test; environment variable TF_AWS_BEDROCK_TITAN_MODELS_ALLOWED must be set --- PASS: TestAccBedrockAgent_serial (0.00s) --- PASS: TestAccBedrockAgent_serial/DataSource (0.00s) --- SKIP: TestAccBedrockAgent_serial/DataSource/disappears (0.00s) --- SKIP: TestAccBedrockAgent_serial/DataSource/update (0.00s) --- SKIP: TestAccBedrockAgent_serial/DataSource/hierarchical (0.00s) --- SKIP: TestAccBedrockAgent_serial/DataSource/parsingModality (0.00s) --- SKIP: TestAccBedrockAgent_serial/DataSource/webConfiguration (0.00s) --- SKIP: TestAccBedrockAgent_serial/DataSource/basic (0.00s) --- SKIP: TestAccBedrockAgent_serial/DataSource/full (0.00s) --- SKIP: TestAccBedrockAgent_serial/DataSource/semantic (0.00s) --- SKIP: TestAccBedrockAgent_serial/DataSource/parsing (0.00s) --- SKIP: TestAccBedrockAgent_serial/DataSource/bedrockDataAutomation (0.00s) --- SKIP: TestAccBedrockAgent_serial/DataSource/customTransformation (0.00s) PASS ok github.com/hashicorp/terraform-provider-aws/internal/service/bedrockagent 7.017s ``` ```console % make t K=bedrockagent T=TestAccBedrockAgentAgentKnowledgeBaseAssociation_ make: Verifying source code with gofmt... ==> Checking that code complies with gofmt requirements... make: Running acceptance tests on branch: 🌿 td-bedrock-nova 🌿... TF_ACC=1 go1.26.2 test ./internal/service/bedrockagent/... -v -count 1 -parallel 20 -run='TestAccBedrockAgentAgentKnowledgeBaseAssociation_' -timeout 360m -vet=off 2026/05/08 15:09:04 Creating Terraform AWS Provider (SDKv2-style)... 2026/05/08 15:09:04 Initializing Terraform AWS Provider (SDKv2-style)... === RUN TestAccBedrockAgentAgentKnowledgeBaseAssociation_basic agent_knowledge_base_association_test.go:21: skipping test; environment variable TF_AWS_BEDROCK_TITAN_MODELS_ALLOWED must be set --- SKIP: TestAccBedrockAgentAgentKnowledgeBaseAssociation_basic (0.00s) === RUN TestAccBedrockAgentAgentKnowledgeBaseAssociation_update agent_knowledge_base_association_test.go:54: skipping test; environment variable TF_AWS_BEDROCK_TITAN_MODELS_ALLOWED must be set --- SKIP: TestAccBedrockAgentAgentKnowledgeBaseAssociation_update (0.00s) === RUN TestAccBedrockAgentAgentKnowledgeBaseAssociation_disappears agent_knowledge_base_association_test.go:95: skipping test; environment variable TF_AWS_BEDROCK_TITAN_MODELS_ALLOWED must be set --- SKIP: TestAccBedrockAgentAgentKnowledgeBaseAssociation_disappears (0.00s) PASS ok github.com/hashicorp/terraform-provider-aws/internal/service/bedrockagent 7.047s ``` Not all acceptance tests for the knowledge base resource depend on an Amazon Titan model, and therefore only a portion will be skipped under the newly added conditions.
1 parent 7e0597d commit 807fe50

4 files changed

Lines changed: 57 additions & 0 deletions

File tree

docs/acc-test-environment-variables.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ Environment variables (beyond standard AWS Go SDK ones) used by acceptance testi
112112
| `TF_ACC_ASSUME_ROLE_ARN` | Amazon Resource Name of existing IAM Role to use for limited permissions acceptance testing. |
113113
| `TF_ACC_REQUIRED_TAG_KEY` | Name of the tag key required for the resource being tested as defined in the organizational tagging policy |
114114
| `TF_AWS_BEDROCK_OSS_COLLECTION_NAME` | Name of the OpenSearch Serverless collection to be used with an Amazon Bedrock Knowledge Base. |
115+
| `TF_AWS_BEDROCK_TITAN_MODELS_ALLOWED` | Flag to enable tests which require use of Amazon Titan foundation models. Set to `1` to run tests. |
115116
| `TF_AWS_CONTROLTOWER_CONTROL_OU_NAME` | Organizational unit name to be targeted by the Control Tower control. |
116117
| `TF_AWS_CONTROLTOWER_BASELINE_ENABLE_BASELINE_ARN` | Enable baseline ARN. |
117118
| `TF_AWS_DATAEXCHANGE_DATA_SET_ID` | ID of DataExchange Data Set to use for testing. |

internal/service/bedrockagent/agent_knowledge_base_association_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import (
1818
)
1919

2020
func TestAccBedrockAgentAgentKnowledgeBaseAssociation_basic(t *testing.T) {
21+
acctest.SkipIfEnvVarNotSet(t, TitanModelsAllowedEnvVar)
22+
2123
ctx := acctest.Context(t)
2224
var agentknowledgebaseassociation types.AgentKnowledgeBase
2325
rName := acctest.RandomWithPrefix(t, acctest.ResourcePrefix)
@@ -49,6 +51,8 @@ func TestAccBedrockAgentAgentKnowledgeBaseAssociation_basic(t *testing.T) {
4951
}
5052

5153
func TestAccBedrockAgentAgentKnowledgeBaseAssociation_update(t *testing.T) {
54+
acctest.SkipIfEnvVarNotSet(t, TitanModelsAllowedEnvVar)
55+
5256
ctx := acctest.Context(t)
5357
var agentknowledgebaseassociation types.AgentKnowledgeBase
5458
rName := acctest.RandomWithPrefix(t, acctest.ResourcePrefix)
@@ -88,6 +92,8 @@ func TestAccBedrockAgentAgentKnowledgeBaseAssociation_update(t *testing.T) {
8892
}
8993

9094
func TestAccBedrockAgentAgentKnowledgeBaseAssociation_disappears(t *testing.T) {
95+
acctest.SkipIfEnvVarNotSet(t, TitanModelsAllowedEnvVar)
96+
9197
ctx := acctest.Context(t)
9298
var agentknowledgebaseassociation types.AgentKnowledgeBase
9399
rName := acctest.RandomWithPrefix(t, acctest.ResourcePrefix)

internal/service/bedrockagent/data_source_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import (
1818
)
1919

2020
func testAccDataSource_basic(t *testing.T) {
21+
acctest.SkipIfEnvVarNotSet(t, TitanModelsAllowedEnvVar)
22+
2123
ctx := acctest.Context(t)
2224
var dataSource types.DataSource
2325
rName := acctest.RandomWithPrefix(t, acctest.ResourcePrefix)
@@ -46,6 +48,8 @@ func testAccDataSource_basic(t *testing.T) {
4648
}
4749

4850
func testAccDataSource_full(t *testing.T) {
51+
acctest.SkipIfEnvVarNotSet(t, TitanModelsAllowedEnvVar)
52+
4953
ctx := acctest.Context(t)
5054
var dataSource types.DataSource
5155
rName := acctest.RandomWithPrefix(t, acctest.ResourcePrefix)
@@ -92,6 +96,8 @@ func testAccDataSource_full(t *testing.T) {
9296
}
9397

9498
func testAccDataSource_fullSemantic(t *testing.T) {
99+
acctest.SkipIfEnvVarNotSet(t, TitanModelsAllowedEnvVar)
100+
95101
ctx := acctest.Context(t)
96102
var dataSource types.DataSource
97103
rName := acctest.RandomWithPrefix(t, acctest.ResourcePrefix)
@@ -139,6 +145,8 @@ func testAccDataSource_fullSemantic(t *testing.T) {
139145
}
140146

141147
func testAccDataSource_fullHierarchical(t *testing.T) {
148+
acctest.SkipIfEnvVarNotSet(t, TitanModelsAllowedEnvVar)
149+
142150
ctx := acctest.Context(t)
143151
var dataSource types.DataSource
144152
rName := acctest.RandomWithPrefix(t, acctest.ResourcePrefix)
@@ -187,6 +195,8 @@ func testAccDataSource_fullHierarchical(t *testing.T) {
187195
}
188196

189197
func testAccDataSource_fullCustomTranformation(t *testing.T) {
198+
acctest.SkipIfEnvVarNotSet(t, TitanModelsAllowedEnvVar)
199+
190200
ctx := acctest.Context(t)
191201
var dataSource types.DataSource
192202
rName := acctest.RandomWithPrefix(t, acctest.ResourcePrefix)
@@ -233,6 +243,8 @@ func testAccDataSource_fullCustomTranformation(t *testing.T) {
233243
}
234244

235245
func testAccDataSource_parsing(t *testing.T) {
246+
acctest.SkipIfEnvVarNotSet(t, TitanModelsAllowedEnvVar)
247+
236248
ctx := acctest.Context(t)
237249
var dataSource types.DataSource
238250
rName := acctest.RandomWithPrefix(t, acctest.ResourcePrefix)
@@ -282,6 +294,8 @@ func testAccDataSource_parsing(t *testing.T) {
282294
}
283295

284296
func testAccDataSource_parsingModality(t *testing.T) {
297+
acctest.SkipIfEnvVarNotSet(t, TitanModelsAllowedEnvVar)
298+
285299
ctx := acctest.Context(t)
286300
var dataSource types.DataSource
287301
rName := acctest.RandomWithPrefix(t, acctest.ResourcePrefix)
@@ -334,6 +348,8 @@ func testAccDataSource_parsingModality(t *testing.T) {
334348
}
335349

336350
func testAccDataSource_disappears(t *testing.T) {
351+
acctest.SkipIfEnvVarNotSet(t, TitanModelsAllowedEnvVar)
352+
337353
ctx := acctest.Context(t)
338354
var dataSource types.DataSource
339355
rName := acctest.RandomWithPrefix(t, acctest.ResourcePrefix)
@@ -359,6 +375,8 @@ func testAccDataSource_disappears(t *testing.T) {
359375
}
360376

361377
func testAccDataSource_update(t *testing.T) {
378+
acctest.SkipIfEnvVarNotSet(t, TitanModelsAllowedEnvVar)
379+
362380
ctx := acctest.Context(t)
363381
var dataSource types.DataSource
364382
rName := acctest.RandomWithPrefix(t, acctest.ResourcePrefix)
@@ -418,6 +436,8 @@ func testAccDataSource_update(t *testing.T) {
418436
}
419437

420438
func testAccDataSource_webConfiguration(t *testing.T) {
439+
acctest.SkipIfEnvVarNotSet(t, TitanModelsAllowedEnvVar)
440+
421441
ctx := acctest.Context(t)
422442
if testing.Short() {
423443
t.Skip("skipping long-running test in short mode")
@@ -460,6 +480,8 @@ func testAccDataSource_bedrockDataAutomation(t *testing.T) {
460480
acctest.SkipIfExeNotOnPath(t, "jq")
461481
acctest.SkipIfExeNotOnPath(t, "aws")
462482

483+
acctest.SkipIfEnvVarNotSet(t, TitanModelsAllowedEnvVar)
484+
463485
ctx := acctest.Context(t)
464486
var dataSource types.DataSource
465487
rName := acctest.RandomWithPrefix(t, acctest.ResourcePrefix)

internal/service/bedrockagent/knowledge_base_test.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,21 @@ import (
2222
"github.com/hashicorp/terraform-provider-aws/names"
2323
)
2424

25+
// TitanModelsAllowedEnvVar is the environment variable which
26+
// must be set to run acceptance tests relying on Amazon Titan embedded text
27+
// models.
28+
//
29+
// These models are not currently approved for use in the main HashiCorp
30+
// test account, and therefore tests depending on these models are skipped
31+
// by default.
32+
//
33+
// See the full list of supported models in the Amazon Bedrock documentation:
34+
// https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-supported.html#knowledge-base-supported-embeddings
35+
const TitanModelsAllowedEnvVar = "TF_AWS_BEDROCK_TITAN_MODELS_ALLOWED"
36+
2537
func testAccKnowledgeBase_disappears(t *testing.T) {
38+
acctest.SkipIfEnvVarNotSet(t, TitanModelsAllowedEnvVar)
39+
2640
ctx := acctest.Context(t)
2741
var knowledgebase awstypes.KnowledgeBase
2842
rName := acctest.RandomWithPrefix(t, acctest.ResourcePrefix)
@@ -56,6 +70,8 @@ func testAccKnowledgeBase_disappears(t *testing.T) {
5670
}
5771

5872
func testAccKnowledgeBase_tags(t *testing.T) {
73+
acctest.SkipIfEnvVarNotSet(t, TitanModelsAllowedEnvVar)
74+
5975
ctx := acctest.Context(t)
6076
var knowledgebase awstypes.KnowledgeBase
6177
rName := acctest.RandomWithPrefix(t, acctest.ResourcePrefix)
@@ -134,6 +150,8 @@ func testAccKnowledgeBase_RDS_basic(t *testing.T) {
134150
acctest.SkipIfExeNotOnPath(t, "jq")
135151
acctest.SkipIfExeNotOnPath(t, "aws")
136152

153+
acctest.SkipIfEnvVarNotSet(t, TitanModelsAllowedEnvVar)
154+
137155
ctx := acctest.Context(t)
138156
var knowledgebase awstypes.KnowledgeBase
139157
rName := acctest.RandomWithPrefix(t, acctest.ResourcePrefix)
@@ -198,6 +216,8 @@ func testAccKnowledgeBase_RDS_basic(t *testing.T) {
198216
}
199217

200218
func testAccKnowledgeBase_OpenSearchServerless_basic(t *testing.T) {
219+
acctest.SkipIfEnvVarNotSet(t, TitanModelsAllowedEnvVar)
220+
201221
ctx := acctest.Context(t)
202222
collectionName := skipIfOSSCollectionNameEnvVarNotSet(t)
203223
var knowledgebase awstypes.KnowledgeBase
@@ -255,6 +275,8 @@ func testAccKnowledgeBase_OpenSearchServerless_basic(t *testing.T) {
255275
}
256276

257277
func testAccKnowledgeBase_update(t *testing.T) {
278+
acctest.SkipIfEnvVarNotSet(t, TitanModelsAllowedEnvVar)
279+
258280
ctx := acctest.Context(t)
259281
var knowledgebase awstypes.KnowledgeBase
260282
rName := acctest.RandomWithPrefix(t, acctest.ResourcePrefix)
@@ -313,6 +335,8 @@ func testAccKnowledgeBase_RDS_supplementalDataStorage(t *testing.T) {
313335
acctest.SkipIfExeNotOnPath(t, "jq")
314336
acctest.SkipIfExeNotOnPath(t, "aws")
315337

338+
acctest.SkipIfEnvVarNotSet(t, TitanModelsAllowedEnvVar)
339+
316340
ctx := acctest.Context(t)
317341
var knowledgebase awstypes.KnowledgeBase
318342
rName := acctest.RandomWithPrefix(t, acctest.ResourcePrefix)
@@ -417,6 +441,8 @@ func testAccKnowledgeBase_Kendra_basic(t *testing.T) {
417441
}
418442

419443
func testAccKnowledgeBase_OpenSearchManagedCluster_basic(t *testing.T) {
444+
acctest.SkipIfEnvVarNotSet(t, TitanModelsAllowedEnvVar)
445+
420446
ctx := acctest.Context(t)
421447
var knowledgebase awstypes.KnowledgeBase
422448
rName := acctest.RandomWithPrefix(t, acctest.ResourcePrefix)
@@ -477,6 +503,8 @@ func testAccKnowledgeBase_OpenSearchManagedCluster_basic(t *testing.T) {
477503
}
478504

479505
func testAccKnowledgeBase_S3Vectors_update(t *testing.T) {
506+
acctest.SkipIfEnvVarNotSet(t, TitanModelsAllowedEnvVar)
507+
480508
ctx := acctest.Context(t)
481509
var knowledgebase awstypes.KnowledgeBase
482510
rName := acctest.RandomWithPrefix(t, acctest.ResourcePrefix)

0 commit comments

Comments
 (0)