Merge pull request #7194 from scrossan/master

provider/openstack: Change rules type to List
This commit is contained in:
Joe Topjian 2016-06-23 22:18:24 -06:00 committed by GitHub
commit 69743450d0
1 changed files with 9 additions and 10 deletions

View File

@ -49,10 +49,9 @@ func resourceFWPolicyV1() *schema.Resource {
Computed: true,
},
"rules": &schema.Schema{
Type: schema.TypeSet,
Type: schema.TypeList,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
Set: schema.HashString,
},
},
}
@ -66,13 +65,13 @@ func resourceFWPolicyV1Create(d *schema.ResourceData, meta interface{}) error {
return fmt.Errorf("Error creating OpenStack networking client: %s", err)
}
v := d.Get("rules").(*schema.Set)
v := d.Get("rules").([]interface{})
log.Printf("[DEBUG] Rules found : %#v", v)
log.Printf("[DEBUG] Rules count : %d", v.Len())
log.Printf("[DEBUG] Rules count : %d", len(v))
rules := make([]string, v.Len())
for i, v := range v.List() {
rules := make([]string, len(v))
for i, v := range v {
rules[i] = v.(string)
}
@ -144,13 +143,13 @@ func resourceFWPolicyV1Update(d *schema.ResourceData, meta interface{}) error {
}
if d.HasChange("rules") {
v := d.Get("rules").(*schema.Set)
v := d.Get("rules").([]interface{})
log.Printf("[DEBUG] Rules found : %#v", v)
log.Printf("[DEBUG] Rules count : %d", v.Len())
log.Printf("[DEBUG] Rules count : %d", len(v))
rules := make([]string, v.Len())
for i, v := range v.List() {
rules := make([]string, len(v))
for i, v := range v {
rules[i] = v.(string)
}
opts.Rules = rules