https://pulumi.com logo
#aws
Title
# aws
s

sparse-caravan-37954

12/01/2023, 11:40 PM
Hello, I have created a secret with three key/value pairs like
Copy code
{
  "key1": "value1",
  "key2": "value2",
  "key3": "value3"
}
How do I pass each value to a batch job definition? I try this
Copy code
secret = aws.secretsmanager.get_secret_version(secret_id=os.environ.get('AWS_SECRET_ID'))
container_properties = {
   "secrets": [{"name": k, "valueFrom": secret.arn} for k in ["key1", "key2", "key3"]],
   ...}
but it is giving the full json to each secret. Any idea?
I got it. I can do
"secrets": [{"name": k, "valueFrom": f"{secret.arn}:{k}::"} for k in ["key1", "key2", "key3"]]