diff --git a/provider/terraform/resources/resource_compute_global_forwarding_rule.go.erb b/provider/terraform/resources/resource_compute_global_forwarding_rule.go.erb index b842067dfddd..e78ed587592a 100644 --- a/provider/terraform/resources/resource_compute_global_forwarding_rule.go.erb +++ b/provider/terraform/resources/resource_compute_global_forwarding_rule.go.erb @@ -58,7 +58,7 @@ func resourceComputeGlobalForwardingRule() *schema.Resource { "labels": &schema.Schema{ <% if version.nil? || version == 'ga' -%> - Deprecated: "This field is in beta and will be removed from this provider. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", + Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", <% end -%> Type: schema.TypeMap, Optional: true, @@ -67,6 +67,9 @@ func resourceComputeGlobalForwardingRule() *schema.Resource { }, "label_fingerprint": &schema.Schema{ +<% if version.nil? || version == 'ga' -%> + Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", +<% end -%> Type: schema.TypeString, Computed: true, }, @@ -138,6 +141,7 @@ func resourceComputeGlobalForwardingRuleCreate(d *schema.ResourceData, meta inte return err } +<% unless version.nil? || version == 'ga' -%> // If we have labels to set, try to set those too if _, ok := d.GetOk("labels"); ok { labels := expandLabels(d) @@ -152,6 +156,7 @@ func resourceComputeGlobalForwardingRuleCreate(d *schema.ResourceData, meta inte return err } } +<% end -%> return resourceComputeGlobalForwardingRuleRead(d, meta) } @@ -183,6 +188,7 @@ func resourceComputeGlobalForwardingRuleUpdate(d *schema.ResourceData, meta inte d.SetPartial("target") } +<% unless version.nil? || version == 'ga' -%> if d.HasChange("labels") { labels := expandLabels(d) fingerprint := d.Get("label_fingerprint").(string) @@ -194,6 +200,7 @@ func resourceComputeGlobalForwardingRuleUpdate(d *schema.ResourceData, meta inte d.SetPartial("labels") } +<% end -%> d.Partial(false) @@ -221,8 +228,13 @@ func resourceComputeGlobalForwardingRuleRead(d *schema.ResourceData, meta interf d.Set("ip_protocol", frule.IPProtocol) d.Set("ip_version", frule.IpVersion) d.Set("self_link", ConvertSelfLinkToV1(frule.SelfLink)) +<% unless version.nil? || version == 'ga' -%> d.Set("labels", frule.Labels) d.Set("label_fingerprint", frule.LabelFingerprint) +<% else -%> + // removed lists need something set + d.Set("labels", nil) +<% end -%> d.Set("project", project) return nil @@ -251,6 +263,7 @@ func resourceComputeGlobalForwardingRuleDelete(d *schema.ResourceData, meta inte return nil } +<% unless version.nil? || version == 'ga' -%> // resourceComputeGlobalForwardingRuleReadLabelFingerprint performs a read on the remote resource and returns only the // fingerprint. Used on create when setting labels as we don't know the label fingerprint initially. func resourceComputeGlobalForwardingRuleReadLabelFingerprint(config *Config, project, name string) (string, error) { @@ -280,3 +293,4 @@ func resourceComputeGlobalForwardingRuleSetLabels(config *Config, project, name return nil } +<% end -%> diff --git a/provider/terraform/tests/resource_compute_global_forwarding_rule_test.go b/provider/terraform/tests/resource_compute_global_forwarding_rule_test.go.erb similarity index 98% rename from provider/terraform/tests/resource_compute_global_forwarding_rule_test.go rename to provider/terraform/tests/resource_compute_global_forwarding_rule_test.go.erb index d6dc28934045..078c37c45c12 100644 --- a/provider/terraform/tests/resource_compute_global_forwarding_rule_test.go +++ b/provider/terraform/tests/resource_compute_global_forwarding_rule_test.go.erb @@ -1,3 +1,4 @@ +<% autogen_exception -%> package google import ( @@ -113,6 +114,7 @@ func TestAccComputeGlobalForwardingRule_ipv6(t *testing.T) { }) } +<% unless version.nil? || version == 'ga' -%> func TestAccComputeGlobalForwardingRule_labels(t *testing.T) { t.Parallel() @@ -153,6 +155,7 @@ func TestAccComputeGlobalForwardingRule_labels(t *testing.T) { }, }) } +<% end -%> func testAccCheckComputeGlobalForwardingRuleDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) @@ -253,7 +256,7 @@ func testAccCheckComputeBetaGlobalForwardingRuleIpVersion(n, version string) res return nil } } - +<% unless version.nil? || version == 'ga' -%> func testAccCheckComputeBetaGlobalForwardingRuleHasLabel(frule *computeBeta.ForwardingRule, key, value string) resource.TestCheckFunc { return func(s *terraform.State) error { val, ok := frule.Labels[key] @@ -267,7 +270,9 @@ func testAccCheckComputeBetaGlobalForwardingRuleHasLabel(frule *computeBeta.Forw return nil } } +<% end -%> +<% unless version.nil? || version == 'ga' -%> func testAccCheckComputeBetaGlobalForwardingRuleHasCorrectLabelFingerprint( frule *computeBeta.ForwardingRule, resourceName string) resource.TestCheckFunc { return func(s *terraform.State) error { @@ -281,6 +286,7 @@ func testAccCheckComputeBetaGlobalForwardingRuleHasCorrectLabelFingerprint( return nil } } +<% end -%> func testAccComputeGlobalForwardingRule_basic1(fr, proxy1, proxy2, backend, hc, urlmap string) string { return fmt.Sprintf(` @@ -339,6 +345,7 @@ func testAccComputeGlobalForwardingRule_basic1(fr, proxy1, proxy2, backend, hc, }`, fr, proxy1, proxy2, backend, hc, urlmap) } +<% unless version.nil? || version == 'ga' -%> func testAccComputeGlobalForwardingRule_labels(fr, proxy1, proxy2, backend, hc, urlmap string) string { return fmt.Sprintf(` resource "google_compute_global_forwarding_rule" "foobar" { @@ -400,7 +407,9 @@ func testAccComputeGlobalForwardingRule_labels(fr, proxy1, proxy2, backend, hc, } }`, fr, proxy1, proxy2, backend, hc, urlmap) } +<% end -%> +<% unless version.nil? || version == 'ga' -%> func testAccComputeGlobalForwardingRule_labelsUpdated(fr, proxy1, proxy2, backend, hc, urlmap string) string { return fmt.Sprintf(` resource "google_compute_global_forwarding_rule" "foobar" { @@ -462,6 +471,7 @@ func testAccComputeGlobalForwardingRule_labelsUpdated(fr, proxy1, proxy2, backen } }`, fr, proxy1, proxy2, backend, hc, urlmap) } +<% end -%> func testAccComputeGlobalForwardingRule_basic2(fr, proxy1, proxy2, backend, hc, urlmap string) string { return fmt.Sprintf(`