-
Notifications
You must be signed in to change notification settings - Fork 366
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
Add a terraform example to deploy Quickwit lambdas #4431
Comments
|
Hi 👋, |
|
@kalil-pelissier Do you have any update? |
|
Hi, @bjernie didn't start to work on it. |
|
No, not right now |
|
Hi @kalil-pelissier , i would like to try. Any hints or pointers ? |
|
@hjander I decided to give I at try and it worked beautifully. I am not yet ready to create a PR but this is the terraform code. terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">=5.51.1"
}
}
}
provider "aws" {
region = "eu-west-3"
}
locals {
index_config_key = "index-config.yaml"
index_config = yamldecode(file("../${local.index_config_key}"))
}
// S3
resource "aws_s3_bucket" "index" {
bucket = "quickwit-index-bucket"
force_destroy = true
}
resource "aws_s3_bucket_policy" "index" {
bucket = aws_s3_bucket.index.bucket
policy = data.aws_iam_policy_document.index_policy.json
}
data "aws_iam_policy_document" "index_policy" {
statement {
effect = "Allow"
actions = ["s3:*"]
resources = [
aws_s3_bucket.index.arn,
"${aws_s3_bucket.index.arn}/*"
]
principals {
type = "Service"
identifiers = [
"lambda.amazonaws.com"
]
}
}
}
// Upload the index config to the bucket
resource "aws_s3_object" "index_config" {
bucket = aws_s3_bucket.index.bucket
key = local.index_config_key
content = file("../${local.index_config_key}")
}
// Indexer Lambda
module "indexer_lambda" {
source = "terraform-aws-modules/lambda/aws"
function_name = "quickwit-indexer"
source_path = "cdk.out/indexer/bootstrap"
handler = "bootstrap"
runtime = "provided.al2023"
memory_size = 3008
timeout = 900
attach_policy_json = true
policy_json = data.aws_iam_policy_document.indexer_lambda_policy.json
environment_variables = {
QW_LAMBDA_INDEX_BUCKET = aws_s3_bucket.index.bucket
QW_LAMBDA_METASTORE_BUCKET = aws_s3_bucket.index.bucket
QW_LAMBDA_INDEX_ID = local.index_config.index_id
QW_LAMBDA_INDEX_CONFIG_URI = "s3://${aws_s3_bucket.index.bucket}/${local.index_config_key}"
RUST_LOG = "quickwit=debug"
}
}
data "aws_iam_policy_document" "indexer_lambda_policy" {
statement {
effect = "Allow"
actions = [
"s3:*"
]
resources = [
aws_s3_bucket.index.arn,
"${aws_s3_bucket.index.arn}/*"
]
}
}
// Searcher Lambda
module "searcher_lambda" {
source = "terraform-aws-modules/lambda/aws"
function_name = "quickwit-searcher"
source_path = "cdk.out/searcher/bootstrap"
handler = "bootstrap"
runtime = "provided.al2023"
memory_size = 3008
timeout = 30
attach_policy_json = true
policy_json = data.aws_iam_policy_document.searcher_lambda_policy.json
environment_variables = {
QW_LAMBDA_INDEX_BUCKET = aws_s3_bucket.index.bucket
QW_LAMBDA_METASTORE_BUCKET = aws_s3_bucket.index.bucket
QW_LAMBDA_INDEX_ID = local.index_config.index_id
RUST_LOG = "quickwit=debug"
}
}
data "aws_iam_policy_document" "searcher_lambda_policy" {
statement {
effect = "Allow"
actions = [
"s3:*"
]
resources = [
aws_s3_bucket.index.arn,
"${aws_s3_bucket.index.arn}/*"
]
}
statement {
effect = "Allow"
actions = [
"s3:GetObject"
]
resources = ["arn:aws:s3:::quickwit-datasets-public/*"]
}
statement {
effect = "Allow"
actions = [
"s3:GetObject"
]
resources = [
aws_s3_bucket.index.arn,
"${aws_s3_bucket.index.arn}/*",
]
}
}This Terraform example is based on the lambda beta 01, which works like as its supposed to. |
Coming from a redditor: provide terraform examples to deploy Quickwit Lambdas.
The text was updated successfully, but these errors were encountered: