mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-09-07 01:26:43 +00:00
36 lines
670 B
Go
36 lines
670 B
Go
![]() |
package google
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"os"
|
||
|
"testing"
|
||
|
|
||
|
"github.com/hashicorp/terraform/helper/resource"
|
||
|
)
|
||
|
|
||
|
func TestMain(m *testing.M) {
|
||
|
resource.TestMain(m)
|
||
|
}
|
||
|
|
||
|
// sharedConfigForRegion returns a common config setup needed for the sweeper
|
||
|
// functions for a given region
|
||
|
func sharedConfigForRegion(region string) (*Config, error) {
|
||
|
project := os.Getenv("GOOGLE_PROJECT")
|
||
|
if project == "" {
|
||
|
return nil, fmt.Errorf("empty GOOGLE_PROJECT")
|
||
|
}
|
||
|
|
||
|
creds := os.Getenv("GOOGLE_CREDENTIALS")
|
||
|
if creds == "" {
|
||
|
return nil, fmt.Errorf("empty GOOGLE_CREDENTIALS")
|
||
|
}
|
||
|
|
||
|
conf := &Config{
|
||
|
Credentials: creds,
|
||
|
Region: region,
|
||
|
Project: project,
|
||
|
}
|
||
|
|
||
|
return conf, nil
|
||
|
}
|