genconfig

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package genconfig implements config generation from provided state values.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateResourceContents

func GenerateResourceContents(addr addrs.AbsResourceInstance,
	schema *configschema.Block,
	pc addrs.LocalProviderConfig,
	stateVal cty.Value) (string, tfdiags.Diagnostics)

GenerateResourceContents generates HCL configuration code for the provided resource and state value.

If you want to generate actual valid Terraform code you should follow this call up with a call to WrapResourceContents, which will place a Terraform resource header around the attributes and blocks returned by this function.

func ShouldWriteConfig

func ShouldWriteConfig(out string) bool

func ValidateTargetFile

func ValidateTargetFile(out string) (diags tfdiags.Diagnostics)

func WrapResourceContents

func WrapResourceContents(addr addrs.AbsResourceInstance, config string) string

Types

type Change

type Change struct {
	Addr            string
	ImportID        string
	GeneratedConfig string
}

func (*Change) MaybeWriteConfig

func (c *Change) MaybeWriteConfig(writer io.Writer, out string) (io.Writer, bool, tfdiags.Diagnostics)

Jump to

Keyboard shortcuts

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