Skip to content

Commit

Permalink
core: Add 'UserAgentString' helper function to generate a standard Us…
Browse files Browse the repository at this point in the history
…erAgent string. Example generation: 'Terraform 0.9.7-dev (go1.8.1)'
  • Loading branch information
fatmcgav committed Jun 1, 2017
1 parent 15704cc commit 76fbe83
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions terraform/user_agent.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package terraform

import (
"fmt"
"runtime"
)

// The standard Terraform User-Agent format
const UserAgent = "Terraform %s (%s)"

// Generate a UserAgent string
func UserAgentString() string {
return fmt.Sprintf(UserAgent, VersionString(), runtime.Version())
}

0 comments on commit 76fbe83

Please sign in to comment.