Skip to content

tobiasehlert/terraform-http-echoip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

terraform-http-echoip

GitHub release GitHub license

Terraform module that returns your external information by any echoip API.

Features

  1. Get your external public IP address (and other related information).
  2. Use any echoip APIs (ipconfig.io, ifconfig.co, etc.).

Usage

Example mininal usage:

module "echoip" {
  source  = "tobiasehlert/echoip/http"
}

The modules output can then be used in some other module or resource.

Example of use with DigitalOcean firewall:

resource digitalocean_firewall "home_ssh" {
  name = "home_ssh"
  inbound_rule {
    protocol           = "tcp"
    port_range         = "22"
    source_addresses   = ["${module.echoip.ip}/32"]
  }
}

Examples

  • default – This is an example of how to use the module with the defaults.
  • ifconfig.co – This is an example of how to use the module with another echoip service.

Requirements

Name Version
terraform >= 1.2
http ~> 3.4.0

Providers

Name Version
http ~> 3.4.0

Modules

No modules.

Resources

Name Type
http_http.echoip data source

Inputs

Name Description Type Default Required
http_method HTTP method to use for the request string "GET" no
http_request_headers HTTP headers to send with the request map(any)
{
"Accept": "application/json"
}
no
http_url URL for echoip service to use. string "https://ipconfig.io" no

Outputs

Name Description
asn The asn field of the echoip response.
asn_org The asn_org field of the echoip response.
city The city field of the echoip response.
country The country field of the echoip response.
country_eu The country_eu field of the echoip response.
country_iso The country_iso field of the echoip response.
ip The ip field of the echoip response.
ip_decimal The ip_decimal field of the echoip response.
latitude The latitude field of the echoip response.
longitude The longitude field of the echoip response.
region_code The region_code field of the echoip response.
region_name The region_name field of the echoip response.
time_zone The time_zone field of the echoip response.
user_agent The user_agent field of the echoip response.
zip_code The zip_code field of the echoip response.

Credits