gpt4 book ai didi

amazon-web-services - aws 配置 : Mismatch of Security group IDs and names

转载 作者:行者123 更新时间:2023-12-02 13:46:41 25 4
gpt4 key购买 nike

我有以下配置:

resource "aws_security_group" "allow_ssh" {
name = "allow_ssh"
vpc_id = "${aws_default_vpc.default.id}"
description = "Allow ssh connections on port 22"
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
}

resource "aws_instance" "your-app" {
ami = "ami-2757f631"
instance_type = "t2.micro"
security_groups = ["${aws_security_group.allow_ssh.id}"]
key_name = "${aws_key_pair.twilio_key.key_name}"
}

当我这样做时 terraform apply ,我收到此错误:
* aws_instance.your-app: Error launching instance, possible mismatch of Security Group IDs and Names. See AWS Instance docs here: https://terraform.io/docs/providers/aws/r/instance.html.

AWS Error: Value () for parameter groupId is invalid. The value cannot be empty

我应该怎么做才能解决上述错误?

最佳答案

你要改idname让它工作:

resource "aws_instance" "twilio-app" {
ami = "ami-2757f631"
instance_type = "t2.micro"
key_name = "${aws_key_pair.twilio_key.key_name}"
security_groups = [ "${aws_security_group.allow_ssh.name}" ]
}

它接受组名而不是 id 参数。

关于amazon-web-services - aws 配置 : Mismatch of Security group IDs and names,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50611459/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com