hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.85k stars 9.2k forks source link

fix(aws_bedrockagent_agent): argument instruction is mandatory #40256

Open jeremychauvet opened 7 hours ago

jeremychauvet commented 7 hours ago

Description

This PR aims to set the argument instruction to be mandatory. While reviewing the AWS API reference, it appears this argument is marked as optional. However, in real-world usage, omitting it leads to the following issue:

│ Error: creating Agent
│
│   with aws_bedrockagent_agent.demo,
│   on agent.tf line 46, in resource "aws_bedrockagent_agent" "demo":
│   46: resource "aws_bedrockagent_agent" "demo" {
│
│ waiting for Bedrock Agent (3TTM4DCSXX) prepare: unexpected state 'FAILED', wanted target 'PREPARED'. last error: Exception: Agent Instruction cannot be null

Here's the source code related to this error message:

resource "aws_bedrockagent_agent" "demo" {
  agent_name              = "my-agent-name"
  agent_resource_role_arn = aws_iam_role.example.arn
  foundation_model        = "anthropic.claude-v2"
}

Relations

Closes #40255

References

(https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_CreateAgent.html#API_agent_CreateAgent_RequestSyntax)

Output from Acceptance Testing

make testacc TESTS=TestAccBedrockAgentAgent_basic PKG=bedrockagent
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.3 test ./internal/service/bedrockagent/... -v -count 1 -parallel 20 -run='TestAccBedrockAgentAgent_basic'  -timeout 360m
2024/11/22 10:11:54 Initializing Terraform AWS Provider...
=== RUN   TestAccBedrockAgentAgent_basic
=== PAUSE TestAccBedrockAgentAgent_basic
=== CONT  TestAccBedrockAgentAgent_basic
--- PASS: TestAccBedrockAgentAgent_basic (28.75s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/bedrockagent       28.844s
github-actions[bot] commented 7 hours ago

Community Note

Voting for Prioritization

For Submitters