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.
| Name | Version |
|---|---|
| terraform | ~> 1.0 |
| curl2 | ~> 1.6 |
| external | ~> 2.3.1 |
| http | ~> 3 |
| Name | Version |
|---|---|
| curl2 | 1.6.1 |
| external | 2.3.5 |
| http | 3.5.0 |
No modules.
| Name | Type |
|---|---|
| curl2_curl2.myip | data source |
| external_external.external_curl | data source |
| http_http.myip | data source |
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| data_provider | curl2 or http providers are also supported - we recommend external_curl because it handles failure better |
string |
"external_curl" |
no |
| extra_service_urls | Put your own in here if you want extra ones, this gets merged with the service_urls list |
list(string) |
[] |
no |
| request_timeout | Request timeout in milliseconds | number |
500 |
no |
| retry_attempts | Request retries | number |
1 |
no |
| service_urls | List of urls to use for getting our IP (includes both IPv4 and IPv6 services) | list(string) |
[ |
no |
| Name | Description |
|---|---|
| ipv4 | The most common ipv4 response |
| ipv4_all_matches | List of all ipv4 matches (informational/testing) |
| ipv4_distinct_matches | List of unique ipv4 matches |
| ipv4_frequency_map | Map of IPv4 addresses to their frequency count |
| ipv6 | The most common ipv6 response |
| ipv6_all_matches | List of all ipv6 matches (informational/testing) |
| ipv6_distinct_matches | List of unique ipv6 matches |
| ipv6_frequency_map | Map of IPv6 addresses to their frequency count |
| service_statistics | Statistics about service responses |
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 the curl2 nor http 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. The curl2 provider is slightly more reliable than the http provider. This failure mode makes sense if it's a critical part of your terraform..
Both of curl2 and http providers are provided as a matter of them being possibly better in the future if/when they have some ignore_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 an external_curl using the external provider and a shim script external_curl.sh, which will survive a truly non-resolving non-responsive endpoint by faking the response data, which will be filtered out later by our ipv4_matches and ipv6_matches filters.
Alex Trull (firstname@lastname.org)
BSD-3
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!
- I am very fond of you all.