Skip to content

GalleyBytes/tfohttpclient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

tfohttpclient

This is a package for tfo-plugins intended to read the terraform resource spec of the terraform resource that it belongs to. All envs required are provided to the pod by the terraform-operator that provision the job/pod.

Example usage

export TFO_NAMESPACE=default
export TFO_RESOURCE=hello-tfo
package main

import (
	"log"
	"github.com/galleybytes/tfohttpclient"
)

func main() {
	b, err := tfohttpclient.Resource()
	if err != nil {
		panic(err)
	}
	log.Print(string(b))
}

Or unmarshal into the api

import "github.com/isaaguilar/terraform-operator/pkg/apis/tf/v1alpha2"
	b, _ := tfohttpclient.Resource()
	//Extract the spec
	var tf v1alpha2.Terraform
	err = json.Unmarshal(b, &tf)
	// handle err
	log.Printf("%+v", tf.Spec)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages