terraform plan이나 apply 명령어 실행 시, resource나 data 블럭을 실행했을 때 결과를 출력할 수 있다.

resource로부터 출력 결과 확인

resource "aws_vpc" "terraform_vpc" {
  cidr_block = "10.0.0.0/16"
}

output "result" {
  value = aws_vpc.terraform_vpc
}

data로부터 출력 결과 확인

맨 앞에 반드시 ‘.data’ 붙여줘야 함

data "aws_availability_zones" "available" {
  state = "available"
}

output "result" {
  value = data.aws_availability_zones.available
}