Documentation ¶
Index ¶
- Constants
- Variables
- func BuiltinBackend() starlark.Value
- func BuiltinEvaluate(predeclared starlark.StringDict) starlark.Value
- func BuiltinFunctionAttribute() starlark.Value
- func BuiltinHCL() starlark.Value
- func BuiltinProvisioner() starlark.Value
- func BuiltinRef() starlark.Value
- func BuiltinValidate() starlark.Value
- func MakeBackend(t *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, ...) (starlark.Value, error)
- func MakeProvider(t *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, ...) (starlark.Value, error)
- func MakeProvisioner(t *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, ...) (starlark.Value, error)
- func MakeResource(c *ResourceCollection, t *starlark.Thread, _ *starlark.Builtin, ...) (starlark.Value, error)
- type Attribute
- func (c *Attribute) Attr(name string) (starlark.Value, error)
- func (c *Attribute) AttrNames() []string
- func (c *Attribute) Get(key starlark.Value) (v starlark.Value, found bool, err error)
- func (c *Attribute) Index(i int) starlark.Value
- func (c *Attribute) InnerType() *Type
- func (c *Attribute) Len() int
- func (c *Attribute) String() string
- func (c *Attribute) Type() string
- type Backend
- type Dict
- type HCLCompatible
- type Kind
- type NamedValue
- type Provider
- func (p *Provider) Attr(name string) (starlark.Value, error)
- func (p *Provider) AttrNames() []string
- func (p *Provider) CompareSameType(op syntax.Token, yv starlark.Value, depth int) (bool, error)
- func (p *Provider) String() string
- func (s *Provider) ToHCL(b *hclwrite.Body)
- func (p *Provider) Type() string
- func (p *Provider) Validate() (errs ValidationErrors)
- type ProviderCollection
- func (c *ProviderCollection) CallInternal(t *starlark.Thread, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)
- func (c *ProviderCollection) Freeze()
- func (c *ProviderCollection) Hash() (uint32, error)
- func (c *ProviderCollection) Name() 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 (r *Resource) CallStack() starlark.CallStack
- func (r *Resource) CompareSameType(op syntax.Token, yv starlark.Value, depth int) (bool, error)
- func (r *Resource) Freeze()
- func (r *Resource) Hash() (uint32, error)
- func (r *Resource) Name() string
- func (r *Resource) Path() 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
- func (r *Resource) Validate() ValidationErrors
- type ResourceCollection
- func (c *ResourceCollection) Attr(name string) (starlark.Value, error)
- func (c *ResourceCollection) AttrNames() []string
- func (c *ResourceCollection) CallInternal(t *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) Name() string
- func (c *ResourceCollection) Path() string
- func (c *ResourceCollection) String() string
- func (c *ResourceCollection) ToHCL(b *hclwrite.Body)
- func (c *ResourceCollection) Truth() starlark.Bool
- func (c *ResourceCollection) Type() string
- func (c *ResourceCollection) Validate() (errs ValidationErrors)
- type ResourceCollectionGroup
- func (g *ResourceCollectionGroup) Attr(name string) (starlark.Value, error)
- func (g *ResourceCollectionGroup) AttrNames() []string
- func (*ResourceCollectionGroup) Freeze()
- func (g *ResourceCollectionGroup) Hash() (uint32, error)
- func (g *ResourceCollectionGroup) Path() string
- func (g *ResourceCollectionGroup) String() string
- func (t *ResourceCollectionGroup) ToHCL(b *hclwrite.Body)
- func (*ResourceCollectionGroup) Truth() starlark.Bool
- func (g *ResourceCollectionGroup) Type() string
- func (g *ResourceCollectionGroup) Validate() (errs ValidationErrors)
- 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
- func (t *Terraform) Validate() (errs ValidationErrors)
- type Type
- type Validabler
- type ValidationError
- type ValidationErrors
- 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 ¶
const (
// PluginManagerLocal is the key of the terraform.PluginManager in the thread.
PluginManagerLocal = "plugin_manager"
)
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 ¶
BuiltinBackend returns a starlak.Builtin function capable of instantiate new Backend instances.
outline: types functions: backend(type) Backend Instantiates a new [`Backend`](#backend) params: type string [Backend type](https://www.terraform.io/docs/backends/types/index.html).
func BuiltinEvaluate ¶ added in v0.1.0
func BuiltinEvaluate(predeclared starlark.StringDict) starlark.Value
BuiltinEvaluate returns a starlak.Builtin function to evalute Starlark files.
outline: types functions: evaluate(filename, predeclared=None) dict Evaluates a Starlark file and returns its global context. Kwargs may be used to set predeclared. examples: evaluable.star evaluate.star params: filename string Name of the file to execute. predeclared dict Defines the predeclared context for the execution. Execution does not modify this dictionary
func BuiltinFunctionAttribute ¶ added in v1.0.0
BuiltinFunctionAttribute returns a built-in function that wraps Attributes in HCL functions.
outline: types functions: fn(name, target) Attribute Fn wraps an Attribute in a HCL function. Since the Attributes value are only available in the `apply` phase of Terraform, the only method to manipulate this values is using the Terraform [HCL functions](https://www.terraform.io/docs/configuration/functions.html). params: name string Name of the HCL function to be applied. Eg.: `base64encode` target Attribute Target Attribute of the HCL function.
func BuiltinHCL ¶
BuiltinHCL returns a starlak.Builtin function to generate HCL from objects implementing the HCLCompatible interface.
outline: types functions: hcl(resource) string Returns the HCL encoding of the given resource. params: resource <resource> resource to be encoded.
func BuiltinProvisioner ¶
BuiltinProvisioner returns a starlak.Builtin function capable of instantiate new Provisioner instances.
outline: types functions: provisioner(type) Provisioner Instantiates a new Provisioner params: type string Provisioner type.
func BuiltinRef ¶ added in v1.3.0
BuiltinRef returns a starlak.Builtin function to generate a reference to a resource argument.
outline: types functions: ref(resource, argument) string Returns a reference to a resource argument. params: resource <resource> resource to be referenced. field string field to be referenced. examples: ref.star
func BuiltinValidate ¶ added in v1.1.0
BuiltinValidate returns a starlak.Builtin function to validate objects implementing the Validabler interface.
outline: types functions: validate(resource) list Returns a list with validating errors if any. A validating error is a struct with two fields: `msg` and `pos` params: resource <resource> resource to be validated.
func MakeBackend ¶
func MakeBackend( t *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple, ) (starlark.Value, error)
MakeBackend defines the Backend constructor.
func MakeProvider ¶
func MakeProvider( t *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple, ) (starlark.Value, error)
MakeProvider defines the Provider constructor.
Types ¶
type Attribute ¶ added in v1.0.0
type Attribute struct {
// contains filtered or unexported fields
}
Attribute is a reference to an argument of a Resource. Used mainly for Computed arguments of Resources.
outline: types types: Attribute Attribute is a reference to an argument of a Resource. Used mainly for Computed arguments of Resources. Attribute behaves as the type of the argument represented, this means that them can be assigned to other resource arguments of the same type. And, if the type is a list are indexable. examples: attribute.star fields: __resource__ Resource Resource of the attribute. __type__ string Type of the attribute. Eg.: `string`
func NewAttribute ¶ added in v1.0.0
NewAttribute returns a new Attribute for a given value or block of a Resource. The path is calculated traversing the parents of the given Resource.
func NewAttributeWithPath ¶ added in v1.0.0
NewAttributeWithPath returns a new Attribute for a given value or block of a Resource.
func (*Attribute) InnerType ¶ added in v1.0.0
InnerType returns the inner Type represented by this Attribute.
type Backend ¶
type Backend struct { *Resource // contains filtered or unexported fields }
Backend represent a Terraform Backend.
outline: types types: Backend The part of Terraform's core that determines how Terraform stores state and performs operations (like plan, apply, import, etc.). Terraform has multiple [backends](https://www.terraform.io/docs/backends/index.html) to choose from, which can be configured in a variety of ways. fields: __kind__ string Kind of the backend. Fixed value `backend`. __type__ string Type of the backend. Eg.: `local`. __dict__ Dict A dictionary containing all the config values of the backend. <argument> <scalar> Arguments defined by the backend schema, thus can be of any scalar type. methods: state(module="", workspace="default") State Loads the latest state for a given module or workspace. params: module string name of the module, empty equals to root. workspace string backend workspace
func NewBackend ¶ added in v1.0.0
NewBackend returns a new Backend instance based on given arguments,
type Dict ¶ added in v1.0.0
Dict is a starlark.Dict HCLCompatible.
func (*Dict) Validate ¶ added in v1.1.0
func (d *Dict) Validate() (errs ValidationErrors)
Validate honors the Validabler interface.
type HCLCompatible ¶
HCLCompatible defines if the struct is suitable of by encoded in HCL.
type Kind ¶
type Kind string
Kind describes what kind of resource is represented by a Resource instance.
const ( ProviderKind Kind = "provider" ProvisionerKind Kind = "provisioner" ResourceKind Kind = "resource" DataSourceKind Kind = "data" NestedKind Kind = "nested" BackendKind Kind = "backend" )
Resource Kind constants.
func (Kind) IsNamed ¶ added in v1.0.0
IsNamed returns true if this kind of resources contains a name.
func (Kind) IsProviderRelated ¶ added in v1.0.0
IsProviderRelated returns true if this kind of resources contains a provider.
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.
outline: types types: Provider A plugin for Terraform that makes a collection of related resources available. A provider plugin is responsible for understanding API interactions with some kind of service and exposing resources based on that API. examples: provider.star provider_resource.star Resource instantiation from a Provider. fields: __version__ string Provider version __kind__ string Kind of the provider. Fixed value `provider` __type__ string Type of the resource. Eg.: `aws_instance` __name__ string Local name of the provider, if none was provided to the constructor, the name is auto-generated following the pattern `id_%s`. At Terraform is called [`alias`](https://www.terraform.io/docs/configuration/providers.html#alias-multiple-provider-instances) __dict__ Dict A dictionary containing all set arguments and blocks of the provider. data MapSchema Data sources defined by the provider. resource MapSchema Resources defined by the provider. <argument> <scalar> Arguments defined by the provider schema, thus can be of any scalar type. <block> Resource Blocks defined by the provider schema, thus are nested resources, containing other arguments and/or blocks. methods: set_prefix(enable, prefix="") If enabled, all the resource names belonging to this provider are prefixed, with the given prefix or by default the alias name. params: enable bool if True enables the the prefix of resources. prefix string string to be used as prefix of the resources, if None, the provider name it's used as prefix.
func NewProvider ¶ added in v1.0.0
func NewProvider(pm *terraform.PluginManager, typ, version, name string, cs starlark.CallStack) (*Provider, error)
NewProvider returns a new Provider instance from a given type, version and name.
func (*Provider) CompareSameType ¶
CompareSameType honors starlark.Comparable interface.
func (*Provider) Validate ¶ added in v1.1.0
func (p *Provider) Validate() (errs ValidationErrors)
Validate honors the Validabler interface.
type ProviderCollection ¶ added in v0.1.0
type ProviderCollection struct { *Dict // contains filtered or unexported fields }
ProviderCollection represents a nested Dict of providers, indexed by provider type and provider name.
outline: types types: ProviderCollection ProviderCollection holds the providers in a nested dictionary, indexed by provider type and provider name. The values can be accessed by indexing or using the built-in method of `dict`. examples: provider_collection.star methods: __call__(type, version="", name="") Provider Returns a new provider instance of the given type. examples: tf_provider.star Defining multiple providers and traversing `tf.providers` params: type string Provider type. Eg.: `aws` version string Version [value](https://www.terraform.io/docs/configuration/providers.html#provider-versions) , if `None` latest version available it's used. name string Local name of the resource, if `None` is provided it's autogenerated.
func NewProviderCollection ¶ added in v0.1.0
func NewProviderCollection(pm *terraform.PluginManager) *ProviderCollection
NewProviderCollection returns a new ProviderCollection.
func (*ProviderCollection) CallInternal ¶ added in v0.1.0
func (c *ProviderCollection) CallInternal( t *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) Name ¶ added in v0.1.0
func (c *ProviderCollection) Name() string
Name honors the starlark.Callable 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 }
Provisioner represents a Terraform provider of a specif type.
outline: types types: Provisioner Provisioner represents a Terraform provider of a specif type. As written in the terraform documentation: "*Provisioners are a Last Resort*" fields: __kind__ string Kind of the provisioner. Fixed value `provisioner` __type__ string Type of the resource. Eg.: `aws_instance <argument> <scalar> Arguments defined by the provisioner schema, thus can be of any scalar type. <block> Resource Blocks defined by the provisioner schema, thus are nested resources, containing other arguments and/or blocks.
func NewProvisioner ¶ added in v1.0.0
func NewProvisioner(pm *terraform.PluginManager, typ string, cs starlark.CallStack) (*Provisioner, error)
NewProvisioner returns a new Provisioner for the given type.
func (*Provisioner) String ¶ added in v1.0.0
func (p *Provisioner) String() string
func (*Provisioner) ToHCL ¶
func (s *Provisioner) ToHCL(b *hclwrite.Body)
ToHCL honors the HCLCompatible interface.
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.
outline: types types: Resource [Resources](https://www.terraform.io/docs/configuration/resources.html) are the most important element in the Terraform language. Each resource block describes one or more infrastructure objects, such as virtual networks, compute instances, or higher-level components such as DNS records. Each resource is associated with a single resource type, which determines the kind of infrastructure object it manages and what arguments and other attributes the resource supports. Each resource type in turn belongs to a provider, which is a plugin for Terraform that offers a collection of resource types. A provider usually provides resources to manage a single cloud or on-premises infrastructure platform. Following the schema of HCL Terraform resources each type of arguments and blocks are transformed in native AsCode elements: * [Blocks](https://www.terraform.io/docs/glossary.html#block) defined as a list of Resources are transformed into: `ResourceCollection<nested>`, if the `Block` is a list capped to one item, its represented as `Resource<nested>`. * [Arguments](https://www.terraform.io/docs/glossary.html#argument) are transformed as basic scalar types. * [Attributes](https://www.terraform.io/docs/glossary.html#attribute) aka computed arguments are transformed in `Attributes` examples: resource.star fields: __provider__ Provider Provider of this resource if any. __kind__ string Kind of the resource. Eg.: `data` __type__ string Type of the resource. Eg.: `aws_instance` __name__ string Local name of the resource, if none was provided to the constructor the name is auto-generated following the partern `id_%s`. Nested kind resources are unamed. __dict__ Dict A dictionary containing all set arguments and blocks of the resource. <argument> <scalar>/Computed Arguments defined by the resource schema, thus can be of any scalar type or Computed values. <block> Resource/ResourceCollection Blocks defined by the resource schema, thus are nested resources, containing other arguments and/or blocks. methods: depends_on(resource) Explicitly declares a dependency on another resource. Use the [depends_on](https://www.terraform.io/docs/configuration/resources.html#depends_on-explicit-resource-dependencies) meta-argument to handle hidden resource dependencies that Terraform can't automatically infer. (Only in resources of kind "resource") params: resource Resource depended data or resource kind. add_provisioner(provisioner) Create-time actions like these can be described using resource provisioners. A provisioner is another type of plugin supported by Terraform, and each provisioner takes a different kind of action in the context of a resource being created. Provisioning steps should be used sparingly, since they represent non-declarative actions taken during the creation of a resource and so Terraform is not able to model changes to them as it can for the declarative portions of the Terraform language. (Only in resources of kind "resource") params: provisioner Provisioner provisioner resource to be executed.
func NewResource ¶ added in v1.0.0
func NewResource( name, typ string, k Kind, b *configschema.Block, provider *Provider, parent *Resource, cs starlark.CallStack, ) *Resource
NewResource returns a new resource of the given kind, type based on the given configschema.Block.
func (*Resource) CompareSameType ¶
CompareSameType honors starlark.Comparable interface.
func (*Resource) Validate ¶ added in v1.1.0
func (r *Resource) Validate() ValidationErrors
Validate honors the Validabler interface.
type ResourceCollection ¶
ResourceCollection stores and instantiates resources for specific provider and resource.
outline: types types: ResourceCollection ResourceCollection stores and instantiates resources for a specific pair of provider and resource. The resources can be accessed by indexing or using the built-in method of `dict`. fields: __provider__ Provider Provider of this resource collection. __kind__ string Kind of the resource collection. Eg.: `data` __type__ string Type of the resource collection. Eg.: `aws_instance` methods: __call__(name="", values={}) Resource Returns a new resourced with the given name and values. examples: resource_collection_call.star Resource instantiation using values, dicts or kwargs. params: name string Local name of the resource, if `None` is provided it's autogenerated. values dict List of arguments and nested blocks to be set in the new resource, these values can also be defined using `kwargs`. search(key="id", value) list Return all the Resources with the given value in the given key. examples: resource_collection_search.star params: name string Key to search. The default value is `id`. value <any> Value to match in the given key.
func NewNestedResourceCollection ¶ added in v1.1.0
func NewNestedResourceCollection( typ string, block *configschema.NestedBlock, provider *Provider, parent *Resource, ) *ResourceCollection
NewNestedResourceCollection returns
func NewResourceCollection ¶
func NewResourceCollection( typ string, k Kind, block *configschema.Block, provider *Provider, parent *Resource, ) *ResourceCollection
NewResourceCollection returns a new ResourceCollection for the given values.
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( t *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) Name ¶
func (c *ResourceCollection) Name() string
Name honors the starlark.Callable interface.
func (*ResourceCollection) Path ¶ added in v1.0.0
func (c *ResourceCollection) Path() string
Path returns the path of the ResourceCollection.
func (*ResourceCollection) String ¶
func (c *ResourceCollection) String() string
String honors the starlark.Value interface.
func (*ResourceCollection) ToHCL ¶
func (c *ResourceCollection) ToHCL(b *hclwrite.Body)
ToHCL honors the HCLCompatible interface.
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.
func (*ResourceCollection) Validate ¶ added in v1.1.0
func (c *ResourceCollection) Validate() (errs ValidationErrors)
Validate honors the Validabler interface.
type ResourceCollectionGroup ¶ added in v1.0.0
type ResourceCollectionGroup struct {
// contains filtered or unexported fields
}
ResourceCollectionGroup represents a group by kind (resource or data resource) of ResourceCollections for a given provider.
outline: types types: ResourceCollectionGroup ResourceCollectionGroup represents a group by kind (resource or data resource) of ResourceCollections for a given provider. fields: __provider__ Provider Provider of this group. __kind__ string Kind of the resources (`data` or `resource`). <resource-name> ResourceCollection Returns a ResourceCollection if the resource name is valid for the schema of the provider. The resource name should be provided without the provider prefix, `aws_instance` becomes just an `instance`.
func NewResourceCollectionGroup ¶ added in v1.0.0
func NewResourceCollectionGroup(p *Provider, k Kind, schema map[string]providers.Schema) *ResourceCollectionGroup
NewResourceCollectionGroup returns a new ResourceCollectionGroup for a given provider and kind based on the given schema.
func (*ResourceCollectionGroup) Attr ¶ added in v1.0.0
func (g *ResourceCollectionGroup) Attr(name string) (starlark.Value, error)
Attr honors the starlark.HasAttrs interface.
func (*ResourceCollectionGroup) AttrNames ¶ added in v1.0.0
func (g *ResourceCollectionGroup) AttrNames() []string
AttrNames honors the starlark.HasAttrs interface.
func (*ResourceCollectionGroup) Freeze ¶ added in v1.0.0
func (*ResourceCollectionGroup) Freeze()
Freeze honors the starlark.Value interface.
func (*ResourceCollectionGroup) Hash ¶ added in v1.0.0
func (g *ResourceCollectionGroup) Hash() (uint32, error)
Hash honors the starlark.Value interface.
func (*ResourceCollectionGroup) Path ¶ added in v1.0.0
func (g *ResourceCollectionGroup) Path() string
Path returns the path of the ResourceCollectionGroup.
func (*ResourceCollectionGroup) String ¶ added in v1.0.0
func (g *ResourceCollectionGroup) String() string
String honors the starlark.String interface.
func (*ResourceCollectionGroup) ToHCL ¶ added in v1.0.0
func (t *ResourceCollectionGroup) ToHCL(b *hclwrite.Body)
ToHCL honors the HCLCompatible interface.
func (*ResourceCollectionGroup) Truth ¶ added in v1.0.0
func (*ResourceCollectionGroup) Truth() starlark.Bool
Truth honors the starlark.Value interface. True even if empty.
func (*ResourceCollectionGroup) Type ¶ added in v1.0.0
func (g *ResourceCollectionGroup) Type() string
Type honors the starlark.Value interface.
func (*ResourceCollectionGroup) Validate ¶ added in v1.1.0
func (g *ResourceCollectionGroup) Validate() (errs ValidationErrors)
Validate honors the Validabler interface.
type State ¶ added in v0.1.0
State represents a Terraform state read by a backend. https://www.terraform.io/docs/state/index.html
outline: types types: State Terraform's cached information about your managed infrastructure and configuration. This [state](https://www.terraform.io/docs/state/index.html) is used to persistently map the same real world resources to your configuration from run-to-run, keep track of metadata, and improve performance for large infrastructures. State implements a Dict, where the first level are the providers containing the keys `data` with the data sources and `resources` with the resources. examples: backend_local.star An example of how to print a resume of providers and resources count from the state. fields: <provider> AttrDict provider and all the resources state.
type Terraform ¶ added in v0.1.0
type Terraform struct {
// contains filtered or unexported fields
}
Terraform is a representation of Terraform as a starlark.Value
outline: types types: Terraform Terraform holds all the configuration defined by a script. A global variable called `tf` contains a unique instance of Terraform. examples: tf_overview.star fields: version string Terraform version. backend Backend Backend used to store the state, if None a `local` backend it's used. provider ProviderCollection Dict with all the providers defined by provider type.
func NewTerraform ¶ added in v1.0.0
func NewTerraform(pm *terraform.PluginManager) *Terraform
NewTerraform returns a new instance of Terraform
func (*Terraform) Freeze ¶ added in v0.1.0
func (t *Terraform) Freeze()
Freeze honors the starlark.Value interface.
func (*Terraform) Validate ¶ added in v1.1.0
func (t *Terraform) Validate() (errs ValidationErrors)
Validate honors the Validabler 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 Validabler ¶ added in v1.1.0
type Validabler interface {
Validate() ValidationErrors
}
Validabler defines if the resource is validable.
type ValidationError ¶ added in v1.1.0
type ValidationError struct { // Msg reason of the error Msg string // CallStack of the instantiation of the value being validated. CallStack starlark.CallStack }
ValidationError is an error returned by Validabler.Validate.
func NewValidationError ¶ added in v1.1.0
func NewValidationError(cs starlark.CallStack, format string, args ...interface{}) *ValidationError
NewValidationError returns a new ValidationError.
func (*ValidationError) Error ¶ added in v1.1.0
func (e *ValidationError) Error() string
func (*ValidationError) Value ¶ added in v1.1.0
func (e *ValidationError) Value() starlark.Value
Value returns the error as a starlark.Value.
type ValidationErrors ¶ added in v1.1.0
type ValidationErrors []*ValidationError
ValidationErrors represents a list of ValidationErrors.
func (ValidationErrors) Value ¶ added in v1.1.0
func (e ValidationErrors) Value() starlark.Value
Value returns the errors as a starlark.Value.
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.