Created
May 26, 2023 16:30
-
-
Save shreeegupta/aae39144eea2fbb20bf57a238ade60cd to your computer and use it in GitHub Desktop.
outputs.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Outputs | |
output "web_server_public_ip" { | |
description = "Public IP of Web Servers" | |
value = [for i in aws_instance.web_server[*] : i.public_ip] | |
} | |
output "ec2_ssh_access" { | |
description = "SSH Remote Access to the first EC2 instance" | |
value = "ssh -i ${var.ssh_key}.pem ubuntu@${aws_instance.web_server[0].public_ip}" | |
} | |
output "db_name" { | |
description = "Database Name" | |
value = aws_db_instance.db_instance.db_name | |
} | |
output "db_address" { | |
description = "The hostname of the RDS instance" | |
value = aws_db_instance.db_instance.address | |
} | |
output "connect_to_database" { | |
description = "Command to connect to database from EC2" | |
value = "mysql --host=${aws_db_instance.db_instance.address} --user=${var.db_username} -p" | |
} | |
output "alb_public_url" { | |
description = "Public URL for Application Load Balancer" | |
value = aws_lb.alb.dns_name | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment