Terraform Provider for "gluing" together the inputs and outputs from external sources and other providers.
It provides a flexible set of data sources for executing shell commands and filtering output by JMESPath or RE2 regular expressions, as well as resources for persisting variables in the State.
For general information about Terraform, visit the official website and GitHub project page.
Requirements
- Terraform 0.10.x (or higher)
- Go 1.9+ (to build the provider plugin)
Using the Provider
If you're building the provider, follow the instructions to install it as a plugin. After placing it into your plugins directory, run terraform init
to initialize it.
Example configuration
provider "glue" {
env_path = "/optionally/add/to;/env/path"
}
data "glue_command" "example" {
command = "aws"
parameters = ["--version"]
}
data "glue_filter_regexp" "example" {
input = "${data.glue_command.example.output}"
expression = "aws-cli/([0-9.]+)"
}
output "awscli_version" {
value = "${data.glue_filter_regexp.example.output[1]}"
}
resource "glue_var_map" "example" {
identifier = "my-map-id"
entries = {
foo = "bar"
hello = "world"
key1 = "value1"
key2 = "value2"
}
}
data "glue_filter_map" "example" {
depends_on = ["glue_var_map.example"]
input = "${glue_var_map.example.entries}"
key = {
prefix = ["key"]
}
}
output "filtered_keys" {
value = "${data.glue_filter_map.example.output}"
}
data "glue_filter_jmespath" "example" {
input = "${jsonencode(glue_var_map.example.entries)}"
expression = "hello"
}
output "filtered_json" {
value = "${data.glue_filter_jmespath.example.output}"
}
See also examples
folders for more details.
Developing the Provider
If you wish to work on the provider, you'll first need Go installed on your machine (version 1.9+ is required). You'll also need to correctly setup a GOPATH, as well as adding $GOPATH/bin
to your $PATH
.
Clone repository to: $GOPATH/src/github.com/MikeSouza/terraform-provider-glue
$ mkdir -p $GOPATH/src/github.com/MikeSouza; cd $GOPATH/src/github.com/MikeSouza
$ git clone git@github.com:MikeSouza/terraform-provider-glue
...
Enter the provider directory and build the provider:
$ cd $GOPATH/src/github.com/MikeSouza/terraform-provider-glue
$ make build
...
To compile the provider, run make build
. This will build the provider and put the provider binary in the $GOPATH/bin
directory.
$ make build
...
$ $GOPATH/bin/terraform-provider-glue
...
In order to test the provider, you can simply run make test
.
$ make test
...
In order to run the full suite of Acceptance tests, run make testacc
.
$ make testacc
...