Page 1 of 1

If you click on it, you should

Posted: Sun Dec 22, 2024 9:07 am
by poxoja9630
If you click on it, you should see that the two queues and two collaborators have been created: Screenshot of the Taskrouter workspace Edit an existing resource You can also create a new Twilio resource easily via APIs. The IaC approach is particularly effective when you need to modify a resource. Let's explain this with an example. Let's say you're working in a team and each dev has their own Twilio project. Throughout the development cycle, you need to make sure that all devs have the same resources in their project. The traditional approach (API) would be as follows: At the beginning of the project, distribute a script that uses API/SDK to create all the necessary resources All devs will run the script to fund their account Whenever it is necessary to modify a resource, you must distribute a new script that updates the Twilio resource(s) If a new dev joins the team (or an existing member wants to start a new project), he must run the first script for provisioning and all subsequent scripts to make the changes (in the specific order) This approach is not scalable and you may have to manage multiple scripts.

With the IaC approach, you simply modify the original script to add/change/remove resources, and commit the script to your shared code repository. Let's put this into practice. Suppose you want to change the name of the collaborator from Alice to Maria. To do this, simply change the property of workerOne in the code: JavaScript Copy the code ... const workerOne = new Resource('worker-one', { resource: ['taskrouter', { workspaces: workspace.sid }, 'workers'], attributes: { // friendlyName: 'Alice', friendlyName: 'Maria', attributes: JSON.stringify({ languages: ['en', 'es'] }), }, }); … If you run the deploy command again, you will see the following: Bash Copy the code telegram philippines girl Previewing update (dev): Type Name Plan Info pulumi:pulumi:Stack my-first-iac-project-dev ~ └─ pulumi-nodejs:dynamic:Resource worker-one update [diff: ~attributes] Resources: ~ 1 to update 6 unchanged This means that a resource ("worker-one") will be updated because one of the elements ( attributes) has changed since the last deployment.

Image

Select yes and press Enter. You will see the following: Bash Copy the code Updating (dev): Type Name Status Info pulumi:pulumi:Stack my-first-iac-project-dev ~ └─ pulumi-nodejs:dynamic:Resource worker-one updated [diff: ~attributes] Resources: ~ 1 updated 6 unchanged As you can see in the command output, Pulumi detected a change in worker-one and modified the deployed resource accordingly. If you navigate to the TaskRouter Workspaces page in the Twilio console, you will see that the collaborator name has changed: TaskRouter Collaborators Updated To make sure all other devs update their workspace, you need to distribute (e.g. commit the file to a shared directory) the new configuration file ( index.