Skip to content

Commit

Permalink
Give Meadow permission to load secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
mbklein committed Nov 11, 2024
1 parent 9aa620f commit 6127cb8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/lib/meadow/config/runtime.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ defmodule Meadow.Config.Runtime do
port: get_secret(:ldap, ["port"]),
user_dn: get_secret(:ldap, ["user_dn"]),
password: get_secret(:ldap, ["password"]),
ssl: get_secret(:ldap, ["ssl"]) == "true"
ssl: get_secret(:ldap, ["ssl"], "true") == "true"

config :hackney,
max_connections: environment_int("HACKNEY_MAX_CONNECTIONS", 1000)
Expand Down
5 changes: 4 additions & 1 deletion infrastructure/deploy/ecs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ data "aws_iam_policy_document" "meadow_role_permissions" {
sid = "secretsmanager"
effect = "Allow"
actions = ["secretsmanager:Get*"]
resources = ["arn:aws:secretsmanager:${var.aws_region}:${data.aws_caller_identity.current.id}:secret:config/meadow-*"]
resources = [
"arn:aws:secretsmanager:${var.aws_region}:${data.aws_caller_identity.current.id}:secret:config/meadow-*",
"arn:aws:secretsmanager:${var.aws_region}:${data.aws_caller_identity.current.id}:secret:${local.prefix}/*"
]
}

statement {
Expand Down
1 change: 1 addition & 0 deletions infrastructure/deploy/ecs_services.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ locals {
meadow_urls = join(",", local.meadow_urls)
region = var.aws_region
secret_key_base = random_string.secret_key_base.result
secrets_path = local.prefix
}
}

Expand Down
4 changes: 4 additions & 0 deletions infrastructure/deploy/task-definitions/meadow_app.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
"mountPoints": [],
"essential": true,
"environment": [
{
"name": "SECRETS_PATH",
"value": "${secrets_path}"
},
{
"name": "MEADOW_PROCESSES",
"value": "${processes}"
Expand Down

0 comments on commit 6127cb8

Please sign in to comment.