Let's use the following command to select a new Twilio project that we will use for our production deployment: Bash Copy the code $ twilio profiles:use <profile_name> You can now use the command twilio infra:environment:new to create a new environment (we'll call it prod) and twilio infra:deploy deploy it to your Twilio production project. Switch between environments If you now want to return to the environment test, you can use the following command: Bash Copy the code $ twilio infra:environment:set test Also, make sure to select the appropriate Twilio CLI profile before performing any deployments. If you are not sure what environment is currently set, you can check by running the following command: Bash Copy the code $ twilio infra:environment:get Using IaC in a DevOps environment So far, we've been using IaC with Twilio in an on-premises environment.
Most of the time, you'll use a DevOps tool to implement your CI/CD pipelines. In this article, we'll be using Azure DevOps , but you can easily adapt this example to use other products. Create a new project philippines whatsapp number using backend cloud storage Since we're going to use a cloud service to run our pipeline, we need to have a cloud service to store the IaC configuration metadata. In this example, we'll use the Pulumi service for our backend. If you haven't already, head over to the Pulumi signup page to try it for free. If you were previously using local storage for Pulumi, use the following command to disconnect: Bash Copy the code $ pulumi logout Once you are logged out, use the following command to connect to the Pulumi backend storage: Bash Copy the code $ pulumi login Follow the steps to authorize your computer to connect to your Pulumi account from the CLI.
Now let's initialize a new project. Create a new empty folder (for example my-second-iac-project) and type the following command inside: Bash Copy the code $ twilio infra:new After following the prompts and initializing the project, you should see your new project in the Projects tab of the Pulumi dashboard : New Pulumi project Edit the index.js file and insert the following code: JavaScript Copy the code 'use strict'; const pulumi = require('@pulumi/pulumi'); const { Resource } = require('twilio-pulumi-provider'); const workspace = new Resource('example-workspace', { resource: ['taskrouter', 'workspaces'], attributes: { friendlyName: 'New Workspace created with Pulumi', }, }); This is a simplified version of the code we created in Part 1.
Let's use the following command
-
- Posts: 9
- Joined: Sun Dec 22, 2024 5:36 am