mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-10-01 16:21:06 +00:00
Make get(Region|Project|Zone) method testable (#1040)
This commit is contained in:
parent
47a8fe811b
commit
629c53be03
@ -31,13 +31,13 @@ func getRegionFromZone(zone string) string {
|
||||
// - region extracted from the `zone` field in resource schema
|
||||
// - provider-level region
|
||||
// - region extracted from the provider-level zone
|
||||
func getRegion(d *schema.ResourceData, config *Config) (string, error) {
|
||||
func getRegion(d TerraformResourceData, config *Config) (string, error) {
|
||||
return getRegionFromSchema("region", "zone", d, config)
|
||||
}
|
||||
|
||||
// getZone reads the "zone" value from the given resource data and falls back
|
||||
// to provider's value if not given. If neither is provided, returns an error.
|
||||
func getZone(d *schema.ResourceData, config *Config) (string, error) {
|
||||
func getZone(d TerraformResourceData, config *Config) (string, error) {
|
||||
res, ok := d.GetOk("zone")
|
||||
if !ok {
|
||||
if config.Zone != "" {
|
||||
@ -65,7 +65,7 @@ func getRegionFromInstanceState(is *terraform.InstanceState, config *Config) (st
|
||||
// getProject reads the "project" field from the given resource data and falls
|
||||
// back to the provider's value if not given. If the provider's value is not
|
||||
// given, an error is returned.
|
||||
func getProject(d *schema.ResourceData, config *Config) (string, error) {
|
||||
func getProject(d TerraformResourceData, config *Config) (string, error) {
|
||||
return getProjectFromSchema("project", d, config)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user