Skip to content

Commit

Permalink
Move expr to GA (GoogleCloudPlatform#3028)
Browse files Browse the repository at this point in the history
  • Loading branch information
slevenick authored and Nathan Klish committed May 18, 2020
1 parent 0a63ef5 commit 135aba8
Showing 1 changed file with 0 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ func resourceComputeSecurityPolicy() *schema.Resource {
ValidateFunc: validation.StringInSlice([]string{"SRC_IPS_V1"}, false),
},

<% unless version == 'ga' -%>
"expr": {
Type: schema.TypeList,
Optional: true,
Expand All @@ -122,7 +121,6 @@ func resourceComputeSecurityPolicy() *schema.Resource {
},
},
},
<% end -%>
},
},
},
Expand Down Expand Up @@ -360,9 +358,7 @@ func expandSecurityPolicyMatch(configured []interface{}) *compute.SecurityPolicy
return &compute.SecurityPolicyRuleMatcher{
VersionedExpr: data["versioned_expr"].(string),
Config: expandSecurityPolicyMatchConfig(data["config"].([]interface{})),
<% unless version == 'ga' -%>
Expr: expandSecurityPolicyMatchExpr(data["expr"].([]interface{})),
<% end -%>
}
}

Expand All @@ -377,7 +373,6 @@ func expandSecurityPolicyMatchConfig(configured []interface{}) *compute.Security
}
}

<% unless version == 'ga' -%>
func expandSecurityPolicyMatchExpr(expr []interface{}) *compute.Expr {
if len(expr) == 0 || expr[0] == nil {
return nil
Expand All @@ -392,7 +387,6 @@ func expandSecurityPolicyMatchExpr(expr []interface{}) *compute.Expr {
// Location: data["location"].(string),
}
}
<% end -%>

func flattenSecurityPolicyRules(rules []*compute.SecurityPolicyRule) []map[string]interface{} {
rulesSchema := make([]map[string]interface{}, 0, len(rules))
Expand All @@ -418,9 +412,7 @@ func flattenMatch(match *compute.SecurityPolicyRuleMatcher) []map[string]interfa
data := map[string]interface{}{
"versioned_expr": match.VersionedExpr,
"config": flattenMatchConfig(match.Config),
<% unless version == 'ga' -%>
"expr": flattenMatchExpr(match),
<% end -%>
}

return []map[string]interface{}{data}
Expand All @@ -438,7 +430,6 @@ func flattenMatchConfig(conf *compute.SecurityPolicyRuleMatcherConfig) []map[str
return []map[string]interface{}{data}
}

<% unless version == 'ga' -%>
func flattenMatchExpr(match *compute.SecurityPolicyRuleMatcher) []map[string]interface{} {
if match.Expr == nil {
return nil
Expand All @@ -454,7 +445,6 @@ func flattenMatchExpr(match *compute.SecurityPolicyRuleMatcher) []map[string]int

return []map[string]interface{}{data}
}
<% end -%>

func resourceSecurityPolicyStateImporter(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
config := meta.(*Config)
Expand Down

0 comments on commit 135aba8

Please sign in to comment.