Make GCP provider "project" attribute optional

This commit is contained in:
Seth Vargo 2016-04-08 11:01:53 -04:00
parent 70c65fb00a
commit 7e5ca60369
2 changed files with 8 additions and 5 deletions

View File

@ -33,7 +33,7 @@ func Provider() terraform.ResourceProvider {
"project": &schema.Schema{
Type: schema.TypeString,
Required: true,
Required: false,
DefaultFunc: schema.EnvDefaultFunc("GOOGLE_PROJECT", nil),
},
@ -122,7 +122,7 @@ func validateAccountFile(v interface{}, k string) (warnings []string, errors []e
errors = append(errors, fmt.Errorf("Error loading Account File: %s", err))
}
if wasPath {
warnings = append(warnings, `account_file was provided as a path instead of
warnings = append(warnings, `account_file was provided as a path instead of
as file contents. This support will be removed in the future. Please update
your configuration to use ${file("filename.json")} instead.`)
}

View File

@ -42,12 +42,15 @@ The following keys can be used to configure the provider.
can also be specified with the `GOOGLE_CREDENTIALS` or `GOOGLE_CLOUD_KEYFILE_JSON`
shell environment variable, containing the contents of the credentials file.
* `project` - (Required) The ID of the project to apply any resources to. This
can also be specified with the `GOOGLE_PROJECT` shell environment variable.
* `region` - (Required) The region to operate under. This can also be specified
with the `GOOGLE_REGION` shell environment variable.
* `project` - (Optional) The ID of the project to apply resources in. This
can also be specified with the `GOOGLE_PROJECT` shell environment variable.
If unspecified, users will need to specify the `project` attribute for
all resources. If specified, resources which do not depend on a project will
ignore this value.
The following keys are supported for backwards compatibility, and may be
removed in a future version: