Hey folks! We’re excited to announce that we’ve vastly expanded the capabilities of our Terraform provider. Previously, our Terraform provider was limited to creating and managing services as a resource. We have now covered the entire spectrum of resources available on Squadcast right from creating and managing users, escalation policies and also managing SLO’s via our Terraform provider. What does that mean for you? Once you’ve created an organization within your account and configured Squadcast you can go ahead and manage our resources without having to navigate through our UI. An added advantage of this is that you can manage all of your cloud infrastructure from a single source i.e. Terraform. In this blog, we have condensed a few of the advantages of Infrastructure as Code (IaC) and a few examples of how you can configure Squadcast using our expanded Terraform provider.
It has become standard practice for modern businesses to rely on source control for software engineering. Code reviews, change history, and the ability to roll back are among the practices required for a company to ship software quickly and efficiently. Source control is also a key component of Agile and DevOps practices along with continuous integration and continuous deployment.
The key idea behind Infrastructure as Code(IaC) is to manage almost ‘everything’ as code, where everything involves your servers, network devices, databases, application configuration, automated tests, deployment process & cloud services like Squadcast. This consists of every stage of your infrastructure lifecycle, starting from defining, deploying, updating, and destroying. The advantage of defining every resource as IaC is you can now version control it, reuse it, validate it and build a self-service model in your organization.
Defining your infrastructure as code also has the following advantages
Terraform is an open-source tool created by HashiCorp. Terraform allows you to build, change, and version your infrastructure through code.
As the number of external services increases, Terraform has also grown to support the configuration of a variety of services. Terraform providers are available for a variety of cloud providers such as Amazon AWS, Oracle, Microsoft Azure and Google cloud to name a few.
We at Squadcast want to encourage our users to use Terraform with Squadcast as a single source for creating, editing and deleting resources in your account. With the increasing adoption of Terraform by teams as their tool of choice for defining parts of their infrastructure stack, we aim to make things simpler for our current and future users with the option to configure their Squadcast accounts and define their infrastructure in a single location.
By using the Terraform provider, you can manage Squadcast’s configuration as source code. This makes it easier for your On-call and SRE teams to manage resources such as creating escalation policies, creating services and managing members of a team at scale and quickly.
Before getting started with an example of how you can manage a Squadcast resource with Terraform here are a couple of helpful articles from our earlier series of informational blogs on Terraform.
The Squadcast’s verified provider now supports a broader range of Squadcast resources, from defining users, their roles and permissions, creating on-call schedules & to creating and managing SLO’s. Head over to our Squadcast provider documentation to see the full list of resources that are supported.
In order to install this provider, copy and paste this code into your Terraform configuration. Then, run terraform init.
Before creating any Terraform files you’ll first need to generate a refresh API token in Squadcast. The key that you generate will be used as the value for the token below. The documentation for that can be found here.
Note: The above must be done from within your profile settings in your Squadcast account.
For the sake of simplicity, let's assume that you will be creating resources from scratch using the terraform provider, the below example will show you how to create resources such as users.
To get started defining Squadcast resources with Terraform, create a directory where you want to store your Terraform (.tf) files. In that directory create a new file with the .tf extension. For the sake of his example walkthrough we are going to create a provider block for ‘Squadcast’. That block initializes the Squadcast provider, setting the value of the token using the API key generated above, and will look something like this:
With the provider set, you’ll now use resource blocks to define the specific Squadcast resources that you want to create and manage.
In the below example, to create a user in Squadcast, the Terraform configuration would look something like this:
As seen above, apart from creating the user you can also define the user's roles and abilities (permissions) that the user can have on your Squadcast account. Once you have added team members, teams & squads you can then create escalation policies.
The escalation policies can be as granular as preferred with options to define the time gap between each alert notification and the channels with which you would like to alert your on-call teams. You can also choose to repeat the sequence if none of the members present in the escalation policy has acknowledged the incident.
Once you have done the above you can go ahead and configure your services. Services are the core of what Squadcast offers and form the most logical components of your infrastructure for which alerts are generated. An example of what that would look like on Terraform is as below.
Tip: In order to get the best out of Squadcast check out this blog on how you can configure your services in Squadcast based on the current architecture and the type of on-call team you currently have.
As we move ahead with the evolution of Squadcast, we hope the expanded capabilities of Squadcast’s Terraform provider will help you manage our resources at scale and efficiently. This is under active development and we’ll keep improving the functionality of the provider as we go. To know more about our provider and the Squadcast resources you can manage, head over to our documentation. If you have any questions, or issues or would like to submit contributions to our Squadcast provider project, head over to our repository on GitHub.