【发布时间】:2021-01-02 01:08:46
【问题描述】:
问题:我正在使用 terraform 获取特定操作系统的 AMI 列表 - ubuntu 20.08
我检查了不同的例子link
当我使用脚本时,这不会给我 AMI 列表
脚本
data "aws_ami" "ubuntu" {
most_recent = true
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-xenial-20.08-amd64-server-*"]
}
filter {
name = "virtualization - type"
values = ["hvm"]
}
owners = ["AWS"]
}
我也参考了下面的链接
How are data sources used in Terraform?
输出:
[ec2-user@ip-172-31-84-148 ~]$ terraform plan
provider.aws.region
The region where AWS operations will take place. Examples
are us-east-1, us-west-2, etc.
Enter a value: us-east-1
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
data.aws_ami.std_ami: Refreshing state...
------------------------------------------------------------------------
No changes. Infrastructure is up-to-date.
This means that Terraform did not detect any differences between your configuration and real physical resources that exist. As a result, no actions need to be performed.
我不确定我哪里出错了我检查了很多链接,其中一些我在下面列出。
【问题讨论】:
-
没有 20.08,Xenial 指的是 16.04。您想使用最新的 Ubuntu LTS 吗?这是 20.04,代号为
focal。因此,您要搜索的 AMI 应该是ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*。 Canonical 还在 cloud-images.ubuntu.com/locator/ec2 上发布了 AMI 列表。 -
@ydaetskcoR 是的,我需要最新的对不起,我在 terraform 方面不是很好。请指导我>>我正在寻找 AMI + ubuntu 20.08 的列表
标签: amazon-web-services terraform