Lee Littlejohn
03/03/2022, 5:30 PMjordan
03/03/2022, 5:35 PMLee Littlejohn
03/03/2022, 5:44 PM/run/secrets/secret_name
, which then requires a different entrypoint script for each service. I may have just used you as a rubber ducky non-consensually. It hadn’t occurred to me until right now to use both entrypoint and command.source
the entrypoint to set env vars and then run the dagster commands afterwards. So, so close to having this thing rock solid. Thanks for your time, I’ll keep specific improvement ideas on the mind.Tiri Georgiou
03/04/2022, 1:31 PMdagster/slack
and it will show up like this in the run task
env variables..
{
"dagster/slack": "arn:aws:secretsmanager:eu-west-1:xxxxxxxxxxx:secret:dagster/slack-ToNAkO"
}
Is there anyway of setting the json-key as the key and the value as its actual value? for example:
{
"SLACK_TOKEN": "jsikfniwfndw"
}
?Lee Littlejohn
03/04/2022, 3:08 PM0.14.3
has support for AWS secrets as a resource to access within ops, but that seems very repetitive and onerous for my use-case, at least.
I’m not willing to fill up the secrets manager console with a bunch of individual secrets for each of the many many API keys and stuff that I need to access either, so I’m stuck for the time being using an entrypoint script to access the file mounted at /run/secrets/secret_name
, unpack it, and set them all before anything else happens.Tiri Georgiou
03/04/2022, 4:00 PM{
"containerDefinitions": [
{
"secrets": [
{
"name": "environment_variable_name",
"valueFrom": "arn:aws:secretsmanager:region:aws_account_id:secret:appauthexample-AbCdEf:username1::"
}
]
}
]
}
To ref a particular key. If I’m not mistaken the secrets block declared under the runLauncher section just unpacks these key value pairs to form the above section in the container definition. @jordan thoughts on this?
Edit:
It looks like it suppose to be iterating through a dict, not sure of the yaml syntax here but want something along the lines of
run_launcher:
module: dagster_aws.ecs
class: EcsRunLauncher
config:
secrets:
SLACK_TOKEN: arn:aws:secretsmanager:eu-west-1:XXXXXXXXXX:secret:dagster/slack-ToNAkO:SLACK_TOKEN
Where this gets mapped to name: SLACK_TOKEN
and valueFrom: <token value>
?jordan
03/07/2022, 3:07 PMrun_launcher:
module: dagster_aws.ecs
class: EcsRunLauncher
config:
secrets:
SLACK_TOKEN: arn:aws:secretsmanager:eu-west-1:XXXXXXXXXX:secret:dagster/slack-ToNAkO:SLACK_TOKEN
to map the entire secret at that ARN to SLACK_TOKEN
.
And if you’ve stored many key/values in the same secret as a JSON blob, I’d expect:
run_launcher:
module: dagster_aws.ecs
class: EcsRunLauncher
config:
secrets:
SLACK_TOKEN: arn:aws:secretsmanager:eu-west-1:XXXXXXXXXX:secret:dagster/slack-ToNAkO:SLACK_TOKEN/my-key
to map the my-key
item to SLACK_TOKEN
.
I’ll verify today and update either the docs or the code accordingly before the next release.Tiri Georgiou
03/07/2022, 3:12 PMjordan
03/07/2022, 3:57 PMTiri Georgiou
03/07/2022, 4:16 PMarn:aws:secretsmanager:region:aws_account_id:secret:secret-name:json-key
So like in most situations it might be one (or two) keys from the returned json of the secret thats needed to be mapped as an env variable (like SLACK_TOKEN
above).
I’ve tested it in a task definition and:
{
"containerDefinitions": [
{
"secrets": [
{
"name": "SLACK_TOKEN",
"valueFrom": "arn:aws:secretsmanager:eu-west-1:XXXXX-XXXXXX-XXXXX:secret:dagster/slack-AbCdEf:SLACK_TOKEN::"
}
]
}
]
}
maps perfectly into the container at runtime i.e. os.getenv('SLACK_TOKEN')
gives me the desired result. Most of the logic from what I’ve seen on the module is there so should just be a few tweeks.jordan
03/07/2022, 10:09 PM