Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Bedrock Agent instruction is mandatory #40255

Open
jeremychauvet opened this issue Nov 22, 2024 · 1 comment · May be fixed by #40256
Open

[Bug]: Bedrock Agent instruction is mandatory #40255

jeremychauvet opened this issue Nov 22, 2024 · 1 comment · May be fixed by #40256
Labels
bug Addresses a defect in current functionality. service/bedrockagent Issues and PRs that pertain to the bedrockagent service.

Comments

@jeremychauvet
Copy link
Contributor

Terraform Core Version

1.9.8

AWS Provider Version

5.76.0

Affected Resource(s)

  • aws_bedrockagent_agent

Expected Behavior

Following actual resource documentation, the following instructions are mandatory:

Actual Behavior

Trying to create the resource with this code result to an error:

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

Error:

│ 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

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

data "aws_caller_identity" "current" {}

data "aws_partition" "current" {}

data "aws_region" "current" {}

data "aws_iam_policy_document" "example_agent_trust" {
  statement {
    actions = ["sts:AssumeRole"]
    principals {
      identifiers = ["bedrock.amazonaws.com"]
      type        = "Service"
    }
    condition {
      test     = "StringEquals"
      values   = [data.aws_caller_identity.current.account_id]
      variable = "aws:SourceAccount"
    }
    condition {
      test     = "ArnLike"
      values   = ["arn:${data.aws_partition.current.partition}:bedrock:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:agent/*"]
      variable = "AWS:SourceArn"
    }
  }
}

data "aws_iam_policy_document" "example_agent_permissions" {
  statement {
    actions = ["bedrock:InvokeModel"]
    resources = [
      "arn:${data.aws_partition.current.partition}:bedrock:${data.aws_region.current.name}::foundation-model/anthropic.claude-v2",
    ]
  }
}

resource "aws_iam_role" "example" {
  assume_role_policy = data.aws_iam_policy_document.example_agent_trust.json
  name_prefix        = "AmazonBedrockExecutionRoleForAgents_"
}

resource "aws_iam_role_policy" "example" {
  policy = data.aws_iam_policy_document.example_agent_permissions.json
  role   = aws_iam_role.example.id
}

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

Steps to Reproduce


1.  terraform init
2. terraform plan
3. terraform apply

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

Yes

@jeremychauvet jeremychauvet added the bug Addresses a defect in current functionality. label Nov 22, 2024
@github-actions github-actions bot added service/bedrockagent Issues and PRs that pertain to the bedrockagent service. service/iam Issues and PRs that pertain to the iam service. service/sts Issues and PRs that pertain to the sts service. labels Nov 22, 2024
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Nov 22, 2024
@ewbankkit ewbankkit removed service/iam Issues and PRs that pertain to the iam service. service/sts Issues and PRs that pertain to the sts service. needs-triage Waiting for first response or review from a maintainer. labels Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/bedrockagent Issues and PRs that pertain to the bedrockagent service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants