templates

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2023 License: MIT Imports: 9 Imported by: 0

README

templates

import "github.com/slalombuild/fusion/templates"

Package templates includes go text/templates for terraform resources

Index

Variables

var (
    ErrTemplateParse = "failed to parse text/template during template.Execute"
    ErrTemplateExec  = "failed to execute template during exec()"
)
var (
    ErrNoColor   = "failed to print output with NO_COLOR"
    ErrHighlight = "failed to highlight %s source"
    ErrFmt       = "failed to format %s source"
)

go:embed aws/*.tmpl gcp/*.tmpl azure/*.tmpl

var ALL_TEMPLATES embed.FS

func Execute

func Execute(templateString string, data interface{}) (*bytes.Buffer, error)

Execute renders the template string into a buffer and includes some useful helper functions

func FormatHCL

func FormatHCL(template string) string

FormatHCL formats an HCL string and trims whitespace

func Highlight

func Highlight(w io.Writer, text string, lang Language, skipColor bool) error

Highlight and format text

type Language

type Language int
const (
    GO  Language = iota
    HCL
    PLAINTEXT
)

type Renderer

Renderer is the required interface for terraform templates to be rendered

type Renderer interface {
    Render(w io.Writer, skipColor bool) error
}

Generated by gomarkdoc

Documentation

Overview

Package templates includes go text/templates for terraform resources

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTemplateParse = "failed to parse text/template during template.Execute"
	ErrTemplateExec  = "failed to execute template during exec()"
)
View Source
var (
	ErrNoColor   = "failed to print output with NO_COLOR"
	ErrHighlight = "failed to highlight %s source"
	ErrFmt       = "failed to format %s source"
)
View Source
var ALL_TEMPLATES embed.FS

Functions

func Execute

func Execute(templateString string, data interface{}) (*bytes.Buffer, error)

Execute renders the template string into a buffer and includes some useful helper functions

func FormatHCL

func FormatHCL(template string) string

FormatHCL formats an HCL string and trims whitespace

func Highlight

func Highlight(w io.Writer, text string, lang Language, skipColor bool) error

Highlight and format text

Types

type Language

type Language int
const (
	GO Language = iota
	HCL
	PLAINTEXT
)

type Renderer

type Renderer interface {
	Render(w io.Writer, skipColor bool) error
}

Renderer is the required interface for terraform templates to be rendered

Directories

Path Synopsis
aws
Package aws provides terraform templates for Amazon Web Services (AWS)
Package aws provides terraform templates for Amazon Web Services (AWS)
Package azure provides terraform templates for Microsoft Azure
Package azure provides terraform templates for Microsoft Azure
Package gcp provides terraform templates for Google Cloud Platform (GCP)
Package gcp provides terraform templates for Google Cloud Platform (GCP)

Jump to

Keyboard shortcuts

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