https://github.com/petems/terraform-provider-sshconfig
https://github.com/petems/terraform-provider-sshconfig
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/petems/terraform-provider-sshconfig
- Owner: petems
- License: mpl-2.0
- Created: 2020-03-08T18:32:52.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-03-11T21:35:17.000Z (over 5 years ago)
- Last Synced: 2023-03-11T01:23:46.274Z (over 2 years ago)
- Language: Go
- Homepage:
- Size: 4.68 MB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# terraform-provider-sshconfig
[](https://travis-ci.org/petems/terraform-provider-sshconfig)
Terraform provider for reading and configurating SSH Config files
## 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 "sshconfig_host" "github_ssh_config" {
path = pathexpand("~/.ssh/config")
host = "github.com"
}output "github_config" {
value = "${data.sshconfig_host.github_ssh_config.rendered}"
}output "host_map" {
value = "${data.sshconfig_host.github_ssh_config.host_map}"
}```
Gives the result:
```shell
$ terraform apply
data.sshconfig_host.github_ssh_config: Refreshing state...Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
Outputs:
github_config =
Host github.com
ControlMaster auto
ControlPath ~/.ssh/ssh-%r@%h:%p
ControlPersist yes
User git
IdentityFile ~/.ssh/github_ssh_key_10_Mar_2020host_map = {
"ControlMaster" = "auto"
"ControlPath" = "~/.ssh/ssh-%r@%h:%p"
"ControlPersist" = "yes"
"IdentityFile" = "~/.ssh/github_ssh_key_10_Mar_2020"
"User" = "git"
}
```Examples are under [/examples](/examples).
## Building the Provider
Clone and build the repository```sh
go get github.com/petems/terraform-provider-sshconfig
make build
```Symlink the binary to your terraform plugins directory:
```sh
mkdir -p ~/.terraform.d/plugins/
ln -s $GOPATH/bin/terraform-provider-sshconfig ~/.terraform.d/plugins/
```## Updating the Provider
```sh
go get -u github.com/petems/terraform-provider-sshconfig
make build
```## TODO
* Add configuration of the consensus timing (ie. how long it will wait to resolve)
* Add option of getting ipv6 or ipv4 ipaddress## Contributing
* Install project dependencies: `go get github.com/kardianos/govendor`
* Run tests: `make test`
* Build the binary: `make build`