Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A terraform module to reliably get my ip (v4 and/or v6) even when some services could fail or give wrong answers or you have hashed connections.

License

NotificationsYou must be signed in to change notification settings

atrull/terraform-overbuilt-getmyip

Repository files navigation

What it does

This module polls a series of fairly well known but occasionally unreliable 'what is my ip' services. It then produces the most common response that is a valid ipv4 or ipv6 address (both outputs are separately provided).

Especially useful if you have connection hashing - the distinct matches outputs will provide a list of your current public source addresses.

Requirements

NameVersion
terraform~> 1.0
curl2~> 1.6
external~> 2.3.1
http~> 3

Providers

NameVersion
curl21.6.1
external2.3.5
http3.5.0

Modules

No modules.

Resources

NameType
curl2_curl2.myipdata source
external_external.external_curldata source
http_http.myipdata source

Inputs

NameDescriptionTypeDefaultRequired
data_providercurl2 orhttp providers are also supported - we recommendexternal_curl because it handles failure betterstring"external_curl"no
extra_service_urlsPut your own in here if you want extra ones, this gets merged with theservice_urls listlist(string)[]no
request_timeoutRequest timeout in millisecondsnumber500no
retry_attemptsRequest retriesnumber1no
service_urlsList of urls to use for getting our IP (includes both IPv4 and IPv6 services)list(string)
[
"https://ipinfo.io/ip",
"https://ifconfig.co",
"https://icanhazip.com",
"https://api.ipify.org",
"https://ifconfig.me",
"https://ipecho.net/plain",
"https://ifconfig.io",
"https://ident.me",
"https://checkip.amazonaws.com",
"https://httpbin.org/ip",
"https://myexternalip.com/raw",
"https://wtfismyip.com/text",
"https://ip.seeip.org",
"https://curlmyip.net",
"https://ipv4.icanhazip.com",
"https://ipv6.icanhazip.com",
"https://ipv6.ident.me",
"https://v6.ident.me"
]
no

Outputs

NameDescription
ipv4The most common ipv4 response
ipv4_all_matchesList of all ipv4 matches (informational/testing)
ipv4_distinct_matchesList of unique ipv4 matches
ipv4_frequency_mapMap of IPv4 addresses to their frequency count
ipv6The most common ipv6 response
ipv6_all_matchesList of all ipv6 matches (informational/testing)
ipv6_distinct_matchesList of unique ipv6 matches
ipv6_frequency_mapMap of IPv6 addresses to their frequency count
service_statisticsStatistics about service responses

Providers and their Limitations : An explanation.

The goal of this module is to provide a valid-enough answer even when the internet does what the internet does, which is to be flaky and broken somewhere, sometime.

Neither thecurl2 norhttp providers are perfectly suited to the internet since they will fail a run if the url doesn't respond and/or the url doesn't resolve. Thecurl2 provider is slightly more reliable than thehttp provider. This failure mode makes sense if it's a critical part of your terraform..

Both ofcurl2 andhttp providers are provided as a matter of them being possibly better in the future if/when they have someignore_failure options.

Since we're aggregating results to achieve a 'most common' response it frankly shouldn't matter if one of the endpoints in the list fails to respond - we will have gathered enough data to make a good response. Let the build roll on!

As such we implement anexternal_curl using theexternal provider and a shim scriptexternal_curl.sh, which will survive a truly non-resolving non-responsive endpoint by faking the response data, which will be filtered out later by ouripv4_matches andipv6_matches filters.

Authors

Alex Trull (firstname@lastname.org)

License

BSD-3

Inspiration

The failed builds because the myip service I had chosen wasn't working or there was a routing error in the pipeline. I owe it all to you!

Additional information for users from all ip addresses

  • I am very fond of you all.

About

A terraform module to reliably get my ip (v4 and/or v6) even when some services could fail or give wrong answers or you have hashed connections.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp