Hi How can we use InvokeOptions to associate a de...
# python
f
Hi How can we use InvokeOptions to associate a dependent resource Using
opts=ResourceOptions(depends_on=[xxx])
seems to be giving a new type of error ``TypeError: Expected opts2 to be a InvokeOptions instance``
a
What is it that you're passing in as xxx? Are you by any chance using
ResourceOptions.merge(opts1=x, opts2=y)
somewhere?
f
Nope ... trying to get a resource, and was thinking of using the depends_on flag in the ResourceOption before the resource is fetched
a
Can you share how you're getting the resource?
f
Copy code
lambda args: aws.iam.get_policy_document(
    version='2012-10-17',
    # version='2008-10-17',
    policy_id='PolicyForCloudFrontPrivateContent',
    statements=[
        aws.iam.GetPolicyDocumentStatementArgs(
            sid=1,
            effect='Allow',
            actions=["s3:GetObject"],
            resources=[f'{args[0]}/*'],
            principals=[
                aws.iam.GetPolicyDocumentStatementPrincipalArgs(
                    type='AWS',
                    identifiers=[args[1].iam_arn],
                )
            ]
        )
    ],
    opts=ResourceOptions(depends_on=[cf])
)
cf
is CloudFront Resource in this case
a
opts for that getter isn't actually a ResourceOption but InvokeOption - which don't have depends_on https://www.pulumi.com/registry/packages/aws/api-docs/iam/getpolicydocument/ See feature request issue: https://github.com/pulumi/pulumi/issues/14243