providers/google: Add account_file_contents to provider

This commit is contained in:
Justin Campbell 2015-07-23 16:53:44 -04:00
parent 217393d674
commit 470ea3eac0
2 changed files with 13 additions and 3 deletions

View File

@ -23,9 +23,10 @@ import (
// Config is the configuration structure used to instantiate the Google
// provider.
type Config struct {
AccountFile string
Project string
Region string
AccountFile string
AccountFileContents string
Project string
Region string
clientCompute *compute.Service
clientContainer *container.Service
@ -40,6 +41,9 @@ func (c *Config) loadAndValidate() error {
if c.AccountFile == "" {
c.AccountFile = os.Getenv("GOOGLE_ACCOUNT_FILE")
}
if c.AccountFileContents == "" {
c.AccountFileContents = os.Getenv("GOOGLE_ACCOUNT_FILE_CONTENTS")
}
if c.Project == "" {
c.Project = os.Getenv("GOOGLE_PROJECT")
}

View File

@ -15,6 +15,12 @@ func Provider() terraform.ResourceProvider {
DefaultFunc: schema.EnvDefaultFunc("GOOGLE_ACCOUNT_FILE", nil),
},
"account_file_contents": &schema.Schema{
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("GOOGLE_ACCOUNT_FILE_CONTENTS", nil),
},
"project": &schema.Schema{
Type: schema.TypeString,
Required: true,