This message was deleted.
# golang
s
This message was deleted.
f
You can wrap it into a helper function (or a lambda), like this
Copy code
def _make_ecr_policy(repo_arn: str) -> str:
        return json.dumps(
            {
                "Version": "2012-10-17",
                "Statement": [
and then
Copy code
aws.iam.Policy(
        "repo_access",
        name=f"{pulumi.get_project()}-repo-access",
        policy=repo.arn.apply(_make_ecr_policy),
        opts=pulumi.ResourceOptions(parent=repo),
    )
or use https://www.pulumi.com/registry/packages/aws/api-docs/iam/getpolicydocument/
(Python examples, sorry, but I guess it'll be quite similar in Go)
m
Yeah, I can see how it can be used with python, but in the case of golang it seems more complicated and require messing around with reflection because applyT return type is pulumi.StringOutput (I cannot just say return type is string as one of examples in the doc shows).
f
I have it ugly! Have no idea how canonical it is but this works https://pastebin.com/Bkasv0cq
🙌 1
m
Thank you, @fierce-ability-58936! I probably wanted to do it with a slightly different approach. What I’ve learned so far is that I need a bit of a shift in thinking to be more pulumi idiomatic 🙂
f