terraform-provider-awscc icon indicating copy to clipboard operation
terraform-provider-awscc copied to clipboard

awscc_bedrock_agent: foundation model input accepts only name

Open quixoticmonk opened this issue 9 months ago • 1 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • 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
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
  • The resources and data sources in this provider are generated from the CloudFormation schema, so they can only support the actions that the underlying schema supports. For this reason submitted bugs should be limited to defects in the generation and runtime code of the provider. Customizing behavior of the resource, or noting a gap in behavior are not valid bugs and should be submitted as enhancements to AWS via the CloudFormation Open Coverage Roadmap.

Terraform CLI and Terraform AWS Cloud Control Provider Version

  • Terraform CLI : Terraform v1.7.4
  • provider version : registry.terraform.io/hashicorp/awscc v0.75.0

Affected Resource(s)

  • awscc_bedrock_agent

Terraform Configuration Files

The configuration below errors out on plan with foundation_model expecting a name than ARN/Name.

resource "awscc_bedrock_agent" "example" {
  agent_name              = "example-agent"
  description             = "Example agent configuration"
  agent_resource_role_arn = var.agent_role_arn
  foundation_model        = "arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-v2:1"
  instruction             = "You are an office assistant in an insurance agency. You are friendly and polite. You help with managing insurance claims and coordinating pending paperwork."
  knowledge_bases = [{
    description       = "example knowledge base"
    knowledge_base_id = var.knowledge_base_id
  }]

  customer_encryption_key_arn = var.kms_key_arn
  idle_session_ttl_in_seconds = 600
  auto_prepare = true

  action_groups = [ {
    action_group_name = "example-action-group"
    description = "Example action group"
    action_group_executor = {
      lambda = var.lambda_arn
    }

  } ]

  tags = {
    "Modified By" = "AWSCC"
  }

}

Debug Output

Panic Output

Expected Behavior

Terraform apply should accept the ARN of the foundation model per the schema definitaion below.

"FoundationModel": {
      "type": "string",
      "maxLength": 2048,
      "minLength": 1,
      "pattern": "^arn:aws(-[^:]+)?:bedrock:[a-z0-9-]{1,20}:(([0-9]{12}:custom-model/[a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}(([:][a-z0-9-]{1,63}){0,2})?/[a-z0-9]{12})|(:foundation-model/([a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}([.]?[a-z0-9-]{1,63})([:][a-z0-9-]{1,63}){0,2})))|(([a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}([.]?[a-z0-9-]{1,63})([:][a-z0-9-]{1,63}){0,2}))|(([0-9a-zA-Z][_-]?)+)$",
      "description": "ARN or name of a Bedrock model."
    }

Actual Behavior

The resource configuration fails with the below error message.

│ Error: AWS SDK Go Service Operation Incomplete
│
│   with awscc_bedrock_agent.example,
│   on main.tf line 1, in resource "awscc_bedrock_agent" "example":
│    1: resource "awscc_bedrock_agent" "example" {
│
│ Waiting for Cloud Control API service CreateResource operation completion returned: waiter state transitioned
│ to FAILED. StatusMessage: Foundation model is null or unsupported, try providing: [anthropic.claude-v2,
│ anthropic.claude-instant-v1, anthropic.claude-v2:1, amazon.titan-text-premier-v1:0,
│ anthropic.claude-3-sonnet-20240229-v1:0, anthropic.claude-3-haiku-20240307-v1:0] (Service: BedrockAgent, Status
│ Code: 400, Request ID: 246286c5-7321-4094-adaf-6965a0c5f116). ErrorCode: InvalidRequest

Model ARN from the AWS API

aws bedrock get-foundation-model --model-identifier anthropic.claude-v2:1
{
    "modelDetails": {
        "modelArn": "arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-v2:1",
        "modelId": "anthropic.claude-v2:1",
        "modelName": "Claude",
        "providerName": "Anthropic",
        "inputModalities": [
            "TEXT"
        ],
        "outputModalities": [
            "TEXT"
        ],
        "responseStreamingSupported": true,
        "customizationsSupported": [],
        "inferenceTypesSupported": [
            "ON_DEMAND"
        ],
        "modelLifecycle": {
            "status": "ACTIVE"
        }
    }
}

When the name of the model is provided, the terraform apply doesn't error on the input validation.

Steps to Reproduce

  1. terraform apply

Important Factoids

References

quixoticmonk avatar May 01 '24 18:05 quixoticmonk