I am trying to understand the benefit of having a Concat function in the output section. as I have experiment output section with and without Concat. But I cannot see any difference.
example
resource "aws_security_group" "sg_22" {
name = "sgx_22"
vpc_id = var.vpc
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
}
resource "aws_security_group" "sg_8080" {
name = "sgx_8080"
vpc_id = var.vpc
ingress {
from_port = 8080
to_port = 8080
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
}
output "web_security_group_ids" {
value = concat([aws_security_group.sg_22.id, aws_security_group.sg_8080.id])
}
VS
resource "aws_security_group" "sg_22" {
name = "sgx_22"
vpc_id = var.vpc
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
}
resource "aws_security_group" "sg_8080" {
name = "sgx_8080"
vpc_id = var.vpc
ingress {
from_port = 8080
to_port = 8080
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
}
output "web_security_group_ids" {
value = [aws_security_group.sg_22.id, aws_security_group.sg_8080.id]
}
In both case, Terraform give the same output in the same format. Any idea?