0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

terraformで「Error: Failed getting task definition ClientException: Unable to describe task definition. "XXXXX"」

Posted at

terraformで、

Error: Failed getting task definition ClientException: Unable to describe task definition. "XXXX"

というエラーが出た時の対応です。

エラーが発生するtfファイル

resource "aws_ecs_task_definition" "test" {
  // 省略
}

# Simply specify the family to find the latest ACTIVE revision in that family.
data "aws_ecs_task_definition" "test" {
  task_definition = aws_ecs_task_definition.test.family
}

一見問題なさそうですが、新規作成の時にエラーが発生します。

対応

resource "aws_ecs_task_definition" "test" {
  // 省略
}

# Simply specify the family to find the latest ACTIVE revision in that family.
data "aws_ecs_task_definition" "test" {
  task_definition = aws_ecs_task_definition.test.family
  depends_on      = [aws_ecs_task_definition.test] // 追加
}

この様に、depends_onで依存関係を明示してあげるとうまくいきます。

参考

data.aws_ecs_task_definition: Failed getting task definition · Issue #1274 · hashicorp/terraform-provider-aws
aws_ecs_task_definition | Data Sources | hashicorp/aws | Terraform Registry

※この記事を書いている段階で、terraformのドキュメントのexample通りに書いてもこの事象が発生します

補足

Terraform v0.13.5 で動作確認しました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?