diff --git a/config.go b/config.go index 6af5fbd6..99e693fd 100644 --- a/config.go +++ b/config.go @@ -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") } diff --git a/provider.go b/provider.go index 30cef8c1..c93812d5 100644 --- a/provider.go +++ b/provider.go @@ -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,