Mark Forwarding Rule allPorts as GA (#3309)

<!-- This change is generated by MagicModules. -->
/cc @rileykarson
This commit is contained in:
The Magician 2019-03-25 10:18:40 -07:00 committed by Riley Karson
parent ef974d2781
commit f0cd0f77bb
3 changed files with 29 additions and 1 deletions

View File

@ -63,6 +63,11 @@ func resourceComputeForwardingRule() *schema.Resource {
ValidateFunc: validation.StringInSlice([]string{"TCP", "UDP", "ESP", "AH", "SCTP", "ICMP", ""}, false),
DiffSuppressFunc: caseDiffSuppress,
},
"all_ports": {
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
},
"backend_service": {
Type: schema.TypeString,
Optional: true,
@ -230,6 +235,12 @@ func resourceComputeForwardingRuleCreate(d *schema.ResourceData, meta interface{
} else if v, ok := d.GetOkExists("target"); !isEmptyValue(reflect.ValueOf(targetProp)) && (ok || !reflect.DeepEqual(v, targetProp)) {
obj["target"] = targetProp
}
allPortsProp, err := expandComputeForwardingRuleAllPorts(d.Get("all_ports"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("all_ports"); !isEmptyValue(reflect.ValueOf(allPortsProp)) && (ok || !reflect.DeepEqual(v, allPortsProp)) {
obj["allPorts"] = allPortsProp
}
networkTierProp, err := expandComputeForwardingRuleNetworkTier(d.Get("network_tier"), d, config)
if err != nil {
return err
@ -346,6 +357,9 @@ func resourceComputeForwardingRuleRead(d *schema.ResourceData, meta interface{})
if err := d.Set("target", flattenComputeForwardingRuleTarget(res["target"], d)); err != nil {
return fmt.Errorf("Error reading ForwardingRule: %s", err)
}
if err := d.Set("all_ports", flattenComputeForwardingRuleAllPorts(res["allPorts"], d)); err != nil {
return fmt.Errorf("Error reading ForwardingRule: %s", err)
}
if err := d.Set("network_tier", flattenComputeForwardingRuleNetworkTier(res["networkTier"], d)); err != nil {
return fmt.Errorf("Error reading ForwardingRule: %s", err)
}
@ -528,6 +542,10 @@ func flattenComputeForwardingRuleTarget(v interface{}, d *schema.ResourceData) i
return ConvertSelfLinkToV1(v.(string))
}
func flattenComputeForwardingRuleAllPorts(v interface{}, d *schema.ResourceData) interface{} {
return v
}
func flattenComputeForwardingRuleNetworkTier(v interface{}, d *schema.ResourceData) interface{} {
return v
}
@ -645,6 +663,10 @@ func expandComputeForwardingRuleTarget(v interface{}, d TerraformResourceData, c
return url + v.(string), nil
}
func expandComputeForwardingRuleAllPorts(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}
func expandComputeForwardingRuleNetworkTier(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}

View File

@ -245,7 +245,7 @@ resource "google_compute_forwarding_rule" "foobar" {
name = "%s"
load_balancing_scheme = "INTERNAL"
backend_service = "${google_compute_region_backend_service.foobar-bs.self_link}"
ports = ["80"]
all_ports = true
network = "${google_compute_network.foobar.name}"
subnetwork = "%s"
}

View File

@ -186,6 +186,12 @@ The following arguments are supported:
must be of a type appropriate to the target object.
This field is not used for internal load balancing.
* `all_ports` -
(Optional)
When the load balancing scheme is INTERNAL and protocol is TCP/UDP, omit
`port`/`port_range` and specify this field as `true` to allow packets addressed
to any ports to be forwarded to the backends configured with this forwarding rule.
* `network_tier` -
(Optional)
The networking tier used for configuring this address. This field can