Flow dependencies

Hello Genesys Exports!
I'm trying to use lifecycle replace_triggered_by attribute in the architectflow resources.
I am trying to solve a problem when there is a common module change, I need to republish all the flows that have dependency on that common module.
So here is an example:
I want to trigger an updating of the main flows whenever there is a change in yaml file of the common module

resource "genesyscloud_flow" "debug_common_flow" {
filepath = "debug_common.yaml"
file_content_hash = sha256(file("debug_common.yaml"))
force_unlock = true
}

resource "genesyscloud_flow" "email_flow" {
filepath = "debug_common.yaml"
file_content_hash = sha256(file("email_flow.yaml"))
force_unlock = true

lifecycle {
replace_triggered_by = [genesyscloud_flow.debug_common_flow]
}
}

for some reason it is trying to destroy the common module and fails

genesyscloud_flow.email_flow: Destroying... [id=c29f6947-45c1-43d4-a2c2-d583f6d109eb]
genesyscloud_flow.email_flow: Still destroying... [id=c29f6947-45c1-43d4-a2c2-d583f6d109eb, 10s elapsed]
genesyscloud_flow.email_flow: Still destroying... [id=c29f6947-45c1-43d4-a2c2-d583f6d109eb, 20s elapsed]
genesyscloud_flow.email_flow: Still destroying... [id=c29f6947-45c1-43d4-a2c2-d583f6d109eb, 30s elapsed]

│ Error: Error deleting flow c29f6947-45c1-43d4-a2c2-d583f6d109eb: API Error: 409 - 'Debug CM Flow' cannot be deleted because other objects depend on it. (958181f1-7247-41c1-ba47-b744094c2aeb

Why is it happening? Is there any other way to achieve republishing of the main flows whenever there is a change in common modules?

Hi Ihor

I tried recreating your configuration, making a change to the common module and re-applying, and everything worked okay for me.
In your config above, "debug_common.yaml" is the value for filepath in both resources. I believe this is where your issue is coming from. In the logs, we can see that the email flow is being destroyed, but in the error message we see 'Debug CM flow' cannot be deleted... which I assume is the name of your common module.

Also, I'm using genesyscloud terraform provider version 1.9.0. It would be worth upgrading to this version if you haven't done so already as we recently found and corrected some bugs in the flow resource.

Hope this helps,
Charlie