How do you depensOn a resource that is in the arra...
# general
b
How do you depensOn a resource that is in the array? such as:
Copy code
{
      dependsOn: [
        restApiPolicys[region]
      ],
      provider: config.providers[configEnvironment] as aws.Provider,
    },
l
So long it's a resource, it will work. Assuming that
restApiPolicys
is a variable (and not a property of the resource).
n
RestapiPolicy is a Record<string, aws..policy>[]
l
So is restApiPolicys[region] an instance of
aws.iam.Policy
? That will work. I've never see a need to depend on a Policy though. The only reason to need a Policy would be for its ARN, and that is (afaik) only ever used directly. Is it used directly in this object? We can't see the resource inputs.
n
It is a list of records, which contains policy obj.
Restapi needs to deploy after the api policy
l
So long as the resource object is what's in the dependOn array, it'll work. Is it not working?
b
This is how the var is defined:
restApiPolicys: Record<string, aws.apigateway.RestApiPolicy> = {};
l
Is it working?
b
no, I can't depends it.
l
Need more information. Error message? Unexpected behaviour? Also, a snippet of code would be good.