providers/google: Add account_file_contents to provider
This commit is contained in:
parent
9416d10ccc
commit
a8d0a70c03
|
@ -23,9 +23,10 @@ import (
|
||||||
// Config is the configuration structure used to instantiate the Google
|
// Config is the configuration structure used to instantiate the Google
|
||||||
// provider.
|
// provider.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
AccountFile string
|
AccountFile string
|
||||||
Project string
|
AccountFileContents string
|
||||||
Region string
|
Project string
|
||||||
|
Region string
|
||||||
|
|
||||||
clientCompute *compute.Service
|
clientCompute *compute.Service
|
||||||
clientContainer *container.Service
|
clientContainer *container.Service
|
||||||
|
@ -40,6 +41,9 @@ func (c *Config) loadAndValidate() error {
|
||||||
if c.AccountFile == "" {
|
if c.AccountFile == "" {
|
||||||
c.AccountFile = os.Getenv("GOOGLE_ACCOUNT_FILE")
|
c.AccountFile = os.Getenv("GOOGLE_ACCOUNT_FILE")
|
||||||
}
|
}
|
||||||
|
if c.AccountFileContents == "" {
|
||||||
|
c.AccountFileContents = os.Getenv("GOOGLE_ACCOUNT_FILE_CONTENTS")
|
||||||
|
}
|
||||||
if c.Project == "" {
|
if c.Project == "" {
|
||||||
c.Project = os.Getenv("GOOGLE_PROJECT")
|
c.Project = os.Getenv("GOOGLE_PROJECT")
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,12 @@ func Provider() terraform.ResourceProvider {
|
||||||
DefaultFunc: schema.EnvDefaultFunc("GOOGLE_ACCOUNT_FILE", nil),
|
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{
|
"project": &schema.Schema{
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Required: true,
|
Required: true,
|
||||||
|
|
Loading…
Reference in New Issue