Skip to content

Commit

Permalink
add readme for go package
Browse files Browse the repository at this point in the history
  • Loading branch information
fujiwara committed Mar 26, 2020
1 parent 28f177b commit 70fd1f7
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,26 @@ Lookup resource attributes in tfstate.

## Usage (Go package)

See [godoc](https://godoc.org/github.com/fujiwara/tfstate-lookup/tfstate).
See details in [godoc](https://godoc.org/github.com/fujiwara/tfstate-lookup/tfstate).

```go
package main

import(
"fmt"
"os"

"github.com/fujiwara/tfstate-lookup/tfstate"
)

func main() {
f, _ := os.Open("terraform.tfstate")
state, _ := tfstate.Read(f)
res, _ := state.Lookup("aws_vpc.main.id")
vpcID := res.(string)
fmt.Println(vpcID)
}
```

## Usage (command)

Expand Down

0 comments on commit 70fd1f7

Please sign in to comment.