hclwrite

package
v3.97.1 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

hclwrite is a shared interface for writing HCL files for cross-tests. Both the Terraform Plugin SDK bridge and the Pulumi Framework bridge implement this interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteProvider

func WriteProvider(w io.Writer, schema ShimHCLSchema, providerType string, config map[string]cty.Value) error

WriteProvider writes a provider declaration to an HCL file.

Note that unknowns are not yet supported in cty.Value, it will error out if found.

func WriteResource

func WriteResource(
	w io.Writer, schema ShimHCLSchema, resourceType, resourceName string, config map[string]cty.Value,
	opts ...WriteResourceOption,
) error

WriteResource writes a resource declaration to an HCL file.

Note that unknowns are not yet supported in cty.Value, it will error out if found.

Types

type Nesting

type Nesting string

Nesting is the nesting mode of a block.

const (
	NestingInvalid Nesting = "NestingInvalid"
	NestingSingle  Nesting = "NestingSingle"
	NestingList    Nesting = "NestingList"
	NestingSet     Nesting = "NestingSet"
)

type ShimHCLAttribute

type ShimHCLAttribute struct{}

ShimHCLAttribute is an attribute used to write a value to an HCL file.

type ShimHCLBlock

type ShimHCLBlock interface {
	GetNestingMode() Nesting
	GetAttributes() map[string]ShimHCLAttribute
	GetBlocks() map[string]ShimHCLBlock
}

ShimHCLBlock is a block used to write a value to an HCL file.

type ShimHCLSchema

type ShimHCLSchema interface {
	GetAttributes() map[string]ShimHCLAttribute
	GetBlocks() map[string]ShimHCLBlock
}

ShimHCLSchema is the schema used to write a value to an HCL file.

type WriteResourceOption

type WriteResourceOption func(*writeResourceOptions)

WriteResourceOption is an option for WriteResource.

func WithCreateBeforeDestroy

func WithCreateBeforeDestroy(createBeforeDestroy bool) WriteResourceOption

WithCreateBeforeDestroy is an option to set the create_before_destroy attribute on a resource.

Jump to

Keyboard shortcuts

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