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 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
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
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
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:
chmod +x terraformer-all-<your_os>-<arch>
Add to /usr/local/bin
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:
terraform {
required_providers {
squadcast = {
source = "SquadcastHub/squadcast"
version = "1.0.5"
}
}
}
Run terraform init
Generate Terraform files
Use terraformer to import resources:
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”
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
terraform init
terraform plan
terraform apply