我正在尝试使用 OpenTofu (Terraform) 创建 ARM 机器,但无法通过使用 ARM 架构搜索来搜索/创建 AMI。这是我正在使用的块:
data "aws_ami" "ubuntu" {
most_recent = "true"
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
architecture = "arm64"
owners = ["099720109477"]
}
是的,搜索还需要删除
amd64
这是错误:
╷
│ Error: Value for unconfigurable attribute
│
│ with data.aws_ami.ubuntu,
│ on main.tf line 411, in data "aws_ami" "ubuntu":
│ 411: architecture = "arm64"
│
│ Can't configure a value for "architecture": its value will be decided
│ automatically based on the result of applying this configuration.
╵
Error: OpenTofu exited with code 1.
make: *** [makefile:228: tofu-plan] Error 1
Error: Process completed with exit code 2.
我还没有尝试过
arm
,但 arm64
与 AWS Image API 上给出的相同
啊,原来我也想通了。
我有两个问题:
architecture
是输出,而不是输入ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-arm64-server-*
作为名称