Last active
August 17, 2022 12:38
-
-
Save adminph-de/978af45ea210f1b6ca62ff1e8bfd6607 to your computer and use it in GitHub Desktop.
Terraform | Get Public IP Address
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
data "http" "publicIp" { | |
url = "https://ifconfig.co/json" | |
request_headers = { | |
Accept = "application/json" | |
} | |
} | |
output "publicIp_json" { | |
value = jsondecode(data.http.publicIp.body) | |
} | |
output "publicIp_ip" { | |
value = jsondecode(data.http.publicIp.body).ip | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment