Merge pull request #1490 from jtopjian/openstack-allow-blank-region

provider/openstack: Allow Blank Region
pull/1381/merge
Mitchell Hashimoto 11 years ago
commit 710d1113eb

@ -111,3 +111,10 @@ func envDefaultFunc(k string) schema.SchemaDefaultFunc {
return nil, nil
}
}
func envDefaultFuncAllowMissing(k string) schema.SchemaDefaultFunc {
return func() (interface{}, error) {
v := os.Getenv(k)
return v, nil
}
}

@ -40,10 +40,9 @@ func testAccPreCheck(t *testing.T) {
}
v = os.Getenv("OS_REGION_NAME")
if v == "" {
t.Fatal("OS_REGION_NAME must be set for acceptance tests")
if v != "" {
OS_REGION_NAME = v
}
OS_REGION_NAME = v
v1 := os.Getenv("OS_IMAGE_ID")
v2 := os.Getenv("OS_IMAGE_NAME")

@ -26,7 +26,7 @@ func resourceBlockStorageVolumeV1() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DefaultFunc: envDefaultFunc("OS_REGION_NAME"),
DefaultFunc: envDefaultFuncAllowMissing("OS_REGION_NAME"),
},
"size": &schema.Schema{
Type: schema.TypeInt,

@ -20,7 +20,7 @@ func resourceComputeFloatingIPV2() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DefaultFunc: envDefaultFunc("OS_REGION_NAME"),
DefaultFunc: envDefaultFuncAllowMissing("OS_REGION_NAME"),
},
"pool": &schema.Schema{

@ -36,7 +36,7 @@ func resourceComputeInstanceV2() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DefaultFunc: envDefaultFunc("OS_REGION_NAME"),
DefaultFunc: envDefaultFuncAllowMissing("OS_REGION_NAME"),
},
"name": &schema.Schema{
Type: schema.TypeString,

@ -19,7 +19,7 @@ func resourceComputeKeypairV2() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DefaultFunc: envDefaultFunc("OS_REGION_NAME"),
DefaultFunc: envDefaultFuncAllowMissing("OS_REGION_NAME"),
},
"name": &schema.Schema{
Type: schema.TypeString,

@ -23,7 +23,7 @@ func resourceComputeSecGroupV2() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DefaultFunc: envDefaultFunc("OS_REGION_NAME"),
DefaultFunc: envDefaultFuncAllowMissing("OS_REGION_NAME"),
},
"name": &schema.Schema{
Type: schema.TypeString,

@ -23,7 +23,7 @@ func resourceFWFirewallV1() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DefaultFunc: envDefaultFunc("OS_REGION_NAME"),
DefaultFunc: envDefaultFuncAllowMissing("OS_REGION_NAME"),
},
"name": &schema.Schema{
Type: schema.TypeString,

@ -23,7 +23,7 @@ func resourceFWPolicyV1() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DefaultFunc: envDefaultFunc("OS_REGION_NAME"),
DefaultFunc: envDefaultFuncAllowMissing("OS_REGION_NAME"),
},
"name": &schema.Schema{
Type: schema.TypeString,

@ -21,7 +21,7 @@ func resourceFWRuleV1() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DefaultFunc: envDefaultFunc("OS_REGION_NAME"),
DefaultFunc: envDefaultFuncAllowMissing("OS_REGION_NAME"),
},
"name": &schema.Schema{
Type: schema.TypeString,

@ -21,7 +21,7 @@ func resourceLBMonitorV1() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DefaultFunc: envDefaultFunc("OS_REGION_NAME"),
DefaultFunc: envDefaultFuncAllowMissing("OS_REGION_NAME"),
},
"tenant_id": &schema.Schema{
Type: schema.TypeString,

@ -24,7 +24,7 @@ func resourceLBPoolV1() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DefaultFunc: envDefaultFunc("OS_REGION_NAME"),
DefaultFunc: envDefaultFuncAllowMissing("OS_REGION_NAME"),
},
"name": &schema.Schema{
Type: schema.TypeString,
@ -61,7 +61,7 @@ func resourceLBPoolV1() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DefaultFunc: envDefaultFunc("OS_REGION_NAME"),
DefaultFunc: envDefaultFuncAllowMissing("OS_REGION_NAME"),
},
"tenant_id": &schema.Schema{
Type: schema.TypeString,

@ -22,7 +22,7 @@ func resourceLBVipV1() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DefaultFunc: envDefaultFunc("OS_REGION_NAME"),
DefaultFunc: envDefaultFuncAllowMissing("OS_REGION_NAME"),
},
"name": &schema.Schema{
Type: schema.TypeString,

@ -21,7 +21,7 @@ func resourceNetworkingFloatingIPV2() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DefaultFunc: envDefaultFunc("OS_REGION_NAME"),
DefaultFunc: envDefaultFuncAllowMissing("OS_REGION_NAME"),
},
"address": &schema.Schema{
Type: schema.TypeString,

@ -21,7 +21,7 @@ func resourceNetworkingNetworkV2() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DefaultFunc: envDefaultFunc("OS_REGION_NAME"),
DefaultFunc: envDefaultFuncAllowMissing("OS_REGION_NAME"),
},
"name": &schema.Schema{
Type: schema.TypeString,

@ -21,7 +21,7 @@ func resourceNetworkingRouterInterfaceV2() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DefaultFunc: envDefaultFunc("OS_REGION_NAME"),
DefaultFunc: envDefaultFuncAllowMissing("OS_REGION_NAME"),
},
"router_id": &schema.Schema{
Type: schema.TypeString,

@ -22,7 +22,7 @@ func resourceNetworkingRouterV2() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DefaultFunc: envDefaultFunc("OS_REGION_NAME"),
DefaultFunc: envDefaultFuncAllowMissing("OS_REGION_NAME"),
},
"name": &schema.Schema{
Type: schema.TypeString,

@ -22,7 +22,7 @@ func resourceNetworkingSubnetV2() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DefaultFunc: envDefaultFunc("OS_REGION_NAME"),
DefaultFunc: envDefaultFuncAllowMissing("OS_REGION_NAME"),
},
"network_id": &schema.Schema{
Type: schema.TypeString,

@ -20,7 +20,7 @@ func resourceObjectStorageContainerV1() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DefaultFunc: envDefaultFunc("OS_REGION_NAME"),
DefaultFunc: envDefaultFuncAllowMissing("OS_REGION_NAME"),
},
"name": &schema.Schema{
Type: schema.TypeString,

Loading…
Cancel
Save