OpenTofu (Terraform) aws_ami ARM 架构

问题描述 投票:0回答:1

我正在尝试使用 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 上给出的相同

terraform arm terraform-provider-aws opentofu
1个回答
0
投票

啊,原来我也想通了。

我有两个问题:

  1. 正如@MarkB指出的,
    architecture
    是输出,而不是输入
  2. 我正在寻找错误的 AMI;我需要使用
    ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-arm64-server-*
    作为名称
© www.soinside.com 2019 - 2024. All rights reserved.