Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
parkingspot-terraform-spot-instance
variable "spot_price" {
type = "string"
}
variable "instance_type" {
type = "string"
}
variable "region" {
type = "string"
}
resource "aws_spot_instance_request" "cheap_worker" {
ami = "ami-1234"
spot_price = "${var.spot_price}"
instance_type = "${var.instance_type}"
region = "${var.region}"
tags {
Name = "CheapWorker"
}
}
eval $(parkingspot -region us-west-2 -cpu 6)
export TF_VAR_region=${PARKINGSPOT_REGION}
export TF_VAR_spot_price=${PARKINGSPOT_BID}
export TF_VAR_instance_type=${PARKINGSPOT_INSTANCE_TYPE}
terraform apply
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.