Getting issues with Replace_with_datasource attribute in export resource

I am trying to export a queue using replace_with_datasource attribute
image
Below is the error I am getting. I tried to find the workitem permission, but not able to. What is the issue?

Hi @Artur_Dishunts

Do you need dependency resolution to be true for this ?

Replace_with_datasource will modify an exported resource to a datasource.

Here since no "include_filter_Resources" is mentioned, the exporter is trying to export the entire org resources ( which might not be what you wanted) and there are some permission issues for you when trying export few workitems

If queue is the only resource you want to export you can mention

include_filter_resources = ["genesyscloud_routing_queue::Artur_Terraform*"]
also if you do not want its dependencies to be exported please mark enable_depedency_resolution to false.

in short your export resource could look like

resource "genesyscloud_tf_export" "export" {
  directory          = "./exportedFiles"
  include_filter_resources     = ["genesyscloud_routing_queue::Artur_Terraform*"]
  include_state_file = true
  export_as_hcl = true
  replace_with_datasource = ["genesyscloud_routing_queue::Artur_Terraform*"]
}

If you want to export entire queue resources and only Artur_Terraform to be exported as a datasource you can use

resource "genesyscloud_tf_export" "export" {
  directory          = "./exportedFiles"
  include_filter_resources     = ["genesyscloud_routing_queue"]
  include_state_file = true
  export_as_hcl = true
  replace_with_datasource = ["genesyscloud_routing_queue::Artur_Terraform*"]
}

Hope this helps.

Thank you for your response!

This solved the error. I have an idea of exporting objects from one org and importing them into another. When I am using include_filter_resources attribute and export_as_hcl is set to true, it creates .tf file with a bunch of resource blocks in it. I was thinking of running the file on another org, but I can't because variables like division ID will be different. Is there any way of dynamically changing them? Could you please point me in the right direction?

Hi @Artur_Dishunts

If you want some existing divisions in the target org to be referred , you can define the division as a data source and then the refer the data source id in the queue resource definition while importing it to the new org.. This way the divisions are not recreated and existing ones can be referered in your queue definition.

If you want to import the divisions as well to your target org , you can export the relevant dependent divisions from your source
keep enable_dependency_resolution = true , and the provider will take care of the GUID resolution for divisions.

Thanks
Hemanth