RJPearson94 / terraform-provider-twilio

Terraform Twilio provider
https://registry.terraform.io/providers/RJPearson94/twilio/latest/docs
Mozilla Public License 2.0
32 stars 7 forks source link

Change default activity and timeout activity in workspace #36

Closed thomaschaaf closed 3 years ago

thomaschaaf commented 3 years ago

I would like to change the defaultActivitySid and timeoutActivitySid.

For some reason creating a workspace doesn't allow setting a defaultActivitySid or timeoutActivitySid but updating does: https://www.twilio.com/docs/taskrouter/api/workspace#update-a-workspace-resource

RJPearson94 commented 3 years ago

Hi @thomaschaaf,

Thanks for the feature request.

As activities are associated with a specific workspace, you cannot set the default or timeout activity SID at creation as the resources which would be attached do not exist. To prevent a cyclic dependency, a new terraform resource will have to be created to manage the workspace configuration to resolve this issue. I will take a look at adding this new resource.

Thank again for the feature request and any additional feedback on the provider would be greatly appreciated

RJPearson94 commented 3 years ago

Hi @thomaschaaf, Apologies for the delay in getting this feature added. I picked this up last week and ran into a few hurdles during testing, so it is taking a little longer than expected. The issue that has occurred is TaskRouter doesn’t allow you to delete an activity if it is set as either the default or timeout activity on a workspace, so I’m trying to find a way around this as it causes failures when running terraform destroy. So apologies again for the delay

thomaschaaf commented 3 years ago

Thank you for even taking the time to look into this! I really love your work on the terraform provider.

RJPearson94 commented 3 years ago

Hi @thomaschaaf,

I have added a new twilio_taskrouter_workspace_configuration resource. The docs can be found in the Terraform Registry. I haven't been able to fully solve the issue when deleting an activity but the documentation should provide enough information to work around this limitation. It would be easier if Terraform had the ability to retain resources on deletion but as this is not supported at the moment we have to work around it. If this solution becomes too problematic then feel free to raise an issue and I can look at further enhancements to make this easier to work with.

The new resource has been released as part of v0.15.0 which is now available in the Terraform Registry.

Please update your Terraform configuration to include the following

terraform {
  required_providers {
    twilio = {
      source = "RJPearson94/twilio"
      version = ">= 0.15.0"
    }
  }
}

Apologies this took so long to implement. I hope this helps and solves your issue.

Thanks again for using the provider.