gpt4 book ai didi

amazon-web-services - 地形错误 "Your query returned no results"

转载 作者:行者123 更新时间:2023-12-03 20:26:27 26 4
gpt4 key购买 nike

我有以下 bom-asg.tf 文件。

data "aws_ami" "bom-ami" {
most_recent = true

filter {
name = "tag:ami_name"
values = ["${var.environment}-bom-ami"]
}

owners = ["****"]
}

resource "aws_security_group" "bom-sg" {
name_prefix = "${var.environment}-bom-asg-sg"
vpc_id = "${var.vpc_id}"
.....

我无法成功执行刷新和计划命令。我收到以下错误。
terraform plan --var-file=environment-parity.tfvars -target=bom-asg.tf --out apply.out
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.


------------------------------------------------------------------------

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.

但是当我运行刷新时。我得到低于错误。
terraform refresh --var-file=environment-parity.tfvars
data.template_file.es_access_policy_search: Refreshing state...
data.aws_ami.nginx-ami: Refreshing state...
data.aws_ami.php-search-ami: Refreshing state...
data.aws_ami.ng-ami: Refreshing state...
data.aws_ami.mysql-ami: Refreshing state...
data.aws_ami.frontend-search-ami: Refreshing state...
data.aws_ami.bom-ami: Refreshing state...
data.aws_ami.lg-ami: Refreshing state...
data.aws_ami.rabbitmq-search-ami: Refreshing state...
data.aws_ami.ngas-ng-drupal-ami: Refreshing state...
data.aws_ami.mongodb-ami: Refreshing state...

Error: Error refreshing state: 1 error(s) occurred:

* data.aws_ami.bom-ami: 1 error(s) occurred:

* data.aws_ami.bom-ami: data.aws_ami.bom-ami: Your query returned no results. Please change your search criteria and try again.

你能帮忙吗?

最佳答案

地形 数据源是访问现有资源,而不是创建资源。

data "aws_ami" "bom-ami"

在文档中,AMI 需要已经存在。
  • Data Source: aws_ami

  • Use this data source to get the ID of a registered AMI for use in other resources.



    如果您要从从 EC2 实例(例如 Amazon Linux EC2)获取的 EBS 快照创建 AMI,则:
  • Resource: aws_ami

  • 请注意 之间的区别数据资源 .

    要创建自定义 AMI 镜像,还请考虑 Hashicorp packer .

    关于amazon-web-services - 地形错误 "Your query returned no results",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60280384/

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