A terraform provider to get your public IP
Service provided by myip.com
terraform {
required_providers {
whatsmyip = {
source = "dewhurstwill/whatsmyip"
version = "1.0.3"
}
}
}
provider "whatsmyip" {}
data "whatsmyip" "public_ip" {}
output "ip" {
value = data.whatsmyip.public_ip.ip
}
output "country" {
value = data.whatsmyip.public_ip.country
}id(String) The ID of this resource.ip(String) Your current public IPcountry(String) IP country location in English languagecc(String) Two-letter country code in ISO 3166-1 alpha-2 format