terraform

package
v2.932.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package terraform implements functionality for the Terraform target and its implementation details, such as valid extension configuration values.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Collection of valid Terraform action operation types.
	ActionOperationTypes = []ActionOperationType{
		ActionOperationTypeInvoke,
	}
)
View Source
var (
	// Collection of valid Terraform data resource operation types.
	DataResourceOperationTypes = []DataResourceOperationType{
		DataResourceOperationTypeRead,
	}
)
View Source
var (
	// Collection of valid Terraform ephemeral resource operation types.
	EphemeralResourceOperationTypes = []EphemeralResourceOperationType{
		EphemeralResourceOperationTypeClose,
		EphemeralResourceOperationTypeOpen,
	}
)
View Source
var (
	// Collection of valid Terraform managed resource operation types.
	ManagedResourceOperationTypes = []ManagedResourceOperationType{
		ManagedResourceOperationTypeCreate,
		ManagedResourceOperationTypeRead,
		ManagedResourceOperationTypeUpdate,
		ManagedResourceOperationTypeDelete,
	}
)

Functions

func AttributeName

func AttributeName(name string) string

AttributeName converts a name to Terraform attribute format (snake_case, lowercase, no trailing underscore). This matches the TypeScript sanitizeTFStateName function behavior.

func IsResourceNameValid

func IsResourceNameValid(name string) bool

Returns true if the given name is valid for a resource name.

func IsResourceSchemaVersionValid

func IsResourceSchemaVersionValid(version int64) bool

Returns true if the given schema version is valid.

func JSONToHCLExpression

func JSONToHCLExpression(jsonStr string) string

JSONToHCLExpression converts a JSON string into an HCL jsonencode() expression. For example, the JSON string `{"key": "value"}` becomes:

jsonencode({
  key = "value"
})

If conversion fails for any reason, the original JSON string is returned as a quoted HCL string literal.

func ProviderTypeName

func ProviderTypeName(generationConfig map[string]any) string

ProviderTypeName returns the resolved provider type name used as the prefix for all resource, data source, ephemeral resource, and action type names. It returns the providerTypeNameOverride generation configuration value if set, otherwise falls back to packageName. The returned value is normalized to lowercase kebab-case so it is safe to embed in generated code and Terraform configuration. This matches the TypeScript getProviderTypeName function behavior.

func TypeName

func TypeName(providerTypeName, entityName string) string

TypeName returns the full Terraform type name for a resource, data source, ephemeral resource, or action by joining the provider type name and the snake_case form of the entity name with an underscore. This matches the TypeScript sanitizeResourceName function behavior.

Types

type ActionOperationType

type ActionOperationType string

Describes an individual Terraform action operation type.

const (
	// Represents an invoke operation for a Terraform action.
	ActionOperationTypeInvoke ActionOperationType = "invoke"
)

type DataResourceOperationType

type DataResourceOperationType string

Describes an individual Terraform data resource operation type.

const (
	// Represents a read operation for a Terraform data resource.
	DataResourceOperationTypeRead DataResourceOperationType = "read"
)

type EphemeralResourceOperationType

type EphemeralResourceOperationType string

Describes an individual Terraform ephemeral resource operation type.

const (
	// Represents a close operation for a Terraform ephemeral resource.
	EphemeralResourceOperationTypeClose EphemeralResourceOperationType = "close"

	// Represents an open operation for a Terraform ephemeral resource.
	EphemeralResourceOperationTypeOpen EphemeralResourceOperationType = "open"
)

type ManagedResourceOperationType

type ManagedResourceOperationType string

Describes an individual Terraform managed resource operation type.

const (
	// Represents a create operation for a Terraform managed resource.
	ManagedResourceOperationTypeCreate ManagedResourceOperationType = "create"

	// Represents a delete operation for a Terraform managed resource.
	ManagedResourceOperationTypeDelete ManagedResourceOperationType = "delete"

	// Represents a read operation for a Terraform managed resource.
	ManagedResourceOperationTypeRead ManagedResourceOperationType = "read"

	// Represents an update operation for a Terraform managed resource.
	ManagedResourceOperationTypeUpdate ManagedResourceOperationType = "update"
)

Jump to

Keyboard shortcuts

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