Documentation
¶
Overview ¶
Package tfcode reads and writes the OpenTofu code of one stack for writ import: it reads the providers a stack requires and configures, and the names it declares, and it writes literals as HCL tokens. It is the one package besides internal/provider that holds cty values, which stay inside it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InNFC ¶
InNFC reports whether s is in Unicode normal form C. OpenTofu reads each string of its code into cty, which keeps strings in NFC, so a string in another form reaches the provider changed.
func Quoted ¶
Quoted is s as a quoted HCL string, never a heredoc, with every template sequence and every character that is not printable escaped. OpenTofu reads back s exactly when s is valid UTF-8 in normal form C. It differs from addr.Quote, which writes Writ's address syntax rather than HCL.
Types ¶
type Provider ¶
type Provider struct {
Ref ProviderRef
// contains filtered or unexported fields
}
Provider is one provider block.
type ProviderRef ¶
type ProviderRef struct{ Name, Alias string }
ProviderRef names one provider configuration: the provider's local name and its alias, "" for the configuration without one.
func (ProviderRef) String ¶
func (r ProviderRef) String() string
String is the reference as a resource's provider argument writes it.
type Stack ¶
type Stack struct {
// Required maps the local name of each provider in required_providers
// to its source.
Required map[string]schema.Source
// Providers holds each provider block by its reference.
Providers map[ProviderRef]*Provider
// Resources holds the names declared for each resource type:
// Resources["random_uuid"]["main"].
Resources map[string]map[string]bool
// Variables are the names of the variable blocks.
Variables map[string]bool
}
Stack is what an import needs to know of a stack's code: the providers it requires and configures, and the names it declares.