-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Descriptions and Readme improvements (#4)
* Switched to curl2 provider which includes timeout configuration * Extended documentation to cover author and output descriptions. * Reordered outputs & Variables
- Loading branch information
Showing
4 changed files
with
79 additions
and
32 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,29 @@ | ||
# Overbuilt myip module | ||
|
||
## What it does: | ||
## 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). | ||
|
||
We support two providers - `curl` and `http`. `curl` is the default provider because it has better failure handling whereas `http` provider will fail a plan/apply if the endpoint doesn't respond. | ||
We support two providers - `curl2` and `http`. `curl2` is the default provider because it has better failure handling whereas `http` provider will fail a plan/apply if the endpoint doesn't respond. | ||
|
||
## Limitations | ||
|
||
Neither the `curl2` nor `http` providers are perfect. The `curl2` provider is slightly more reliable than the `http` provider. We should ideally check DNS prior to polling, or find a provider that won't poll unless dns resolves - or won't fail if it doesn't resolve. | ||
|
||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.0 | | ||
| <a name="requirement_curl"></a> [curl](#requirement\_curl) | ~> 1.0.2 | | ||
| <a name="requirement_curl2"></a> [curl2](#requirement\_curl2) | ~> 1.6 | | ||
| <a name="requirement_http"></a> [http](#requirement\_http) | ~> 3 | | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_curl"></a> [curl](#provider\_curl) | 1.0.2 | | ||
| <a name="provider_curl2"></a> [curl2](#provider\_curl2) | 1.6.1 | | ||
| <a name="provider_http"></a> [http](#provider\_http) | 3.4.0 | | ||
|
||
## Modules | ||
|
@@ -30,23 +34,41 @@ No modules. | |
|
||
| Name | Type | | ||
|------|------| | ||
| [curl_curl.myip](https://registry.terraform.io/providers/anschoewe/curl/latest/docs/data-sources/curl) | data source | | ||
| [curl2_curl2.myip](https://registry.terraform.io/providers/mehulgohil/curl2/latest/docs/data-sources/curl2) | data source | | ||
| [http_http.myip](https://registry.terraform.io/providers/hashicorp/http/latest/docs/data-sources/http) | data source | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_data_provider"></a> [data\_provider](#input\_data\_provider) | `curl` or `http` providers are both supported - we recommend `curl` | `string` | `"curl"` | no | | ||
| <a name="input_data_provider"></a> [data\_provider](#input\_data\_provider) | `curl2` or `http` providers are both supported - we recommend `curl2` | `string` | `"curl2"` | no | | ||
| <a name="input_extra_service_urls"></a> [extra\_service\_urls](#input\_extra\_service\_urls) | Put your own in here if you want extra ones, this gets merged with the `service_urls` list | `list(string)` | `[]` | no | | ||
| <a name="input_service_urls"></a> [service\_urls](#input\_service\_urls) | List of urls to use for getting our IP | `list(string)` | <pre>[<br> "https://api.seeip.org",<br> "https://ipinfo.io/ip",<br> "https://ifconfig.co",<br> "https://icanhazip.com",<br> "https://api.ipify.org",<br> "https://ifconfig.me",<br> "https://ipecho.net/plain",<br> "https://ifconfig.io",<br> "http://eth0.me/",<br> "https://ident.me",<br> "https://ipv4.ident.me"<br>]</pre> | no | | ||
| <a name="input_request_timeout"></a> [request\_timeout](#input\_request\_timeout) | Request timeout in milliseconds | `number` | `500` | no | | ||
| <a name="input_retry_attempts"></a> [retry\_attempts](#input\_retry\_attempts) | Request retries | `number` | `0` | no | | ||
| <a name="input_service_urls"></a> [service\_urls](#input\_service\_urls) | List of urls to use for getting our IP | `list(string)` | <pre>[<br> "https://api.seeip.org",<br> "https://ipinfo.io/ip",<br> "https://ifconfig.co",<br> "https://icanhazip.com",<br> "https://api.ipify.org",<br> "https://ifconfig.me",<br> "https://ipecho.net/plain",<br> "https://ifconfig.io",<br> "https://ident.me",<br> "https://ipv4.ident.me"<br>]</pre> | no | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| <a name="output_ipv4"></a> [ipv4](#output\_ipv4) | n/a | | ||
| <a name="output_ipv4_all_matches"></a> [ipv4\_all\_matches](#output\_ipv4\_all\_matches) | n/a | | ||
| <a name="output_ipv6"></a> [ipv6](#output\_ipv6) | n/a | | ||
| <a name="output_ipv6_all_matches"></a> [ipv6\_all\_matches](#output\_ipv6\_all\_matches) | n/a | | ||
| <a name="output_ipv4"></a> [ipv4](#output\_ipv4) | The most common ipv4 response | | ||
| <a name="output_ipv4_all_matches"></a> [ipv4\_all\_matches](#output\_ipv4\_all\_matches) | List of all the ipv4 matches (informational/testing) | | ||
| <a name="output_ipv6"></a> [ipv6](#output\_ipv6) | The most common ipv6 response | | ||
| <a name="output_ipv6_all_matches"></a> [ipv6\_all\_matches](#output\_ipv6\_all\_matches) | List of all the ipv6 matches (informational/testing) | | ||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
|
||
## Authors | ||
|
||
Alex Trull ([email protected]) | ||
|
||
## 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. |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
|
||
output "ipv4_all_matches" { | ||
value = local.ipv4_matches | ||
output "ipv4" { | ||
value = join("", local.ipv4_most_common_response) | ||
description = "The most common ipv4 response" | ||
} | ||
|
||
output "ipv6_all_matches" { | ||
value = local.ipv6_matches | ||
output "ipv6" { | ||
value = join("", local.ipv6_most_common_response) | ||
description = "The most common ipv6 response" | ||
} | ||
|
||
output "ipv4" { | ||
value = join("", local.ipv4_most_common_response) | ||
output "ipv4_all_matches" { | ||
value = local.ipv4_matches | ||
description = "List of all the ipv4 matches (informational/testing)" | ||
} | ||
|
||
output "ipv6" { | ||
value = join("", local.ipv6_most_common_response) | ||
} | ||
output "ipv6_all_matches" { | ||
value = local.ipv6_matches | ||
description = "List of all the ipv6 matches (informational/testing)" | ||
} |
This file contains 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