Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Can a List of Resources be used in the depends_on Property

Can a resource’s depends_on be used against all elements in a "resource list". For example, in the resource below, the source_ids’ property is enumerated, however, I get an error when I attempt to concat() those elements in the depends_on with other elements.

The code below is valid and deploys, however, I don’t know if that is a valid construct for depends_on. Does it wait for all elements in the “resource collection”? If not, is there a better alternative?

In the example below, resource aws_dms_replication_instance.dms_instances{} contains more than one instance.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

resource "aws_dms_event_subscription" "event_subscription_repl_instance_bronze" {

    count               = length(lookup(var.dms_notification_emails, terraform.workspace))    
     ...   
    source_ids           = [for ri in aws_dms_replication_instance.dms_instances : ri.replication_instance_id]
   
    depends_on = [
         aws_dms_replication_instance.dms_instances         
        ]    
}

>Solution :

In your case you do not need depends_on as you have existing implicit relation already setup through:

source_ids           = [for ri in aws_dms_replication_instance.dms_instances : ri.replication_instance_id]

So depends_on is redundant. But yes, it will wait for all instances of aws_dms_replication_instance.dms_instances to be deployed if you did not have source_ids.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading