Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move expr to GA #3028

Merged
merged 1 commit into from
Jan 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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