Skip to content

Commit

Permalink
fix: remove lambda arguments (#1618)
Browse files Browse the repository at this point in the history
  • Loading branch information
dirien authored Mar 14, 2024
1 parent 146c189 commit c2051e7
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions aws-py-langserve/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@
"pulumi-application": pulumi_project,
"pulumi-environment": pulumi_stack,
})

langserve_execution_role = aws.iam.Role("langserve-execution-role",
assume_role_policy=json.dumps({
"Statement": [{
Expand All @@ -245,7 +246,7 @@
}),
inline_policies=[aws.iam.RoleInlinePolicyArgs(
name=f"{pulumi_project}-{pulumi_stack}-service-secrets-policy",
policy=pulumi.Output.all(langserve_ssm_parameter.arn, langserve_key.arn).apply(lambda langserve_ssm_parameter_arn, langserve_key_arn: json.dumps({
policy=pulumi.Output.all(langserve_ssm_parameter.arn, langserve_key.arn).apply(lambda args: json.dumps({
"Version": "2012-10-17",
"Statement": [
{
Expand All @@ -257,7 +258,7 @@
},
},
"Effect": "Allow",
"Resource": [langserve_ssm_parameter_arn],
"Resource": [args[0]],
},
{
"Action": ["kms:Decrypt"],
Expand All @@ -268,13 +269,14 @@
},
},
"Effect": "Allow",
"Resource": [langserve_key_arn],
"Resource": [args[1]],
"Sid": "DecryptTaggedKMSKey",
},
],
})),
)],
managed_policy_arns=["arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy"])

langserve_task_role = aws.iam.Role("langserve-task-role",
assume_role_policy=json.dumps({
"Statement": [{
Expand Down Expand Up @@ -335,9 +337,9 @@
execution_role_arn=langserve_execution_role.arn,
task_role_arn=langserve_task_role.arn,
requires_compatibilities=["FARGATE"],
container_definitions=pulumi.Output.all(langserve_ecr_image.repo_digest, langserve_ssm_parameter.name, langserve_log_group.name).apply(lambda repo_digest, langserve_ssm_parameter_name, langserve_log_group_name: json.dumps([{
container_definitions=pulumi.Output.all(langserve_ecr_image.repo_digest, langserve_ssm_parameter.name, langserve_log_group.name).apply(lambda args: json.dumps([{
"name": f"{pulumi_project}-{pulumi_stack}-service",
"image": repo_digest,
"image": args[0],
"cpu": 0,
"portMappings": [{
"name": "target",
Expand All @@ -348,12 +350,12 @@
"essential": True,
"secrets": [{
"name": "OPENAI_API_KEY",
"valueFrom": langserve_ssm_parameter_name,
"valueFrom": args[1],
}],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": langserve_log_group_name,
"awslogs-group": args[2],
"awslogs-region": "eu-central-1",
"awslogs-stream-prefix": "pulumi-langserve",
},
Expand Down

0 comments on commit c2051e7

Please sign in to comment.