From 0598f2fdb0f34071fc361885ba2bf0f107ce6d32 Mon Sep 17 00:00:00 2001 From: Jeff Goldschrafe Date: Fri, 26 Sep 2014 01:15:31 -0400 Subject: [PATCH] google_compute_firewall: Support target tags --- .../google/resource_compute_firewall.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/builtin/providers/google/resource_compute_firewall.go b/builtin/providers/google/resource_compute_firewall.go index a6468bce575b..c7d32517f208 100644 --- a/builtin/providers/google/resource_compute_firewall.go +++ b/builtin/providers/google/resource_compute_firewall.go @@ -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)) + }, + }, }, } } @@ -285,6 +294,15 @@ 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), @@ -292,5 +310,6 @@ func resourceFirewall( Allowed: allowed, SourceRanges: sourceRanges, SourceTags: sourceTags, + TargetTags: targetTags, }, nil }