Resource dependency in provider without `depends_on`

Hi

We are working on creating some new resources that have dependency among them. For example, resource_B depends on resource_A and must ALWAYS be created after creating/updating resource_A.

Unfortunately, it’s not ideal for us to use an “id” attribute from resource_A in resource_B to create this dependency as resource_A doesn’t have a unique id.

Given this are there any alternatives to ensure this dependency happens apart from expecting the user to always define a depends_on attribute?

Hi @maastha,

I am interested in the details of your particular scenario and the resource types in use. Typically there is an attribute that can be referred to if there is a dependency at the ‘platform’ level between the resources.

However, if your dependency is more at an ‘application’ level and there is no way to use attributes to implicitly set the dependency. As a contrived example - an application writing to a storage account which has to exist when that application is provisioned and is also provisioned as part of the same Terraform module. Then this is where the explicit dependency block on a resource could be used.

With a more detailed example of your specific use case it may be possible to suggest an alternative approach.

Hope that helps

Happy Terraforming