# How to use Terraformer with Squadcast?

If you are already using Squadcast via API or the Web UI and would like to generate the Terraform files for your existing Squadcast configuration, you can use our [Squadcast implementation of Terraformer](https://github.com/SquadcastHub/terraformer) to do the same.

## Download Terraformer binaries

Download the release using any of the following methods:

Go to: <https://github.com/SquadcastHub/terraformer/releases> and download the appropriate binary for your OS.

or

Run the following command:

### MacOS

```sh
curl -LO https://github.com/SquadcastHub/terraformer/releases/download/$(curl -s https://api.github.com/repos/SquadcastHub/terraformer/releases/latest | grep tag_name | cut -d '"' -f 4)/terraformer-all-darwin-amd64
```

### Linux

```sh
curl -LO https://github.com/SquadcastHub/terraformer/releases/download/$(curl -s https://api.github.com/repos/SquadcastHub/terraformer/releases/latest | grep tag_name | cut -d '"' -f 4)/terraformer-all-linux-amd64
```

### Windows

```sh
curl -LO https://github.com/SquadcastHub/terraformer/releases/download/$(curl -s https://api.github.com/repos/SquadcastHub/terraformer/releases/latest | grep tag_name | cut -d '"' -f 4)/terraformer-all-windows-amd64
```

## Configure the binaries

Make the binary executable:

```sh
chmod +x terraformer-all-<your_os>-<arch>
```

Add to /usr/local/bin

```sh
sudo mv terraformer-all-<your_os>-<arch> /usr/local/bin/terraformer
```

## Setup Terraform

Create a new directory in your home folder and add versions.tf file and add the following code:

```tf
terraform {
  required_providers {
    squadcast = {
      source = "SquadcastHub/squadcast"
      version = "1.0.5"
    }
  }
}
```

Run `terraform init`

## Generate Terraform files

Use terraformer to import resources:

```tf
terraformer import squadcast --resources=RESOURCE_NAME(s) --region=REGION --team-name=TEAM_NAME --refresh-token=YOUR_REFRESH_TOKEN
```

This will create a `generated` folder with all terraform files(including statefiles) depending upon the previous command.

## Update "version" and add "source" in 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"

```sh
cd /generated/squadcast/<RESOURCE_NAME>/<REGION>

terraform state replace-provider -auto-approve "registry.terraform.io/-/squadcast" "SquadcastHub/squadcast"
```

## Use Generated files with Terraform

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

```tf
terraform init
terraform plan
terraform apply
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.incidents.cloud.solarwinds.com/integration-and-extensibility/terraform/tutorial/how-to-use-terraformer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
