Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type State ¶
type State struct { TerraformVersion string Values *StateValues }
func FromJSONState ¶
Example ¶
package main import ( "context" "log" "github.com/hashicorp/hc-install/fs" "github.com/hashicorp/hc-install/product" "github.com/hashicorp/terraform-exec/tfexec" "github.com/magodo/tfstate" ) func main() { ctx := context.TODO() av := fs.AnyVersion{ Product: &product.Terraform, } execPath, err := av.Find(ctx) if err != nil { log.Fatal(err) } tf, err := tfexec.NewTerraform(".", execPath) if err != nil { log.Fatal(err) } schema, err := tf.ProvidersSchema(ctx) if err != nil { log.Fatalf("get provider schema: %v", err) } rawState, err := tf.Show(ctx) if err != nil { log.Fatalf("show state: %v", err) } state, err := tfstate.FromJSONState(rawState, schema) if err != nil { log.Fatal(err) } _ = state }
Output:
type StateModule ¶
type StateModule struct { Resources []*StateResource Address string ChildModules []*StateModule }
func FromJSONStateModule ¶
func FromJSONStateModule(module *tfjson.StateModule, schemas *tfjson.ProviderSchemas) (*StateModule, error)
type StateOutput ¶
type StateOutput struct { Sensitive bool Value interface{} }
func FromJSONStateOutput ¶
func FromJSONStateOutput(output *tfjson.StateOutput) *StateOutput
type StateResource ¶
type StateResource struct { Address string Mode tfjson.ResourceMode Type string Name string Index interface{} ProviderName string SchemaVersion uint64 Value cty.Value SensitiveValues json.RawMessage DependsOn []string Tainted bool DeposedKey string }
func FromJSONStateResource ¶
func FromJSONStateResource(resource *tfjson.StateResource, schemas *tfjson.ProviderSchemas) (*StateResource, error)
type StateValues ¶
type StateValues struct { RootModule *StateModule Outputs map[string]*StateOutput }
Click to show internal directories.
Click to hide internal directories.