Skip to content

Commit

Permalink
OpenStack - Schema updates
Browse files Browse the repository at this point in the history
Adding Update to the list of resource operations in each of the
resources.  Also correcting the schema definitions so each updatable
element does not have a ForceNew true flag.
  • Loading branch information
dkalleg committed Jun 8, 2016
1 parent e2a850a commit 28b5d98
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func resourceListenerV2() *schema.Resource {
return &schema.Resource{
Create: resourceListenerV2Create,
Read: resourceListenerV2Read,
Update: resourceListenerV2Update,
Delete: resourceListenerV2Delete,

Schema: map[string]*schema.Schema{
Expand Down Expand Up @@ -62,7 +63,7 @@ func resourceListenerV2() *schema.Resource {
"name": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
},

"default_pool_id": &schema.Schema{
Expand All @@ -75,32 +76,27 @@ func resourceListenerV2() *schema.Resource {
"description": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},

"connection_limit": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
ForceNew: true,
},

"default_tls_container_ref": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},

"sni_container_refs": &schema.Schema{
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Elem: &schema.Schema{Type: schema.TypeString},
},

"admin_state_up": &schema.Schema{
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
},

"id": &schema.Schema{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package openstack

import (
"fmt"
"log"
"testing"

"github.com/hashicorp/terraform/helper/resource"
Expand Down Expand Up @@ -43,8 +42,6 @@ func testAccCheckLBV2ListenerDestroy(s *terraform.State) error {
}

for _, rs := range s.RootModule().Resources {
log.Printf("[FINDME] rs TYPE is: %T", rs)

if rs.Type != "openstack_lb_listener_v2" {
continue
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func resourceLoadBalancerV2() *schema.Resource {
return &schema.Resource{
Create: resourceLoadBalancerV2Create,
Read: resourceLoadBalancerV2Read,
Update: resourceLoadBalancerV2Update,
Delete: resourceLoadBalancerV2Delete,

Schema: map[string]*schema.Schema{
Expand All @@ -29,13 +30,11 @@ func resourceLoadBalancerV2() *schema.Resource {
"name": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},

"description": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},

"vip_subnet_id": &schema.Schema{
Expand All @@ -61,7 +60,6 @@ func resourceLoadBalancerV2() *schema.Resource {
"admin_state_up": &schema.Schema{
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
},

"flavor": &schema.Schema{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func resourceMemberV2() *schema.Resource {
return &schema.Resource{
Create: resourceMemberV2Create,
Read: resourceMemberV2Read,
Update: resourceMemberV2Update,
Delete: resourceMemberV2Delete,

Schema: map[string]*schema.Schema{
Expand All @@ -29,7 +30,6 @@ func resourceMemberV2() *schema.Resource {
"name": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},

"tenant_id": &schema.Schema{
Expand All @@ -55,7 +55,6 @@ func resourceMemberV2() *schema.Resource {
Type: schema.TypeInt,
Optional: true,
Computed: true,
ForceNew: true,
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) {
value := v.(int)
if value < 1 {
Expand All @@ -75,7 +74,6 @@ func resourceMemberV2() *schema.Resource {
"admin_state_up": &schema.Schema{
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
},

"pool_id": &schema.Schema{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func resourceMonitorV2() *schema.Resource {
return &schema.Resource{
Create: resourceMonitorV2Create,
Read: resourceMonitorV2Read,
Update: resourceMonitorV2Update,
Delete: resourceMonitorV2Delete,

Schema: map[string]*schema.Schema{
Expand All @@ -35,7 +36,6 @@ func resourceMonitorV2() *schema.Resource {
"name": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},

"tenant_id": &schema.Schema{
Expand All @@ -53,40 +53,33 @@ func resourceMonitorV2() *schema.Resource {
"delay": &schema.Schema{
Type: schema.TypeInt,
Required: true,
ForceNew: true,
},
"timeout": &schema.Schema{
Type: schema.TypeInt,
Required: true,
ForceNew: true,
},
"max_retries": &schema.Schema{
Type: schema.TypeInt,
Required: true,
ForceNew: true,
},
"url_path": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"http_method": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"expected_codes": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"admin_state_up": &schema.Schema{
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
},

"id": &schema.Schema{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func resourcePoolV2() *schema.Resource {
return &schema.Resource{
Create: resourcePoolV2Create,
Read: resourcePoolV2Read,
Update: resourcePoolV2Update,
Delete: resourcePoolV2Delete,

Schema: map[string]*schema.Schema{
Expand All @@ -36,13 +37,11 @@ func resourcePoolV2() *schema.Resource {
"name": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},

"description": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},

"protocol": &schema.Schema{
Expand Down Expand Up @@ -76,7 +75,6 @@ func resourcePoolV2() *schema.Resource {
"lb_method": &schema.Schema{
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) {
value := v.(string)
if value != "ROUND_ROBIN" && value != "LEAST_CONNECTIONS" && value != "SOURCE_IP" {
Expand Down Expand Up @@ -119,7 +117,6 @@ func resourcePoolV2() *schema.Resource {
"admin_state_up": &schema.Schema{
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
},

"id": &schema.Schema{
Expand Down

0 comments on commit 28b5d98

Please sign in to comment.