File: plugin.go

package info (click to toggle)
golang-github-hashicorp-terraform-plugin-test 1.3.0%2Bgit20200503.328f99a-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 140 kB
  • sloc: makefile: 2
file content (15 lines) | stat: -rw-r--r-- 425 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package tftest

import (
	"os"
)

// RunningAsPlugin returns true if it detects the usual Terraform plugin
// detection environment variables, suggesting that the current process is
// being launched as a plugin server.
func RunningAsPlugin() bool {
	const cookieVar = "TF_PLUGIN_MAGIC_COOKIE"
	const cookieVal = "d602bf8f470bc67ca7faa0386276bbdd4330efaf76d1a219cb4d6991ca9872b2"

	return os.Getenv(cookieVar) == cookieVal
}