gen

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2023 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package gen contains routines for generating a Jsonnet library given a Terraform provider schema.

Index

Constants

View Source
const (
	IsListOrSet collectionType = iota
	IsMap
	IsNotCollection
)
View Source
const (
	IsUnknown resourceOrDataSource = iota
	IsProvider
	IsResource
	IsDataSource
	IsNestedBlock
)

Variables

This section is empty.

Functions

func ProviderNameFromAddr

func ProviderNameFromAddr(addr string) (string, error)

func RenderLibrary

func RenderLibrary(
	logger *zap.SugaredLogger,
	outDir string,
	opts RenderLibraryOpts,
) error

RenderLibrary renders a full provider schema as a libsonnet library. The libsonnet library has the following folderstructure:

- `main.libsonnet`: The root index file containing all the definitions. - `_gen`: Folder containing all the autogenerated files. - `_gen/main.libsonnet`: The index file containing all the autogenerated definitions. - `_gen/resource_RESOURCE.libsonnet`: A resource object file containing definitions for constructing the given resource block. - `_gen/data_DATASRC.libsonnet`: A data source object file containing definitions for constructing the given data source block.

Types

type RenderLibraryOpts added in v0.0.2

type RenderLibraryOpts struct {
	ProviderName   string
	ResourcePrefix string
	Schema         *tfjson.ProviderSchema
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL