Skip to content

Instantly share code, notes, and snippets.

@scottschreckengaust
Last active February 25, 2025 19:46
Show Gist options
  • Save scottschreckengaust/1db2ad0a095e11f41aa0d004c3a9c921 to your computer and use it in GitHub Desktop.
Save scottschreckengaust/1db2ad0a095e11f41aa0d004c3a9c921 to your computer and use it in GitHub Desktop.
Terraform Bedrock Snippets
# https://docs.aws.amazon.com/bedrock/latest/userguide/models-supported.html
data "aws_bedrock_foundation_models" "models" {}
output "model_ids" {
description = "The Bedrock Foundation Models"
value = data.aws_bedrock_foundation_models.models.model_summaries[*].model_id
}
variable "default_foundation_model" {
type = string
description = "The default foundation model to use"
nullable = false
default = "amazon.nova-lite-v1:0" # "anthropic.claude-3-haiku-20240307-v1:0"
# validation {
# condition = contains(data.aws_bedrock_foundation_models.models.model_summaries[*].model_id, var.foundation_model)
# error_message = "The foundational model is not found"
# }
}
terraform {
required_version = ">= 1.7.4"
required_providers {
aws = {
source = "hashicorp/aws"
version = "~>5.0"
}
}
}
variable "region" {
type = string
description = "AWS region to deploy the resources"
default = "us-east-1"
validation {
condition = contains([
"us-east-1", "us-west-2",
"ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-south-1",
"ca-central-1",
"eu-central-1", "eu-west-1", "eu-west-2", "eu-west-3",
"sa-east-1",
], var.region)
error_message = "Please use a region supporting Guardrails for Amazon Bedrock https://docs.aws.amazon.com/general/latest/gr/bedrock.html."
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment