genconfig

package
v1.8.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 License: MPL-2.0 Imports: 13 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 OpenTofu code you should follow this call up with a call to WrapResourceContents, which will place an OpenTofu 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