Documentation
¶
Overview ¶
Package terraform implements functionality for the Terraform target and its implementation details, such as valid extension configuration values.
Index ¶
- Variables
- func AttributeName(name string) string
- func IsResourceNameValid(name string) bool
- func IsResourceSchemaVersionValid(version int64) bool
- func JSONToHCLExpression(jsonStr string) string
- func ProviderTypeName(generationConfig map[string]any) string
- func TypeName(providerTypeName, entityName string) string
- type ActionOperationType
- type DataResourceOperationType
- type EphemeralResourceOperationType
- type ManagedResourceOperationType
Constants ¶
This section is empty.
Variables ¶
var ( // Collection of valid Terraform action operation types. ActionOperationTypes = []ActionOperationType{ ActionOperationTypeInvoke, } )
var ( // Collection of valid Terraform data resource operation types. DataResourceOperationTypes = []DataResourceOperationType{ DataResourceOperationTypeRead, } )
var ( // Collection of valid Terraform ephemeral resource operation types. EphemeralResourceOperationTypes = []EphemeralResourceOperationType{ EphemeralResourceOperationTypeClose, EphemeralResourceOperationTypeOpen, } )
var ( // Collection of valid Terraform managed resource operation types. ManagedResourceOperationTypes = []ManagedResourceOperationType{ ManagedResourceOperationTypeCreate, ManagedResourceOperationTypeRead, ManagedResourceOperationTypeUpdate, ManagedResourceOperationTypeDelete, } )
Functions ¶
func AttributeName ¶
AttributeName converts a name to Terraform attribute format (snake_case, lowercase, no trailing underscore). This matches the TypeScript sanitizeTFStateName function behavior.
func IsResourceNameValid ¶
Returns true if the given name is valid for a resource name.
func IsResourceSchemaVersionValid ¶
Returns true if the given schema version is valid.
func JSONToHCLExpression ¶
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 ¶
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.
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" )