Closed tleibovich closed 1 month ago
Voting for Prioritization
Volunteering to Work on This Issue
I've not had a chance to run your sample code, but I notice in our acceptance tests we're not creating an alias and I'm wondering if there's an issue with timing there or just ordering.
Do you see AssociateAgentKnowledgeBase
events in CloudTrail and if so do they have an error?
Could you try the alias resource with a depends_on the knowledge base association:
resource "aws_bedrockagent_agent_alias" "live" {
agent_id = aws_bedrockagent_agent.kb_agent.id
agent_alias_name = "live"
description = "Live alias for the ${var.cluster}-${var.application} KB agent"
depends_on = [aws_bedrockagent_agent_knowledge_base_association.kb_agent_association]
}
Thanks for the suggestion, Andrew. Unfortunately, that did not work, and I also tried adding a sleep, and that was unsuccessful as well.
resource "time_sleep" "before_alias" { create_duration = "20s" depends_on = [aws_bedrockagent_agent_knowledge_base_association.kb_agent_association] }
resource "aws_bedrockagent_agent_alias" "live" { agent_id = aws_bedrockagent_agent.kb_agent.id agent_alias_name = "live" description = "Live alias for the ${var.cluster}-${var.application} KB agent" depends_on = [ time_sleep.before_alias ] }
Thanks, Tim [cid:email-signature-300x120-white_3096bf70-a89f-4161-a197-7947edd94c6a.jpg] Tim Leibovich DevOps Engineer II
This email may contain privileged information. If received in error, please immediately delete, then notify the sender.
From: Andrew Tulloch @.> Sent: Thursday, August 8, 2024 9:56 AM To: hashicorp/terraform-provider-aws @.> Cc: Tim Leibovich @.>; Author @.> Subject: Re: [hashicorp/terraform-provider-aws] [Bug]: Bedrock agent association has no knowledgebase attached (Issue #38660)
I've not had a chance to run your sample code, but I notice in our acceptance tests we're not creating an alias and I'm wondering if there's an issue with timing there or just ordering.
Could you try the alias resource with a depends_on the knowledge base association:
resource "aws_bedrockagent_agent_alias" "live" { agent_id = aws_bedrockagent_agent.kb_agent.id agent_alias_name = "live" description = "Live alias for the ${var.cluster}-${var.application} KB agent" depends_on = [aws_bedrockagent_agent_knowledge_base_association.kb_agent_association] }
— Reply to this email directly, view it on GitHubhttps://github.com/hashicorp/terraform-provider-aws/issues/38660#issuecomment-2276036244, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BATEPY72I6YFTDFCIMT255LZQOBJZAVCNFSM6AAAAABL4X6TFWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZWGAZTMMRUGQ. You are receiving this because you authored the thread.Message ID: @.***>
Thanks, did you manage to see if CloudTrail had the event I listed above and if there was an error from it?
Just spot checked several of the AssociateAgentKnowledgeBase events performed by the terraform user, and none of them had error codes or any indication of an issue. Below is the response text from one of them.
"responseElements": {
"agentKnowledgeBase": {
"createdAt": "2024-08-08T15:22:50.947769599Z",
"description": "***",
"knowledgeBaseId": "<redacted but correct>",
"knowledgeBaseState": "ENABLED",
"updatedAt": "2024-08-08T15:22:50.947769599Z"
}
},
[!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.
@tleibovich see the referenced PR for the fix, the agent needed preparing again after the knowledge base was associated. You still need the depends_on
so the association is created before the alias.
Awesome! Thanks!
This functionality has been released in v5.63.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!
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.
Terraform Core Version
1.8.5
AWS Provider Version
5.61.0
Affected Resource(s)
aws_bedrockagent_agent_knowledge_base_association
Expected Behavior
There should be a knowledgebase associated as in this screenshot of an agent created manually.
Actual Behavior
There is no knowledgebase associated when using the attached code.
Relevant Error/Panic Output Snippet
No response
Terraform Configuration Files
Steps to Reproduce
Run the code in the above section. There are several resources with dependencies defined in other files, but I assume it would be simpler for Hashicorp to create those resources in their own way and update those references. If the rest of the code I am using is needed, I can provide it on request.
Debug Output
No response
Panic Output
No response
Important Factoids
I opened a support ticket with AWS Enterprise Support. They were able to replicate the issue using terraform, but when they used their API's directly (python using boto3), they were able to create the agent and associate it successfully. Below is the code they used:
References
No response
Would you like to implement a fix?
None