setuptf

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStockout = errors.New("GCE has no capacity for this request in this zone")

ErrStockout means terraform apply failed because GCE had no capacity left for the requested resources in the requested zone. Another zone may work.

Functions

func ApplyPersistent

func ApplyPersistent(
	ctx context.Context,
	projectID string,
	autoApprove bool,
	logger *log.Logger,
) error

func ApplyPersistentCollector

func ApplyPersistentCollector(
	ctx context.Context,
	projectID string,
	autoApprove bool,
	logger *log.Logger,
) error

func CleanupTf added in v0.22.0

func CleanupTf(
	ctx context.Context,
	projectID string,
	testRunID string,
	logger *log.Logger,
) error

CleanupTf runs terraform destroy and deletes the workspace.

Types

type PubsubInfo

type PubsubInfo struct {
	RequestTopic  TopicInfo `json:"request_topic"`
	ResponseTopic TopicInfo `json:"response_topic"`
}

func SetupTf

func SetupTf(
	ctx context.Context,
	projectID string,
	testRunID string,
	tfDir string,
	tfVars map[string]string,
	logger *log.Logger,
) (*PubsubInfo, error)

Runs the sequence of terraform commands most environments need, returns the parsed PubsubInfo from `terraform output -json`.

1. Run terraform init 2. Create a new terraform workspace for the test run ID 3. Run terraform apply 4. Get output results from terraform output

If terraform apply fails because of a GCE stockout, the returned error wraps ErrStockout, so callers can retry in another zone.

Cleanup method runs terraform destroy and then deletes the workspace.

type SubscriptionMode

type SubscriptionMode string
const (
	Push SubscriptionMode = "push"
	Pull SubscriptionMode = "pull"
)

type TopicInfo

type TopicInfo struct {
	TopicName        string `json:"topic_name"`
	SubscriptionName string `json:"subscription_name"`
}

Jump to

Keyboard shortcuts

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