我正在尝试使用Terraform在VPC中启动一个现场实例。
我有一个有效的aws_instance
设置,只是将其更改为aws_spot_instance_request
,但我总是收到此错误:
* aws_spot_instance_request.machine: Error requesting spot instances: InvalidParameterCombination: VPC security groups may not be used for a non-VPC launch
status code: 400, request id: []
我的.tf
文件如下所示:
provider "aws" {
access_key = "${var.access_key}"
secret_key = "${var.secret_key}"
region = "${var.region}"
}
resource "template_file" "userdata" {
filename = "${var.userdata}"
vars {
domain = "${var.domain}"
name = "${var.name}"
}
}
resource "aws_spot_instance_request" "machine" {
ami = "${var.amiPuppet}"
key_name = "${var.key}"
instance_type = "c3.4xlarge"
subnet_id = "${var.subnet}"
vpc_security_group_ids = [ "${var.securityGroup}" ]
user_data = "${template_file.userdata.rendered}"
wait_for_fulfillment = true
spot_price = "${var.price}"
tags {
Name = "${var.name}.${var.domain}"
Provider = "Terraform"
}
}
resource "aws_route53_record" "machine" {
zone_id = "${var.route53ZoneId}"
name = "${aws_spot_instance_request.machine.tags.Name}"
type = "A"
ttl = "300"
records = ["${aws_spot_instance_request.machine.private_ip}"]
}
我不明白为什么它不起作用......
spot_instance_request
代表aws_instance
支持aws_instance
的所有参数,因此,我只是将工作spot_instance_request
更改为Unable to copy icudt46l.zip file
(添加了价格)。我做错了什么?
我最初在documentation打开了这个问题,但没有人回复我。
答案 0 :(得分:0)
这是terraform中的一个错误,似乎在主人身上得到了修复。