Skip to content

Commit eb71dd4

Browse files
authored
Set Brainstore as default enabled (#46)
* Pass through BRAINSTORE_DEFAULT * Semgrep ignores for jsonencode * nosemgrep on aws_instance * true, false, forced as options * More concise
1 parent 2c8a707 commit eb71dd4

File tree

5 files changed

+26
-4
lines changed

5 files changed

+26
-4
lines changed

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ module "services" {
102102
clickhouse_secret = var.enable_clickhouse ? module.clickhouse[0].clickhouse_secret : null
103103

104104
brainstore_enabled = var.enable_brainstore
105+
brainstore_default = var.brainstore_default
105106
brainstore_hostname = var.enable_brainstore ? module.brainstore[0].dns_name : null
106107
brainstore_s3_bucket_name = var.enable_brainstore ? module.brainstore[0].s3_bucket : null
107108
brainstore_port = var.enable_brainstore ? module.brainstore[0].port : null

modules/remote-support/main-bastion.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ resource "aws_ec2_instance_connect_endpoint" "endpoint" {
99
Name = "${var.deployment_name}-instance-connect-endpoint"
1010
}, local.common_tags)
1111
}
12-
12+
# nosemgrep
1313
resource "aws_instance" "bastion" {
1414
count = var.enable_braintrust_support_shell_access ? 1 : 0
1515

@@ -109,7 +109,7 @@ resource "aws_iam_role" "bastion" {
109109

110110
name = "${var.deployment_name}-bastion"
111111

112-
assume_role_policy = jsonencode({
112+
assume_role_policy = jsonencode({ # nosemgrep
113113
Version = "2012-10-17"
114114
Statement = [
115115
{
@@ -139,7 +139,7 @@ resource "aws_iam_role_policy" "bastion" {
139139
name = "bastion-permissions"
140140
role = aws_iam_role.bastion[0].id
141141

142-
policy = jsonencode({
142+
policy = jsonencode({ # nosemgrep
143143
Version = "2012-10-17"
144144
Statement = [
145145
{
@@ -212,7 +212,7 @@ resource "aws_iam_role_policy" "braintrust_support_ec2_connect" {
212212
name = "ec2-instance-connect-bastion"
213213
role = aws_iam_role.braintrust_support[0].id
214214

215-
policy = jsonencode({
215+
policy = jsonencode({ # nosemgrep
216216
Version = "2012-10-17"
217217
Statement = [
218218
{

modules/services/lambda-apihandler.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ resource "aws_lambda_function" "api_handler" {
6262
FUNCTION_SECRET_KEY = aws_secretsmanager_secret_version.function_tools_secret.secret_string
6363

6464
BRAINSTORE_ENABLED = var.brainstore_enabled
65+
BRAINSTORE_DEFAULT = var.brainstore_default
6566
BRAINSTORE_URL = local.brainstore_url
6667
BRAINSTORE_REALTIME_WAL_BUCKET = local.brainstore_s3_bucket
6768
BRAINSTORE_ENABLE_HISTORICAL_FULL_BACKFILL = var.brainstore_enable_historical_full_backfill

modules/services/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,16 @@ variable "brainstore_etl_batch_size" {
215215
default = null
216216
}
217217

218+
variable "brainstore_default" {
219+
type = string
220+
description = "Whether to set Brainstore as the default rather than requiring users to opt-in via feature flag."
221+
default = "true"
222+
validation {
223+
condition = contains(["true", "false", "forced"], var.brainstore_default)
224+
error_message = "brainstore_default must be true, false, or forced."
225+
}
226+
}
227+
218228
variable "lambda_version_tag_override" {
219229
description = "Optional override for the lambda version tag. If not provided, will use locked versions from VERSIONS.json"
220230
type = string

variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,16 @@ variable "enable_brainstore" {
259259
default = false
260260
}
261261

262+
variable "brainstore_default" {
263+
type = string
264+
description = "Whether to set Brainstore as the default rather than requiring users to opt-in via feature flag. Don't set this if you have a large backfill ongoing and are migrating from Clickhouse."
265+
default = "true"
266+
validation {
267+
condition = contains(["true", "false", "forced"], var.brainstore_default)
268+
error_message = "brainstore_default must be true, false, or forced."
269+
}
270+
}
271+
262272
variable "brainstore_instance_type" {
263273
type = string
264274
description = "The instance type to use for the Brainstore. Must be a Graviton instance type. Preferably with 16GB of memory and a local SSD for cache data. The default value is for tiny deployments. Recommended for production deployments is c7gd.8xlarge."

0 commit comments

Comments
 (0)