Maximize efficiency with Terraformer: Manage Squadcast resources via IaC

December 23, 2022
Share this post:
Maximize efficiency with Terraformer: Manage Squadcast resources via IaC
Table of Contents:

    Ever since Terraform was first launched by HashiCorp, infrastructure teams have been quick to leverage its functionality. Because deploying infrastructure via code became so much easier and error-free. This surely became a great way to deploy new infrastructure with custom configurations, but what about managing cloud infrastructure that is already defined?

    Can Terraform be used to make changes to them? Or can it be used to deploy the same configurations to new environments? It maybe possible, but it’s not the preferred approach anyone follows.

    Unfortunately managing existing resources is slightly complicated with Terraform. You will have to do a terraform-import and define a resource block in terraform configuration with complete resource metadata. This however is a complex process where you have to manually apply the import command for all resources that belong to a project.

    Terraformer - Convert existing Infrastructure to Terraform Files (IaC)

    Terraformer, a CLI tool developed by Waze SRE and made open-source soon after, became quickly popular because of its capabilities of overcoming these challenges.

    How does it work?

    Terraformer can do the reverse of what Terraform does. With Terraformer, you can generate tf/json and tfstate files (terraform files) based on your infrastructure’s existing configurations. The same can be done to your existing Squadcast resources too. Follow this guide to use Terraformer with Squadcast: https://developers.squadcast.com/terraform/tutorial/how-to-use-terraformer/

    This is beneficial mainly for customers or users who have initially configured their Squadcast account using our API or Web UI. They can indeed use Terraformer to generate Terraform state files based on their account’s configuration. And they can continue to use Terraform going forward to manage their resources via IaC (Infrastructure as Code).

    Benefits (or advantages) of using Terraformer

    1. Read only permissions: Terraformer requires just the RO permissions. So there is no risk of changing existing infrastructure configurations
    2. Fast deployment: The use of VMs, storage buckets, PaaS resources, etc., in complex distributed architectures has made it difficult to quickly deploy resources. Leveraging IaC for the same can help you deploy complex infrastructures including Squadcast resources to multiple environments in just seconds
    3. Error free: The use of ‘Terraform import’ can lead to minor issues and downtime because of manual intervention. The use of Terraformer (IaC) automates manual tasks and reduces the risk of error to a great extent
    4. Cost: The use of Terraformer can help teams spend less time migrating existing infrastructure to their cloud environment, and more time to focus on critical tasks. This reduces the overall cost significantly

    Implementation - How to use Terraformer with Squadcast?

    To generate Terraform files for your existing Squadcast configuration, you can use our Squadcast implementation of Terraformer.

    Download Terraformer binaries

    You can either go to the following URL and download the appropriate binary for your OS: https://github.com/SquadcastHub/terraformer/releases

    Or you can run one of the below commands from the terminal to download the appropriate binaries:

    On MacOS:

    <p>CODE: https://gist.github.com/ShubhanjanMedhi-dev/6a87e97b9b3e6f51a5e10444c7984f58.js</p>

    On Linux:

    <p>CODE: https://gist.github.com/ShubhanjanMedhi-dev/04939c43c27a4127bf36858e9efb6351.js</p>

    On Windows:

    <p>CODE: https://gist.github.com/ShubhanjanMedhi-dev/74ab6830dbefb0f0318d25af5a39c258.js</p>

    Configure the binaries

    Go to the downloaded folder and run the below command to make the binary executable:

    <p>CODE: https://gist.github.com/ShubhanjanMedhi-dev/cf65b597ec02603b700c55854f14f18d.js</p>

    Move this executable to /usr/local/bin by running the below command:

    <p>CODE: https://gist.github.com/ShubhanjanMedhi-dev/ca432132b90327a7ede11d641e82ac40.js</p>

    Setup Terraform

    Create a new directory in your home folder. Inside this directory, create a new file called versions.tf and add the following code:

    <p>CODE: https://gist.github.com/ShubhanjanMedhi-dev/1a262364cbb0f8c53bf47e1e2a096046.js</p>

    And then initiate Terraform by running the following command:

    <p>CODE: https://gist.github.com/ShubhanjanMedhi-dev/f5e9e9364584d2f284d4fd79057f953b.js</p>

    Generate Terraform files

    Use Terraformer to import resources:

    <p>CODE: https://gist.github.com/ShubhanjanMedhi-dev/bc42f22ead6e8af98d91a7cd8ddaa075.js</p>

    This will create a new generated folder with all terraform files (including statefiles) based on the previous command.

    Update “version” and add “source” in newly autogenerated “provider.tf” file

    Go to /generated/squadcast/<RESOURCE_NAME>/<REGION>/provider.tf

    Add source = "SquadcastHub/squadcast" to squadcast inside required_providers

    Update version in required_providers by removing .exe (Windows users only)

    Update “terraform_version”

    First change path to this directory by running the following command:

    <p>CODE: https://gist.github.com/ShubhanjanMedhi-dev/eea548afd63efadca2a23868c3f744ac.js</p>

    And then run the following command:

    <p>CODE: https://gist.github.com/ShubhanjanMedhi-dev/f20b7ac1c026daf62263e06e9f4f58e8.js</p>

    Use Generated files with Terraform

    Update generated files as per your requirement and apply the changes using following commands:

    <p>CODE: https://gist.github.com/ShubhanjanMedhi-dev/2d71a381c49ec95e97bbf45dcbe7bb5b.js</p>

    Now you’re good to go! In just a few simple steps you’ve converted your entire Squadcast configuration into Infrastructure as Code. You can now use this code file to manage all resources on Squadcast such as adding users in bulk, defining roles to users, deploying the entire configuration to another environment, and much more.

    Squadcast is an incident management tool that’s purpose-built for SRE. Get rid of unwanted alerts, receive relevant notifications and integrate with popular ChatOps tools. Work in collaboration using virtual incident war rooms and use automation to eliminate toil.

    squadcast
    Written By:
    December 23, 2022
    December 23, 2022
    Share this post:
    Subscribe to our latest updates
    Enter your Email Id
    Thank you! Your submission has been received!
    Oops! Something went wrong while submitting the form.
    More from
    Vardhan NS
    What are Webhooks and why should developers use them?
    What are Webhooks and why should developers use them?
    January 20, 2023
    Why ‘owning Services’ is critical for effective Incident Response
    Why ‘owning Services’ is critical for effective Incident Response
    October 31, 2022
    Introducing Webforms - Involve end users directly into your Incident Management process
    Introducing Webforms - Involve end users directly into your Incident Management process
    September 14, 2022
    Learn how organizations are using Squadcast
    to maintain and improve upon their Reliability metrics
    Learn how organizations are using Squadcast to maintain and improve upon their Reliability metrics
    mapgears
    "Mapgears simplified their complex On-call Alerting process with Squadcast.
    Squadcast has helped us aggregate alerts coming in from hundreds...
    bibam
    "Bibam found their best PagerDuty alternative in Squadcast.
    By moving to Squadcast from Pagerduty, we have seen a serious reduction in alert fatigue, allowing us to focus...
    tanner
    "Squadcast helped Tanner gain system insights and boost team productivity.
    Squadcast has integrated seamlessly into our DevOps and on-call team's workflows. Thanks to their reliability...
    Alexandre Lessard
    System Analyst
    Martin do Santos
    Platform and Architecture Tech Lead
    Sandro Franchi
    CTO
    Squadcast is a leader in Incident Management on G2 Squadcast is a leader in Incident Management on G2 Users love Squadcast on G2 Best IT Management Products 2022 Squadcast is a leader in IT Service Management (ITSM) Tools on G2 Squadcast is a leader in IT Service Management (ITSM) Tools on G2 Squadcast is a leader in IT Service Management (ITSM) Tools on G2
    Squadcast awarded as "Best Software" in the IT Management category by G2 🎉 Read full report here.
    What our
    customers
    have to say
    mapgears
    "Mapgears simplified their complex On-call Alerting process with Squadcast.
    Squadcast has helped us aggregate alerts coming in from hundreds of services into one single platform. We no longer have hundreds of...
    Alexandre Lessard
    System Analyst
    bibam
    "Bibam found their best PagerDuty alternative in Squadcast.
    By moving to Squadcast from Pagerduty, we have seen a serious reduction in alert fatigue, allowing us to focus...
    Martin do Santos
    Platform and Architecture Tech Lead
    tanner
    "Squadcast helped Tanner gain system insights and boost team productivity.
    Squadcast has integrated seamlessly into our DevOps and on-call team's workflows. Thanks to their reliability metrics we have...
    Sandro Franchi
    CTO
    Revamp your Incident Response.
    Peak Reliability
    Easier, Faster, More Automated with SRE.
    Incident Response Mobility
    Manage incidents on the go with Squadcast mobile app for Android and iOS devices
    google playapple store
    Squadcast - On-call shouldn't suck. Incident response for SRE/DevOps, IT | Product Hunt Embed
    Squadcast is a leader in Incident Management on G2 Squadcast is a leader in Incident Management on G2 Users love Squadcast on G2 Best IT Management Products 2022 Squadcast is a leader in IT Service Management (ITSM) Tools on G2 Squadcast is a leader in IT Service Management (ITSM) Tools on G2 Squadcast is a leader in IT Service Management (ITSM) Tools on G2
    Squadcast - On-call shouldn't suck. Incident response for SRE/DevOps, IT | Product Hunt Embed
    Squadcast is a leader in IT Service Management (ITSM) Tools on G2 Squadcast is a leader in Incident Management on G2 Users love Squadcast on G2
    Best IT Management Products 2022 Squadcast is a leader in IT Service Management (ITSM) Tools on G2 Squadcast is a leader in IT Service Management (ITSM) Tools on G2
    Squadcast is a leader in IT Service Management (ITSM) Tools on G2
    Copyright © Squadcast Inc. 2017-2023