-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: removing (some) fields from the top level (#2257)
* refactor: moving resource group name into the azure folder * refactor: moving location into the common schema/azure * refactor: moving zones into the common schema/azure directory * removing the unused test_utils function
- Loading branch information
1 parent
bef6ec5
commit 984662e
Showing
10 changed files
with
130 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package azurerm | ||
|
||
// NOTE: methods in this file will be moved to `./helpers/azurerm` in time | ||
// new methods should be added to this directory instead. | ||
// This file exists to be able to consolidate files in the root | ||
|
||
import ( | ||
"github.com/hashicorp/terraform/helper/schema" | ||
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" | ||
) | ||
|
||
func locationSchema() *schema.Schema { | ||
return azure.SchemaLocation() | ||
} | ||
|
||
func locationForDataSourceSchema() *schema.Schema { | ||
return azure.SchemaLocationForDataSource() | ||
} | ||
|
||
func deprecatedLocationSchema() *schema.Schema { | ||
return azure.SchemaLocationDeprecated() | ||
} | ||
|
||
func azureRMNormalizeLocation(location interface{}) string { | ||
return azure.NormalizeLocation(location) | ||
} | ||
|
||
func azureRMSuppressLocationDiff(k, old, new string, d *schema.ResourceData) bool { | ||
return azure.SuppressLocationDiff(k, old, new, d) | ||
} | ||
|
||
func resourceGroupNameSchema() *schema.Schema { | ||
return azure.SchemaResourceGroupName() | ||
} | ||
|
||
func resourceGroupNameDiffSuppressSchema() *schema.Schema { | ||
return azure.SchemaResourceGroupNameDiffSuppress() | ||
} | ||
|
||
func resourceGroupNameForDataSourceSchema() *schema.Schema { | ||
return azure.SchemaResourceGroupNameForDataSource() | ||
} | ||
|
||
func zonesSchema() *schema.Schema { | ||
return azure.SchemaZones() | ||
} | ||
|
||
func singleZonesSchema() *schema.Schema { | ||
return azure.SchemaSingleZone() | ||
} | ||
|
||
func zonesSchemaComputed() *schema.Schema { | ||
return azure.SchemaZonesComputed() | ||
} | ||
|
||
func expandZones(v []interface{}) *[]string { | ||
return azure.ExpandZones(v) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package azure | ||
|
||
import "testing" | ||
|
||
func TestNormalizeLocation(t *testing.T) { | ||
cases := []struct { | ||
input string | ||
expected string | ||
}{ | ||
{ | ||
input: "West US", | ||
expected: "westus", | ||
}, | ||
{ | ||
input: "South East Asia", | ||
expected: "southeastasia", | ||
}, | ||
{ | ||
input: "southeastasia", | ||
expected: "southeastasia", | ||
}, | ||
} | ||
|
||
for _, v := range cases { | ||
actual := NormalizeLocation(v.input) | ||
if v.expected != actual { | ||
t.Fatalf("Expected %q but got %q", v.expected, actual) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.