terraform-aws-ec2-instance icon indicating copy to clipboard operation
terraform-aws-ec2-instance copied to clipboard

v5.6.1 does not fix "ami variable when using without ssm" for fresh apply

Open vinayakgautamops opened this issue 1 year ago β€’ 0 comments

Steps to reproduce the behavior:

create a new project
create a new EC2 instance with the "terraform-aws-modules/ec2-instance/aws" module
include an AMI ID in the ami input variable
run terraform init
run terraform plan <-- produces error (see above)
Error: Invalid count argument
on .terraform/modules/vpn_server/main.tf line 12, in data "aws_ssm_parameter" "this":
12: count = local.create && var.ami == null ? 1 : 0

The "count" value depends on resource attributes that cannot be determined until apply, so Terraform cannot predict how many instances will be created. To work around this, use the -target argument to first apply only the resources that the count depends on.

Ref: https://github.com/terraform-aws-modules/terraform-aws-ec2-instance/issues/380

vinayakgautamops avatar Jun 04 '24 06:06 vinayakgautamops