https://github.com/petems/terraform-provider-extip
A Terraform provider for a data source to get an external IP
https://github.com/petems/terraform-provider-extip
data-source ip provider terraform
Last synced: 12 months ago
JSON representation
A Terraform provider for a data source to get an external IP
- Host: GitHub
- URL: https://github.com/petems/terraform-provider-extip
- Owner: petems
- License: mpl-2.0
- Created: 2018-06-21T11:35:36.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-06-02T07:13:11.000Z (about 4 years ago)
- Last Synced: 2025-04-23T03:16:32.926Z (about 1 year ago)
- Topics: data-source, ip, provider, terraform
- Language: Go
- Homepage:
- Size: 8.68 MB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# terraform-provider-extip
[](https://travis-ci.org/petems/terraform-provider-extip)[](https://coveralls.io/github/petems/terraform-provider-extip?branch=add_coveralls_action)
Terraform provider for getting your current external IP as a data source.
## Requirements
- [Terraform](https://www.terraform.io/downloads.html) 0.11.x
- [Go](https://golang.org/doc/install) 1.10 (to build the provider plugin)
## Installing the Provider
Follow the instructions to [install it as a plugin](https://www.terraform.io/docs/plugins/basics.html#installing-a-plugin). After placing it into your plugins directory, run `terraform init` to initialize it.
## Usage
```hcl
data "extip" "external_ip" {
}
output "external_ip" {
value = data.extip.external_ip.ipaddress
}
```
Gives the result:
```hcl
data.extip.external_ip: Refreshing state...
Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
Outputs:
external_ip = 238.209.109.16
```
You can also specify what resolver you want to use to get the URL:
```hcl
data "extip" "external_ip_from_aws" {
resolver = "https://checkip.amazonaws.com/"
}
output "external_ip_from_aws" {
value = data.extip.external_ip_from_aws.ipaddress
}
```
Examples are under [/examples](/examples).
## Building the Provider
Clone and build the repository
```sh
go get github.com/petems/terraform-provider-extip
make build
```
Symlink the binary to your terraform plugins directory:
```sh
ln -s $GOPATH/bin/terraform-provider-extip ~/.terraform.d/plugins/
```
## Updating the Provider
```sh
go get -u github.com/petems/terraform-provider-extip
make build
```
## TODO
* ~~Add configuration of the consensus timing (ie. how long it will wait to resolve)~~ #5
* ~~Add option of getting ipv6 or ipv4 ipaddress~~ Validate if returned address is a valid IP #10
## Contributing
* Write code
* Run tests: `make test`
* Build the binary: `make build`\
* Open a pull-request