1
1
Fork 0
mirror of https://github.com/mcuadros/ascode synced 2024-05-08 16:46:18 +02:00

starlark/types: Provisioner documentation

This commit is contained in:
Máximo Cuadros 2020-03-25 01:13:22 +01:00
parent df4f8b77fb
commit f95cb8c6ad
No known key found for this signature in database
GPG Key ID: 17A5DFEDC735AE4B
2 changed files with 35 additions and 1 deletions

View File

@ -29,7 +29,8 @@ func init() {
//
// params:
// type string
// [backend type](https://www.terraform.io/docs/backends/types/index.html)
// [Backend type](https://www.terraform.io/docs/backends/types/index.html).
//
func BuiltinBackend(pm *terraform.PluginManager) starlark.Value {
return starlark.NewBuiltin("backend", func(_ *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
var name starlark.String

View File

@ -9,6 +9,18 @@ import (
"go.starlark.net/starlark"
)
// 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 BuiltinProvisioner(pm *terraform.PluginManager) starlark.Value {
return starlark.NewBuiltin("provisioner", func(_ *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
var name starlark.String
@ -32,12 +44,33 @@ func BuiltinProvisioner(pm *terraform.PluginManager) starlark.Value {
})
}
// 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.
//
type Provisioner struct {
provisioner *plugin.GRPCProvisioner
meta discovery.PluginMeta
*Resource
}
// NewProvisioner returns a new Provisioner for the given type.
func NewProvisioner(pm *terraform.PluginManager, typ string) (*Provisioner, error) {
cli, meta, err := pm.Provisioner(typ)
if err != nil {