pulumi/tests/testdata/codegen/read-file-func-pp/go/read-file-func.go

24 lines
391 B
Go

package main
import (
"os"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func readFileOrPanic(path string) pulumi.StringPtrInput {
data, err := os.ReadFile(path)
if err != nil {
panic(err.Error())
}
return pulumi.String(string(data))
}
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
key := readFileOrPanic("key.pub")
ctx.Export("result", key)
return nil
})
}