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]: Provider tries to update the Knowledge Base when configuration changes which fails with ValidationException #38022

Closed
jammymalina opened this issue Jun 18, 2024 · 6 comments · Fixed by #39567
Labels
bug Addresses a defect in current functionality. service/bedrockagent Issues and PRs that pertain to the bedrockagent service.
Milestone

Comments

@jammymalina
Copy link

jammymalina commented Jun 18, 2024

Terraform Core Version

1.8.5

AWS Provider Version

5.53.0

Affected Resource(s)

aws_bedrockagent_knowledge_base

Expected Behavior

Terraform should destroy the knowledge base resource (and maybe its dependents) and create it again.

Actual Behavior

Terraform tries to update the knowledge base resource in place and fails with a validation error (status code 400).

Relevant Error/Panic Output Snippet

│ Error: updating Bedrock Agent Knowledge Base (id)

│   with module.api.aws_bedrockagent_knowledge_base.kb,
│   on modules/api/main.tf line 292, in resource "aws_bedrockagent_knowledge_base" "kb":
│  292: resource "aws_bedrockagent_knowledge_base" "kb" {

│ operation error Bedrock Agent: UpdateKnowledgeBase, https response error StatusCode: 400, RequestID: uuid, ValidationException: You cannot modify the knowledge base configuration once it
│ is created.

Terraform Configuration Files

resource "aws_bedrockagent_knowledge_base" "kb" {
  name     = "${var.resource_prefix}-kb-${var.stage}"
  role_arn = aws_iam_role.kb_role.arn

  storage_configuration {
    type = "OPENSEARCH_SERVERLESS"

    opensearch_serverless_configuration {
      collection_arn    = aws_opensearchserverless_collection.collection.arn
      vector_index_name = var.kb_config.vector_index_name
      field_mapping {
        metadata_field = var.kb_config.metadata_field
        text_field     = var.kb_config.text_field
        vector_field   = var.kb_config.vector_field
      }
    }
  }

  knowledge_base_configuration {
    type = "VECTOR"
    vector_knowledge_base_configuration {
      embedding_model_arn = "arn:${local.aws_partition}:bedrock:${local.region}::${var.kb_config.embedding_model}"
    }
  }

  depends_on = [
    terraform_data.index_creation,
  ]
}

Steps to Reproduce

  1. Deploy the knowledge base via Terraform
  2. Change the embeddings model and vector size
  3. Deploy again

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

@jammymalina jammymalina added the bug Addresses a defect in current functionality. label Jun 18, 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 service/bedrockagent Issues and PRs that pertain to the bedrockagent service. label Jun 18, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Jun 18, 2024
@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Jul 9, 2024
@acwwat
Copy link
Contributor

acwwat commented Jul 21, 2024

@jammymalina Could you please provide the plan output that shows the diff/update?

@acwwat
Copy link
Contributor

acwwat commented Jul 21, 2024

Actually, UpdateKnowledgeBase specifies that only name, description, and role ARN can be updated. Anything else should force a new resource creation instead. I think this is enough information to work with.

Copy link

github-actions bot commented Oct 2, 2024

Warning

This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

@github-actions github-actions bot added this to the v5.70.0 milestone Oct 2, 2024
Copy link

github-actions bot commented Oct 4, 2024

This functionality has been released in v5.70.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

Copy link

github-actions bot commented Nov 4, 2024

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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.

3 participants