terraform plan を実行すると、次のエラーが発生しました。
Error: Reference to undeclared input variable
│
│ on .terraform/modules/ec2-datapipeline/main.tf line 5, in resource "aws_instance" "this":
│ 5: count = "${var.count}"
│
│ An input variable with the name "count" has not been declared. This
│ variable can be declared with a variable "count" {} block.
╵
╷
│ Error: Incorrect attribute value type
│
│ on .terraform/modules/ec2-datapipeline/main.tf line 13, in resource "aws_instance" "this":
│ 13: vpc_security_group_ids = ["${var.vpc_security_group_ids}"]
│ ├────────────────
│ │ var.vpc_security_group_ids is a list of string, known only after apply
│
│ Inappropriate value for attribute "vpc_security_group_ids": element 0:
│ string required.
╵
╷
│ Error: Unsupported argument
│
│ on .terraform/modules/ec2-datapipeline/main.tf line 23, in resource "aws_instance" "this":
│ 23: root_block_device = "${var.root_block_device}"
│
│ An argument named "root_block_device" is not expected here. Did you mean to
│ define a block of type "root_block_device"?
╵
╷
│ Error: Unsupported argument
│
│ on .terraform/modules/ec2-datapipeline/main.tf line 24, in resource "aws_instance" "this":
│ 24: ebs_block_device = "${var.ebs_block_device}"
│
│ An argument named "ebs_block_device" is not expected here. Did you mean to
│ define a block of type "ebs_block_device"?
╵
╷
│ Error: Unsupported argument
│
│ on .terraform/modules/ec2-datapipeline/main.tf line 25, in resource "aws_instance" "this":
│ 25: ephemeral_block_device = "${var.ephemeral_block_device}"
│
│ An argument named "ephemeral_block_device" is not expected here. Did you
│ mean to define a block of type "ephemeral_block_device"?
╵
╷
│ Error: Error in function call
│
│ on .terraform/modules/ec2-datapipeline/main.tf line 36, in resource "aws_instance" "this":
│ 36: tags = "${merge(var.tags, map("Name", format("%s-%d", var.name, count.index+1)))}"
│ ├────────────────
│ │ count.index is a number, known only after apply
│ │ var.name will be known only after apply
│
│ Call to function "map" failed: the "map" function was deprecated in
│ Terraform v0.12 and is no longer available; use tomap({ ... }) syntax to
│ write a literal map.
.terraform/modules/main.tf
それらをandファイルで修正するとvariables.tf
、計画は成功し、CLI からトリガーすると実行されました。しかし、UI からプランをトリガーするときに実際にコードをプッシュすると、機能しません。
だから、私がするときterraform init --upgrade
。正常に戻り、同じ問題が見られます。
これを解決するのを手伝ってくれませんか?ありがとう!