Terraform importブロックでError: Too many command line argumentsが出る

概要

以下のimportブロックで

import {
  to = aws_iam_openid_connect_provider.github_actions_cicd_provider
  id = "arn:aws:iam::${var.AWS_ACCOUNT_ID}:oidc-provider/token.actions.githubusercontent.com"
}

以下のコマンドを実行すると

terraform plan -generate-config-out=generated.tf

以下のエラーが出てしまう

terraform plan -generate-config-out=generated.tf
╷
│ Error: Too many command line arguments
│
│ To specify a working directory for the plan, use the global -chdir flag.
╵

For more help on using this command, run:
  terraform plan -help

解決策

VScodeでpowershellだと発生する事象なのでCMDを使う

参考

[Bug]: Terraform plan in v1.5 giving error for import block · Issue #31978 · hashicorp/terraform-provider-aws
Terraform Core Version 1.5.0 AWS Provider Version 5.3.0 Affected Resource(s) Trying the new feature which automatically generates the config file :

コメント

タイトルとURLをコピーしました