【发布时间】: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