jsdecode

package
v0.0.0-...-7bdeeeb Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package jsdecode contains the functions that are used to retrieve information about resources and changes from json plan files that Terraform will make to update remote objects to match with changes to the configuration.

Index

Constants

View Source
const (
	ComputeDiskType     = "google_compute_disk"
	ComputeInstanceType = "google_compute_instance"
)

ComputeInstanceType and ComputeDiskType are the supported by this package types of ResourceChange and Resource.

View Source
const (
	ActionCreate  string = "create"
	ActionDelete  string = "delete"
	ActionNoop    string = "no-op"
	ActionReplace string = "replace"
	ActionUpdate  string = "update"
)

Possible actions in resource changes.

Variables

This section is empty.

Functions

func ExtractPlanStruct

func ExtractPlanStruct(reader io.Reader) (*tfjson.Plan, error)

ExtractPlanStruct extracts tfjson.Plan struct from file in provided path if it is possible.

func GetResources

func GetResources(details *cd.ResourceDetail, plan *tfjson.Plan) []resources.ResourceState

GetResources extracts all resources of ComputeInstance and ComputeDisk type and their before and after states from plan file.

Types

type ResourceInfo

type ResourceInfo struct {
	Name        string      `json:"name,omitempty"`
	InstanceID  string      `json:"instance_id,omitempty"`
	Zone        string      `json:"zone,omitempty"`
	MachineType string      `json:"machine_type,omitempty"`
	DiskType    string      `json:"type,omitempty"`
	Image       string      `json:"image,omitempty"`
	Snapshot    string      `json:"snapshot,omitempty"`
	SizeGiB     int64       `json:"size,omitempty"`
	Scheduling  []UsageType `json:"scheduling,omitempty"`
}

ResourceInfo contains the information about Resource in json plan file, this struct is used to cast interface of before/after states to the certain Resource.

type UsageType

type UsageType struct {
	IsPreemptible bool `json:"preemptible,omitempty"`
}

UsageType contains the information whether the certain istance is preemptible or not.

Jump to

Keyboard shortcuts

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