Skip to content

Commit

Permalink
Merge pull request #324 from jgoldschrafe/feature-gce-target-tags
Browse files Browse the repository at this point in the history
provider/google: google_compute_firewall: Support target tags
  • Loading branch information
mitchellh committed Sep 27, 2014
2 parents 100f8e3 + 0598f2f commit e7f113f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions builtin/providers/google/resource_compute_firewall.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ func resourceComputeFirewall() *schema.Resource {
return hashcode.String(v.(string))
},
},

"target_tags": &schema.Schema{
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
Set: func(v interface{}) int {
return hashcode.String(v.(string))
},
},
},
}
}
Expand Down Expand Up @@ -285,12 +294,22 @@ func resourceFirewall(
}
}

// Build up the list of targets
var targetTags []string
if v := d.Get("target_tags").(*schema.Set); v.Len() > 0 {
targetTags = make([]string, v.Len())
for i, v:= range v.List() {
targetTags[i] = v.(string)
}
}

// Build the firewall parameter
return &compute.Firewall{
Name: d.Get("name").(string),
Network: network.SelfLink,
Allowed: allowed,
SourceRanges: sourceRanges,
SourceTags: sourceTags,
TargetTags: targetTags,
}, nil
}

0 comments on commit e7f113f

Please sign in to comment.