Documentation ¶
Index ¶
- Variables
- func BuiltinBackend(pm *terraform.PluginManager) starlark.Value
- func BuiltinEvaluate() starlark.Value
- func BuiltinFunctionComputed() starlark.Value
- func BuiltinHCL() starlark.Value
- func BuiltinProvider(pm *terraform.PluginManager) starlark.Value
- func BuiltinProvisioner(pm *terraform.PluginManager) starlark.Value
- type AttrDict
- type Backend
- type Computed
- type HCLCompatible
- type Kind
- type MapSchema
- func (m *MapSchema) Attr(name string) (starlark.Value, error)
- func (s *MapSchema) AttrNames() []string
- func (m *MapSchema) Freeze()
- func (m *MapSchema) Hash() (uint32, error)
- func (m *MapSchema) Name() string
- func (m *MapSchema) String() string
- func (t *MapSchema) ToHCL(b *hclwrite.Body)
- func (m *MapSchema) Truth() starlark.Bool
- func (m *MapSchema) Type() string
- type NamedValue
- type Provider
- func (p *Provider) Attr(name string) (starlark.Value, error)
- func (p *Provider) AttrNames() []string
- func (x *Provider) CompareSameType(op syntax.Token, y_ starlark.Value, depth int) (bool, error)
- func (p *Provider) String() string
- func (s *Provider) ToHCL(b *hclwrite.Body)
- func (p *Provider) Type() string
- type ProviderCollection
- func (c *ProviderCollection) CallInternal(thread *starlark.Thread, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)
- func (c *ProviderCollection) Freeze()
- func (c *ProviderCollection) Hash() (uint32, error)
- func (c *ProviderCollection) MakeProvider(name, version, alias string, kwargs []starlark.Tuple) (*Provider, error)
- func (c *ProviderCollection) Name() string
- func (c *ProviderCollection) String() string
- func (c *ProviderCollection) Truth() starlark.Bool
- func (c *ProviderCollection) Type() string
- type Provisioner
- type Resource
- func (r *Resource) Attr(name string) (starlark.Value, error)
- func (r *Resource) AttrNames() []string
- func (x *Resource) CompareSameType(op syntax.Token, y_ starlark.Value, depth int) (bool, error)
- func (r *Resource) Freeze()
- func (r *Resource) Hash() (uint32, error)
- func (r *Resource) LoadDict(d *starlark.Dict) error
- func (r *Resource) Name() string
- func (r *Resource) SetField(name string, v starlark.Value) error
- func (r *Resource) String() string
- func (r *Resource) ToHCL(b *hclwrite.Body)
- func (r *Resource) Truth() starlark.Bool
- func (r *Resource) Type() string
- type ResourceCollection
- func (c *ResourceCollection) Attr(name string) (starlark.Value, error)
- func (c *ResourceCollection) AttrNames() []string
- func (c *ResourceCollection) CallInternal(thread *starlark.Thread, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)
- func (c *ResourceCollection) Freeze()
- func (c *ResourceCollection) Hash() (uint32, error)
- func (c *ResourceCollection) LoadList(l *starlark.List) error
- func (c *ResourceCollection) MakeResource(name string, dict *starlark.Dict) (*Resource, error)
- func (c *ResourceCollection) Name() string
- func (c *ResourceCollection) String() string
- func (c *ResourceCollection) ToHCL(b *hclwrite.Body)
- func (c *ResourceCollection) Truth() starlark.Bool
- func (c *ResourceCollection) Type() string
- type State
- type Terraform
- func (t *Terraform) Attr(name string) (starlark.Value, error)
- func (t *Terraform) AttrNames() []string
- func (t *Terraform) Freeze()
- func (t *Terraform) Hash() (uint32, error)
- func (t *Terraform) SetField(name string, val starlark.Value) error
- func (t *Terraform) String() string
- func (s *Terraform) ToHCL(b *hclwrite.Body)
- func (t *Terraform) Truth() starlark.Bool
- func (t *Terraform) Type() string
- type Type
- type Value
- type Values
- func (a Values) Cty(schema *configschema.Block) cty.Value
- func (a Values) ForEach(cb func(*NamedValue) error) error
- func (a Values) Get(name string) *NamedValue
- func (a Values) Has(name string) bool
- func (a Values) Hash() (uint32, error)
- func (a Values) Len() int
- func (a Values) List() []*NamedValue
- func (a *Values) Set(name string, v *Value) *NamedValue
- func (a Values) ToStringDict(d starlark.StringDict)
Constants ¶
This section is empty.
Variables ¶
var NameGenerator = func() string { t := time.Now() entropy := ulid.Monotonic(rand.New(rand.NewSource(t.UnixNano())), 0) return fmt.Sprintf("id_%s", ulid.MustNew(ulid.Timestamp(t), entropy)) }
NameGenerator function used to generate Resource names, by default is based on a ULID generator.
Functions ¶
func BuiltinBackend ¶
func BuiltinBackend(pm *terraform.PluginManager) starlark.Value
BuiltinBackend returns a starlak.Builtin function capable of instantiate new Backend instances.
func BuiltinEvaluate ¶ added in v0.1.0
func BuiltinFunctionComputed ¶
func BuiltinHCL ¶
func BuiltinProvider ¶
func BuiltinProvider(pm *terraform.PluginManager) starlark.Value
func BuiltinProvisioner ¶
func BuiltinProvisioner(pm *terraform.PluginManager) starlark.Value
Types ¶
type AttrDict ¶ added in v0.1.0
AttrDict implements starlark.HasAttrs for starlark.Dictionaries
func NewAttrDict ¶ added in v0.1.0
func NewAttrDict() *AttrDict
NewAttrDict returns an empty AttrDict.
type Backend ¶
type Backend struct { *Resource // contains filtered or unexported fields }
Backend represent a Terraform Backend. https://www.terraform.io/docs/backends/index.html
func MakeBackend ¶
func MakeBackend(pm *terraform.PluginManager, typ string) (*Backend, error)
MakeBackend returns a new Backend instance based on given arguments,
type Computed ¶
type Computed struct {
// contains filtered or unexported fields
}
func NewComputedWithPath ¶
type HCLCompatible ¶
type Kind ¶
type Kind string
Kind describes what kind of resource is represented by a Resource isntance.
type MapSchema ¶
type MapSchema struct {
// contains filtered or unexported fields
}
func NewMapSchema ¶
type NamedValue ¶
NamedValue represents a Value with a given name.
type Provider ¶
type Provider struct { *Resource // contains filtered or unexported fields }
Provider represents a provider as a starlark.Value.
func MakeProvider ¶
func MakeProvider(pm *terraform.PluginManager, name, version, alias string) (*Provider, error)
MakeProvider returns a new Provider instance from a given name version and alias.
func (*Provider) CompareSameType ¶
CompareSameType honors starlark.Comprable interface.
type ProviderCollection ¶ added in v0.1.0
type ProviderCollection struct { *AttrDict // contains filtered or unexported fields }
func NewProviderCollection ¶ added in v0.1.0
func NewProviderCollection(pm *terraform.PluginManager) *ProviderCollection
func (*ProviderCollection) CallInternal ¶ added in v0.1.0
func (c *ProviderCollection) CallInternal(thread *starlark.Thread, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)
CallInternal honors the starlark.Callable interface.
func (*ProviderCollection) Freeze ¶ added in v0.1.0
func (c *ProviderCollection) Freeze()
Freeze honors the starlark.Value interface.
func (*ProviderCollection) Hash ¶ added in v0.1.0
func (c *ProviderCollection) Hash() (uint32, error)
Hash honors the starlark.Value interface.
func (*ProviderCollection) MakeProvider ¶ added in v0.1.0
func (*ProviderCollection) Name ¶ added in v0.1.0
func (c *ProviderCollection) Name() string
Name honors the starlark.Callable interface.
func (*ProviderCollection) String ¶ added in v0.1.0
func (c *ProviderCollection) String() string
String honors the starlark.Value interface.
func (*ProviderCollection) Truth ¶ added in v0.1.0
func (c *ProviderCollection) Truth() starlark.Bool
Truth honors the starlark.Value interface.
func (*ProviderCollection) Type ¶ added in v0.1.0
func (c *ProviderCollection) Type() string
Type honors the starlark.Value interface.
type Provisioner ¶
type Provisioner struct { *Resource // contains filtered or unexported fields }
func MakeProvisioner ¶
func MakeProvisioner(pm *terraform.PluginManager, name string) (*Provisioner, error)
func (*Provisioner) ToHCL ¶
func (s *Provisioner) ToHCL(b *hclwrite.Body)
func (*Provisioner) Type ¶
func (p *Provisioner) Type() string
Type honors the starlark.Value interface. It shadows p.Resource.Type.
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
Resource represents a resource as a starlark.Value, it can be of four kinds, provider, resource, data source or a nested resource.
func MakeResource ¶
func MakeResource(name, typ string, k Kind, b *configschema.Block, provider *Provider, parent *Resource) *Resource
MakeResource returns a new resource of the given kind, type based on the given configschema.Block.
func (*Resource) CompareSameType ¶
CompareSameType honors starlark.Comprable interface.
type ResourceCollection ¶
func NewResourceCollection ¶
func NewResourceCollection( typ string, k Kind, block *configschema.Block, provider *Provider, parent *Resource, ) *ResourceCollection
func (*ResourceCollection) Attr ¶ added in v0.1.0
func (c *ResourceCollection) Attr(name string) (starlark.Value, error)
Attr honors the starlark.HasAttrs interface.
func (*ResourceCollection) AttrNames ¶ added in v0.1.0
func (c *ResourceCollection) AttrNames() []string
AttrNames honors the starlark.HasAttrs interface.
func (*ResourceCollection) CallInternal ¶
func (c *ResourceCollection) CallInternal(thread *starlark.Thread, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)
CallInternal honors the starlark.Callable interface.
func (*ResourceCollection) Freeze ¶
func (c *ResourceCollection) Freeze()
Freeze honors the starlark.Value interface.
func (*ResourceCollection) Hash ¶
func (c *ResourceCollection) Hash() (uint32, error)
Hash honors the starlark.Value interface.
func (*ResourceCollection) LoadList ¶
func (c *ResourceCollection) LoadList(l *starlark.List) error
LoadList loads a list of dicts on the collection. It clears the collection.
func (*ResourceCollection) MakeResource ¶
MakeResource it makes a new resource and loads the dict on it.
func (*ResourceCollection) Name ¶
func (c *ResourceCollection) Name() string
Name honors the starlark.Callable interface.
func (*ResourceCollection) String ¶
func (c *ResourceCollection) String() string
String honors the starlark.Value interface.
func (*ResourceCollection) ToHCL ¶
func (c *ResourceCollection) ToHCL(b *hclwrite.Body)
func (*ResourceCollection) Truth ¶
func (c *ResourceCollection) Truth() starlark.Bool
Truth honors the starlark.Value interface.
func (*ResourceCollection) Type ¶
func (c *ResourceCollection) Type() string
Type honors the starlark.Value interface.
type State ¶ added in v0.1.0
type State struct { *AttrDict // contains filtered or unexported fields }
State represents a Terraform state read by a backed. https://www.terraform.io/docs/state/index.html
type Terraform ¶ added in v0.1.0
type Terraform struct {
// contains filtered or unexported fields
}
func MakeTerraform ¶ added in v0.1.0
func MakeTerraform(pm *terraform.PluginManager) *Terraform
func (*Terraform) Freeze ¶ added in v0.1.0
func (t *Terraform) Freeze()
Freeze honors the starlark.Value interface.
type Type ¶
type Type struct {
// contains filtered or unexported fields
}
Type is a helper to manipulate and transform starlark.Type and cty.Type
func MustTypeFromCty ¶
MustTypeFromCty returns a Type froma given cty.Type. Panics if error.
func MustTypeFromStarlark ¶
MustTypeFromStarlark returns a Type from a given starlark type string. Panics if error.
func NewTypeFromCty ¶
NewTypeFromCty returns a Type froma given cty.Type.
func NewTypeFromStarlark ¶
NewTypeFromStarlark returns a Type from a given starlark type string.
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Value is helper to manipulate and transform starlark.Value to go types and cty.Value.
func (*Value) Interface ¶
func (v *Value) Interface() interface{}
Interface returns the value as a Go value.
type Values ¶
type Values struct {
// contains filtered or unexported fields
}
Values is a list of NamedValues.
func (Values) Cty ¶ added in v0.1.0
func (a Values) Cty(schema *configschema.Block) cty.Value
Cty returns the cty.Value based on a given schema.
func (Values) ForEach ¶
func (a Values) ForEach(cb func(*NamedValue) error) error
ForEach call cb for each value on Values, it stop the iteration an error is returned.
func (Values) Get ¶
func (a Values) Get(name string) *NamedValue
Get returns the NamedValue with the given name, if any.
func (Values) List ¶
func (a Values) List() []*NamedValue
List return a list of NamedValues sorted by name.
func (*Values) Set ¶
func (a *Values) Set(name string, v *Value) *NamedValue
Set sets a name and a value and returns it as a NamedValue.
func (Values) ToStringDict ¶
func (a Values) ToStringDict(d starlark.StringDict)
ToStringDict adds a name/value entry to d for each field of the struct.