When vmseries_ami_id is specified in the asg module the plan errors out.
Expected behavior
If vmseries_ami_id is specified data.aws_ami.this[0].id should be ignored.
Current behavior
│ Error: Invalid index
│
│ on .terraform/modules/vm_series_asg/modules/asg/main.tf line 28, in resource "aws_launch_template" "this":
│ 28: image_id = coalesce(var.vmseries_ami_id, data.aws_ami.this[0].id)
│ ├────────────────
│ │ data.aws_ami.this is empty tuple
│
│ The given key does not identify an element in this collection value: the
│ collection has no elements.
Describe the bug
When
vmseries_ami_id
is specified in theasg
module the plan errors out.Expected behavior
If
vmseries_ami_id
is specifieddata.aws_ami.this[0].id
should be ignored.Current behavior
Possible solution
same solution as Issue PR
coalesce(var.vmseries_ami_id, try(data.aws_ami.this[0].id, null) )