Documentation
¶
Overview ¶
Package bundle implements functions for serializing data into single-file Terraform modules.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bytes ¶
Bytes bundles content into a byte stream, and is referred to as name.
Example ¶
package main import ( "fmt" "io/ioutil" "github.com/joshdk/tfbundle/bundle" ) func main() { content := []byte("Hello, world!") body, err := bundle.Bytes(content, "hello.txt") if err != nil { fmt.Println(err.Error()) return } if err := ioutil.WriteFile("module.tgz", body, 0400); err != nil { fmt.Println(err.Error()) return } }
Output:
func File ¶
File bundles the contents of the file referenced by path into a byte stream. The original name of the file is used as the name of the artifact.
Example ¶
package main import ( "fmt" "io/ioutil" "github.com/joshdk/tfbundle/bundle" ) func main() { body, err := bundle.File("hello.txt") if err != nil { fmt.Println(err.Error()) return } if err := ioutil.WriteFile("module.tgz", body, 0400); err != nil { fmt.Println(err.Error()) return } }
Output:
func Reader ¶
Reader bundles content into a byte stream, and is referred to as name.
Example ¶
package main import ( "fmt" "io/ioutil" "strings" "github.com/joshdk/tfbundle/bundle" ) func main() { content := strings.NewReader("Hello, world!") body, err := bundle.Reader(content, "hello.txt") if err != nil { fmt.Println(err.Error()) return } if err := ioutil.WriteFile("module.tgz", body, 0400); err != nil { fmt.Println(err.Error()) return } }
Output:
func String ¶
String bundles content into a byte stream, and is referred to as name.
Example ¶
package main import ( "fmt" "io/ioutil" "github.com/joshdk/tfbundle/bundle" ) func main() { content := "Hello, world!" body, err := bundle.String(content, "hello.txt") if err != nil { fmt.Println(err.Error()) return } if err := ioutil.WriteFile("module.tgz", body, 0400); err != nil { fmt.Println(err.Error()) return } }
Output:
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.