config

package
v0.96.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultResourceName = "test"

DefaultResourceName is exported to allow assertions against the resources using the default name.

Variables

This section is empty.

Functions

func ConfigVariablesFromModel added in v0.96.0

func ConfigVariablesFromModel(t *testing.T, model ResourceModel) tfconfig.Variables

ConfigVariablesFromModel constructs config.Variables needed in acceptance tests that are using ConfigVariables in combination with ConfigDirectory. It's necessary for cases not supported by FromModel, like lists of objects.

func FromModel

func FromModel(t *testing.T, model ResourceModel) string

FromModel should be used in terraform acceptance tests for Config attribute to get string config from ResourceModel. Current implementation is really straightforward but it could be improved and tested. It may not handle all cases (like objects, lists, sets) correctly. TODO [SNOW-1501905]: use reflection to build config directly from model struct (or some other different way) TODO [SNOW-1501905]: add support for config.TestStepConfigFunc (to use as ConfigFile); the naive implementation would be to just create a tmp directory and save file there

func NullVariable added in v0.95.0

func NullVariable() nullVariable

NullVariable returns nullVariable which implements Variable.

Types

type ResourceModel

type ResourceModel interface {
	Resource() resources.Resource
	ResourceName() string
	SetResourceName(name string)
	ResourceReference() string
	DependsOn() []string
	SetDependsOn(values []string)
}

ResourceModel is the base interface all of our config models will implement. To allow easy implementation, ResourceModelMeta can be embedded inside the struct (and the struct will automatically implement it).

type ResourceModelMeta

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

func DefaultMeta

func DefaultMeta(resource resources.Resource) *ResourceModelMeta

func Meta

func Meta(resourceName string, resource resources.Resource) *ResourceModelMeta

func (*ResourceModelMeta) DependsOn added in v0.95.0

func (m *ResourceModelMeta) DependsOn() []string

func (*ResourceModelMeta) Resource

func (m *ResourceModelMeta) Resource() resources.Resource

func (*ResourceModelMeta) ResourceName

func (m *ResourceModelMeta) ResourceName() string

func (*ResourceModelMeta) ResourceReference added in v0.95.0

func (m *ResourceModelMeta) ResourceReference() string

func (*ResourceModelMeta) SetDependsOn added in v0.95.0

func (m *ResourceModelMeta) SetDependsOn(values []string)

func (*ResourceModelMeta) SetResourceName

func (m *ResourceModelMeta) SetResourceName(name string)

Directories

Path Synopsis
gen

Jump to

Keyboard shortcuts

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