Documentation
¶
Overview ¶
Package terraform provides a test harness for tf2pulumi. It is a thin wrapper on top of the Pulumi CLI's integration test framework while supplying a "compile step" for Terraform code that we'll then convert to Pulumi code.
Index ¶
- func RunTest(t *testing.T, dir string, opts ...TestOptionsFunc)
- type ConvertOptions
- type Test
- type TestOptionsFunc
- func AllowChanges() TestOptionsFunc
- func Compile(value bool) TestOptionsFunc
- func FilterName(value string) TestOptionsFunc
- func NoParallel() TestOptionsFunc
- func Python(opts ...TestOptionsFunc) TestOptionsFunc
- func Skip(reason string) TestOptionsFunc
- func SkipPython() TestOptionsFunc
- func SkipTypeScript(reason string) TestOptionsFunc
- func TypeScript(opts ...TestOptionsFunc) TestOptionsFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConvertOptions ¶ added in v0.4.9
type ConvertOptions struct { Compile *bool // If true, run pulumi on the generated code. Defaults to true. FilterName string // If non-empty, filter out properties with the given name. Skip string // If non-empty, skip the current test with the given message. }
ConvertOptions are options controlling the behavior of tf2pulumi. Its arguments are generally converted to command-line flags.
func (ConvertOptions) With ¶ added in v0.4.9
func (c ConvertOptions) With(other ConvertOptions) ConvertOptions
With constructs a new ConvertOptions out of a base set of options and a set of options that will override fields that are not set in the base.
type Test ¶ added in v0.4.9
type Test struct { ProjectName string Options ConvertOptions // Base options for tf2pulumi, inherited by all targets. RunOptions *integration.ProgramTestOptions // Options for running the generated Pulumi code Python *ConvertOptions // Python-specific options overriding the base options TypeScript *ConvertOptions // TypeScript-specific options overriding the base options }
Test represents a single test case. It consists of Terraform input and optionally a "baseline" file that will be diffed against the output of tf2pulumi. Each test case is run on every target unless the target specifically opts out.
type TestOptionsFunc ¶ added in v0.4.9
TestOptionsFunc is a function that can be used as an option to `RunTest`.
func AllowChanges ¶ added in v0.7.0
func AllowChanges() TestOptionsFunc
AllowChanges allows changes on the empty preview and update for the given test.
func Compile ¶ added in v0.4.9
func Compile(value bool) TestOptionsFunc
Compile sets whether or not this test case should be executed by Pulumi after being processed by tf2pulumi. Defaults to true if not provided.
func FilterName ¶ added in v0.4.9
func FilterName(value string) TestOptionsFunc
FilterName sets whether or not tf2pulumi should filter properties with the given name for this test case. Defaults to the empty string, which will cause no properties to be filtered.
func NoParallel ¶ added in v0.12.0
func NoParallel() TestOptionsFunc
Sets the NoParallel flag on the test to run
func Python ¶ added in v0.4.9
func Python(opts ...TestOptionsFunc) TestOptionsFunc
Python sets up a new context that also accepts any number of test options, but applies those test options only when running with the Python target. Options that affect the Pulumi CLI integration test framework are ignored.
func Skip ¶ added in v0.4.9
func Skip(reason string) TestOptionsFunc
Skip skips the test for the given reason.
func SkipPython ¶ added in v0.4.9
func SkipPython() TestOptionsFunc
SkipPython skips the Python target for the given test.
func SkipTypeScript ¶ added in v0.12.0
func SkipTypeScript(reason string) TestOptionsFunc
SkipTypeScript skips the TypeScript target for the given test.
func TypeScript ¶ added in v0.12.0
func TypeScript(opts ...TestOptionsFunc) TestOptionsFunc
TypeScript sets up a new context that also accepts any number of test options, but applies those test options only when running with the TypeScript target. Options that affect the Pulumi CLI integration test framework are ignored.