For Terraform to work with Spotinst, configure the Spotinst provider and create an AWS group:

# Configure the Spotinst provider
provider "spotinst" {
token         = "${var.spotinst_token}"
account       = "${var.spotinst_account}"

# Create an AWS group
resource "spotinst_aws_group" "foo" {


Provide the required Spotinst Token Personal Access Token and Spotinst Account ID

  • Create a new Spotinst resource
  • If you don’t mention the account id resources will be created in the default Spotinst account.
  • Once everything is setup correctly, execute your Terraform file and apply the changes. An API call to Spotinst will be triggered, and create an Elastigroup.