Skip to content

Instantly share code, notes, and snippets.

@adminph-de
Last active August 17, 2022 12:38
Show Gist options
  • Save adminph-de/978af45ea210f1b6ca62ff1e8bfd6607 to your computer and use it in GitHub Desktop.
Save adminph-de/978af45ea210f1b6ca62ff1e8bfd6607 to your computer and use it in GitHub Desktop.
Terraform | Get Public IP Address
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