terraform-provider-sshcommand

command module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2019 License: MIT Imports: 2 Imported by: 0

README

SSH Command Terraform Provider Build Status

This provider allow to execute commands remotely via SSH and capture the output from them.

This provider uses built-in crypto/ssh Golang library to act as a SSH Client. Currently the implementation is very limited, but can be easily extended.

Table of contents

Requirements

Building

For testing builds, simply run docker build ., which will download all dependencies, run build, test and linter.

For local builds, simply follow the steps from Dockerfile.

Installing the provider

After building the provider, install it using the Terraform instructions for installing a third party provider.

Resources

sshcommand_command

This resource executes given command on remote system and stores it's output in Terraform.

Parameters
  • host - Hostname to connect.
  • private_key - SSH private key used for authentication (SSH Agent support is not implemented).
  • command - Command to execute.
  • user - User used for SSH log in. Default value is root.
  • port - Port to open SSH connection. Default is 22.
  • connection_timeout - Timeout for opening TCP connection. Default is 5m.
Attributes
  • result - Output of executed command.

Example usage

provider "sshcommand" {
  version = "~> 0.1.0"
}

output "example" {
  value = "\n${sshcommand_command.ssh_host_fingerprints.result}"
}

resource "sshcommand_command" "ssh_host_fingerprints" {
  host               = "example"
  command            = "ssh-keygen -r $(hostname -f) | cut -d' ' -f4-6"
  private_key        = "${file(".ssh/id_rsa")}"
}

Authors

  • Mateusz Gozdek - Initial work - invidian

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL