Hi,
I am getting below error while running terraform plan,
Error: Invalid template interpolation value
on modules/chkpmgr/outputs.tf line 2, in output “admin_ssh”:
2: value = “ssh admin@${element(
3: concat(
4: coalescelist(
5: aws_instance.chkp_ec2..private_dns,
6: aws_instance.chkp_ec2prvip..private_dns,
7: list()
8: ),
9: [”“],
10: ),
11: 0,
12: )} from within private network.”
|----------------
| aws_instance.chkp_ec2 is empty tuple
| aws_instance.chkp_ec2prvip is empty tuple
Cannot include the given value in a string template: string required.
Below is my output.tf
output “admin_ssh” {
value = “ssh admin@${element(
concat(
coalescelist(
aws_instance.chkp_ec2..private_dns,
aws_instance.chkp_ec2prvip..private_dns,
list()
),
[”“],
),
0,
)} from within private network.”
}
output “instance_id” {
value = element(
concat(
coalescelist(
aws_instance.chkp_ec2..id,
aws_instance.chkp_ec2prvip..id,
list()
),
[“”],
),
0,
)
}
output “instance_tags” {
value = element(
concat(
coalescelist(
aws_instance.chkp_ec2..tags,
aws_instance.chkp_ec2prvip..tags,
list()
),
[“”],
),
0,
)
}
Please help what is getting wrong here