Can I delete a resource like flow file using terraform?

I am using Cx as Code to export a flow file definition, then use archy export the actual flow file from our Dev Org.
Once File is in local, I would like to delete the file from dev org and upload again using terraform.
I want that to be part of the pipeline. So what are options to delete flow file in terraform?

Hi Vinil

First of all, you will need to have include_state_file set to true in your export resource. This way, the objects in your exported folder will be linked to their actual GUID via the state file. Next you will want to cd into your export directory, run terraform init, and then run terraform destroy.

The destroy command should not work unless the flow resource references an actual file, so that makes it less likely that you will lose data. But still, I would be cautious as to not delete any flows without ensuring the correct flow file has been saved in your local file system.

Hope this helps

-Charlie

Thank You @charlie.conneely for the details.
And this holds good for any GC Objects managed through terraform right?

Yes, for the most part it does. There are a few exceptions;

  • Flow outcomes cannot be deleted, only repurposed.
  • Some resources like genesyscloud_routing_settings manage system settings, so they won't actually delete anything, just reset configurations.

etc, etc... but otherwise, any object should delete if you follow the steps outlined in my previous message.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.