terraform

package module
v0.0.0-...-1ae50ae Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 15 Imported by: 0

README

terraform-go

a Golang wrapper for terraform. The initial idea is using providers in Terraform to query infra resource data. This is a Golang wrapper to download Terraform binary, running plan and extract the structed result.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplyConfig

type ApplyConfig struct {
	ChDir      string
	PlanBinary []byte
	PlanPath   string
}

func (*ApplyConfig) Apply

func (c *ApplyConfig) Apply() (*ApplyResult, error)

type ApplyResult

type ApplyResult struct {
	State State
	Logs  []string
}

type Change

type Change struct {
	Actions         []string `json:"actions,omitempty"`
	Before          any      `json:"before,omitempty"`
	After           any      `json:"after,omitempty"`
	AfterUnknown    any      `json:"after_unknown,omitempty"`
	BeforeSensitive any      `json:"before_sensitive,omitempty"`
	AfterSensitive  any      `json:"after_sensitive,omitempty"`
	ReplacePaths    any      `json:"replace_paths,omitempty"`
	Importing       any      `json:"importing,omitempty"`
	GeneratedConfig string   `json:"generated_config,omitempty"`
}

type InitConfig

type InitConfig struct {
	ChDir         string
	Upgrade       bool
	Reconfigure   bool
	MigrateState  bool
	BackendConfig map[string]string
}

func (*InitConfig) Init

func (c *InitConfig) Init() error

type Module

type Module struct {
	Resources    []Resource `json:"resources,omitempty"`
	Address      string     `json:"address,omitempty"`
	ChildModules []Module   `json:"child_modules,omitempty"`
}

type Output

type Output struct {
	Sensitive bool `json:"sensitive"`
	Type      any  `json:"type,omitempty"`
	Value     any  `json:"value,omitempty"`
}

type Plan

type Plan struct {
	FormatVersion      string            `json:"format_version,omitempty"`
	TerraformVersion   string            `json:"terraform_version,omitempty"`
	Variables          Variables         `json:"variables,omitempty"`
	PlannedValues      StateValues       `json:"planned_values,omitempty"`
	ResourceDrift      []ResourceChange  `json:"resource_drift,omitempty"`
	ResourceChanges    []ResourceChange  `json:"resource_changes,omitempty"`
	OutputChanges      map[string]Change `json:"output_changes,omitempty"`
	PriorState         any               `json:"prior_state,omitempty"`
	Config             any               `json:"configuration,omitempty"`
	RelevantAttributes []ResourceAttr    `json:"relevant_attributes,omitempty"`
	Checks             any               `json:"checks,omitempty"`
	Timestamp          string            `json:"timestamp,omitempty"`
	Errored            bool              `json:"errored"`
}

type PlanConfig

type PlanConfig struct {
	ChDir   string
	Destroy bool
	Targets []string
	Vars    map[string]any
}

func (*PlanConfig) Plan

func (c *PlanConfig) Plan() (*PlanResult, error)

type PlanResult

type PlanResult struct {
	Plan       Plan
	PlanBinary []byte
	PlanPath   string
	Logs       []string
}

type Resource

type Resource struct {
	Addr            string `json:"addr"`
	Module          string `json:"module"`
	Resource        string `json:"resource"`
	ImpliedProvider string `json:"implied_provider"`
	ResourceType    string `json:"resource_type"`
	ResourceName    string `json:"resource_name"`
	ResourceKey     string `json:"resource_key"`
}

type ResourceAttr

type ResourceAttr any

type ResourceChange

type ResourceChange any

type State

type State struct {
	FormatVersion    string       `json:"format_version,omitempty"`
	TerraformVersion string       `json:"terraform_version,omitempty"`
	Values           *StateValues `json:"values,omitempty"`
	Checks           any          `json:"checks,omitempty"`
}

type StateValues

type StateValues struct {
	Outputs    map[string]Output `json:"outputs,omitempty"`
	RootModule Module            `json:"root_module,omitempty"`
}

type Variables

type Variables any

Jump to

Keyboard shortcuts

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