testtemplate

package
v1.36.2 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2022 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DataSourceTemplateDir

func DataSourceTemplateDir(t *testing.T) string

DataSourceTemplateDir returns the path to the directory where the templates for individual data sources are kept.

Inside the data source template directory exists a template file with a name of the format <data_source_name>.tf.tmpl for each data source provided by the Hetzner Cloud Terraform provider.

The individual templates must define a valid HCL snippet for the data source. They must not reference other resources or data sources and they must not import other templates.

func ResourceTemplateDir

func ResourceTemplateDir(t *testing.T) string

ResourceTemplateDir returns the path to the directory where the templates for individual resources are kept.

Inside the resource template directory exists a template file with a name of the format <resource_name>.tf.tmpl for each resource provided by the Hetzner Cloud Terraform provider.

The individual templates must define a valid HCL snippet for the resource. They must not reference other resources or data sources and they must not import other templates.

Types

type Data

type Data interface {
	SetRInt(int)
	SetRName(string)
	RInt() int
	RName() string
}

Data marks a struct as containing data for test templates.

type DataCommon

type DataCommon struct {
	// contains filtered or unexported fields
}

DataCommon contains fields required by all template data types.

func (*DataCommon) RInt

func (tdc *DataCommon) RInt() int

RInt returns the random integer

func (*DataCommon) RName

func (tdc *DataCommon) RName() string

RInt returns the random name

func (*DataCommon) SetRInt

func (tdc *DataCommon) SetRInt(i int)

SetRInt sets a random integer.

func (*DataCommon) SetRName

func (tdc *DataCommon) SetRName(n string)

SetRName sets a resource name.

type Manager

type Manager struct {
	RandInt  int
	RandName string
	// contains filtered or unexported fields
}

Manager loads and renders Terraform HCL templates.

func (*Manager) Render

func (ts *Manager) Render(t *testing.T, args ...interface{}) string

Render renders the passed template to a string using the provided data.

Jump to

Keyboard shortcuts

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