sparse-intern-71089
02/04/2024, 6:31 PMlittle-cartoon-10569
02/04/2024, 6:38 PMlittle-cartoon-10569
02/04/2024, 6:40 PMpulumi.Output.all()
and then just using a single arg from that array seems redundant, and may lead to an error. Since you want only the first element in the all array, you can skip creating the array, and just use ecr_repo_arn.apply( .... )
. Also, the 2nd element in the array was the same item, was that right?little-cartoon-10569
02/04/2024, 6:41 PMchilly-thailand-69363
02/04/2024, 6:58 PMchilly-thailand-69363
02/04/2024, 7:26 PMimport pulumi_aws as aws
ecr_repo_arn = "arn:aws:ecr:us-east-1:*****:repository/app_dev"
# Asynchronously get the policy document
def get_policy_document(args):
ecr_policy_document = aws.iam.get_policy_document(statements=[
aws.iam.GetPolicyDocumentStatementArgs(
actions=[
"ecr:GetDownloadUrlForLayer",
"ecr:BatchGetImage",
"ecr:BatchCheckLayerAvailability",
],
resources=args,
)
])
return ecr_policy_document.json
`# Use apply
to handle the asynchronous result`
policy_json = pulumi.Output.all(ecr_repo_arn).apply(get_policy_document)
# Export the policy
pulumi.export("policy", policy_json)
When I do pulumi up, I get the following, not sure if this is right or wrong:little-cartoon-10569
02/04/2024, 8:09 PMlittle-cartoon-10569
02/04/2024, 8:10 PMlittle-cartoon-10569
02/04/2024, 8:11 PMecr_repo_arn
directly into the object in both approaches 2 and 3. When get_policy_document calls to_string (or the Python equivalent) on ecr_repo_arm
, it will produce an error message that is not an ARN, and will be unformattable. Which is probably causing your problem.little-cartoon-10569
02/04/2024, 8:12 PMlittle-cartoon-10569
02/04/2024, 8:13 PMlittle-cartoon-10569
02/04/2024, 8:16 PMjson_dumps
to `Output.json_dumps`: https://github.com/pulumi/examples/blob/7a0dbf40e0924297e94426ea534d748ad1589b45/aws-py-s3-folder/__main__.py#L28chilly-thailand-69363
02/04/2024, 10:06 PMlittle-cartoon-10569
02/04/2024, 10:45 PMchilly-thailand-69363
02/04/2024, 10:58 PMlittle-cartoon-10569
02/04/2024, 11:00 PMeksCluster
property.chilly-thailand-69363
02/04/2024, 11:03 PMlittle-cartoon-10569
02/04/2024, 11:03 PMeksCluster
, which points to the aws.eks.Cluster
object that the EKS provider creates and wraps for you.little-cartoon-10569
02/04/2024, 11:04 PMlittle-cartoon-10569
02/04/2024, 11:04 PMeks_cluster
.chilly-thailand-69363
02/04/2024, 11:14 PM