mach-composer-plugin-sdk

module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: MIT

README

mach-composer-plugin-sdk

SDK to create plugins for Mach Composer

Writing plugins

Mach Composer utiltizes the go-plugin package for implementing plugins. This means that mach-composer runs each plugin in a separate process whereby communication between mach-composer and the plugin happens via net/rpc.

Mach Composer automatically finds plugins defined in the config file by looking for an executable named mach-composer-plugin-<name>.

A plugin exists out of three major parts:

  1. Setup functionality
  2. Processing settings (global, site or component)
  3. Rendering of terraform snippets

Example

Below is a very minimal implementation of a plugin.


import (
	"github.com/mach-composer/mach-composer-plugin-sdk/plugin"
	"github.com/mach-composer/mach-composer-plugin-sdk/schema"
)


func MyPlugin() schema.MachComposerPlugin {
	return plugin.NewPlugin(&schema.PluginSchema{
		Identifier: "<name of plugin>",
	})
}

func main() {
	p := MyPlugin()
	plugin.ServePlugin(p)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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