Created
November 20, 2019 02:35
-
-
Save michaeljoy/129f6636a0058a0cce2f8739a4f5af9c to your computer and use it in GitHub Desktop.
Terraform 0.12 json public IP via http data provider, jsondecode, for all your 'where am I actually running this build needs' - my_public_ip.tf
This file contains hidden or 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" "my_public_ip" { | |
url = "https://ifconfig.co/json" | |
request_headers = { | |
Accept = "application/json" | |
} | |
} | |
locals { | |
ifconfig_co_json = jsondecode(data.http.my_public_ip.body) | |
} | |
output "my_ip_addr" { | |
value = local.ifconfig_co_json.ip | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is an IPv4 single IP ingress rule example with ICMP.