Documentation ¶
Index ¶
- Constants
- func ConfigVariablesFromModel(t *testing.T, model ResourceModel) tfconfig.Variables
- func FromModel(t *testing.T, model ResourceModel) string
- func NullVariable() nullVariable
- type ResourceModel
- type ResourceModelMeta
- func (m *ResourceModelMeta) DependsOn() []string
- func (m *ResourceModelMeta) Resource() resources.Resource
- func (m *ResourceModelMeta) ResourceName() string
- func (m *ResourceModelMeta) ResourceReference() string
- func (m *ResourceModelMeta) SetDependsOn(values []string)
- func (m *ResourceModelMeta) SetResourceName(name string)
Constants ¶
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 (*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)