Last active
September 28, 2016 03:34
-
-
Save abhiyerra/4e4f6b50ab0fac1f48884c8c6bad2411 to your computer and use it in GitHub Desktop.
parkingspot-terraform-spot-instance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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