I need to do a nslookup of the RDS instance address. What is the best way to do this via terraform?
I need to do a nslookup of the RDS instance address. What is the best way to do this via terraform?
98 Views Asked by rk123 At
2
There are 2 best solutions below
3
On
First of all, why do you need this information? You should never need to operate the IP address of your RDS because it's a managed service, and the IP address may change (service updates, failover), so it's safe to use its FQDN.
You can get FQDN from:
data "aws_db_instance" "database" {
db_instance_identifier = "my-test-database"
}
as data.aws_db_instance.database.address
Use an external data source. Here's a demo which shows how to use a bash script that uses
nslookupto retrieve the IP address forgoogle.com.Given
util.sh:and
main.tf: