【问题标题】:Terraform erroring waiting for ECS cluster等待 ECS 集群的 Terraform 错误
【发布时间】:2021-11-04 12:41:41
【问题描述】:

我正在使用 terraform 在 AWS 中创建 ECS 集群。

resource "aws_ecs_cluster" "cluster" {
  name               = "api-cluster"
  capacity_providers = ["FARGATE"]

  default_capacity_provider_strategy {
    capacity_provider = "FARGATE"
    weight            = "100"
  }
}

每当我运行此代码时,它都可以正常启动,但在等待创建集群时出现错误。

Terraform v1.0.0
on linux_amd64
Initializing plugins and modules...
aws_ecs_cluster.cluster: Creating...
aws_ecs_cluster.cluster: Still creating... [10s elapsed]
╷
│ Error: error waiting for ECS Cluster (arn:aws:ecs:xxxxxxxxxxx:cluster/api-cluster) to become Available: couldn't find resource
│ 
│   with aws_ecs_cluster.cluster,
│   on main.tf line 73, in resource "aws_ecs_cluster" "cluster":
│   73: resource "aws_ecs_cluster" "cluster" {
│ 
╵

最终部署ECS集群,但脚本出错。我做错了什么?

【问题讨论】:

  • 只等了10秒?这听起来不像是默认行为。您是否在某处配置了某种等待期覆盖?
  • @MarkB - 根本没有。我还有其他脚本以相同的方式运行,等待 CloudFront 发行版等超过 90 秒。如果相关,我正在通过 Terraform Cloud 运行。
  • 那么这……令人困惑。该特定代码路径等待不可配置的 10 分钟,直到 API 显示它处于 ACTIVE 状态。只是为了检查这里使用的 IAM 用户/角色是否具有描述集群的 IAM 权限?
  • 您是否以任何方式删除了该错误消息?
  • @ydaetskcoR 你是对的。我错过了ecs:DescribeClusters

标签: terraform amazon-ecs terraform-provider-aws


【解决方案1】:

事实证明,这是因为需要在执行terraform apply 的用户上允许ecs:DescribeClusters 操作。

感谢@ydaetskocR 为我指明了正确的方向。

【讨论】:

    猜你喜欢
    • 2022-01-11
    • 1970-01-01
    • 2018-10-03
    • 1970-01-01
    • 1970-01-01
    • 2021-10-31
    • 2021-03-16
    • 1970-01-01
    • 2020-07-31
    相关资源
    最近更新 更多