CX as Code: Target All resources of same type

Hello All,

I want to know if there is a work around to use terraform apply or destroy to target not just one resource but all resource of the same type with having to type in multiple -target="resourcetype.name" ?
For example I just want to destroy all resources "genesyscoud_routing_language"

Thank you,
Michael Carreon

Hi Michael,

I don't know of any one command that could perform this operation. However, you can achieve this programmatically by including the count attribute in each resource you want to destroy.
For example, you could define a local variable as follows:

locals {
    languagesCount = 0
}

, add the following line to each resource of type genesyscoud_routing_language

count = local.languagesCount

, and then re-run terraform apply.

This way, they won't be re-created on the next apply, and when you do want to create them, you just need to set languagesCount = 1

Hope this helps.

Regards,
Charlie

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