diff --git a/bigip/resource_bigip_ltm_policy.go b/bigip/resource_bigip_ltm_policy.go index 6e4c8daab..99e34459c 100644 --- a/bigip/resource_bigip_ltm_policy.go +++ b/bigip/resource_bigip_ltm_policy.go @@ -92,6 +92,11 @@ func resourceBigipLtmPolicy() *schema.Resource { Required: true, Description: "Rule name", }, + "description": { + Type: schema.TypeString, + Optional: true, + Description: "Specifies descriptive text that identifies the irule attached to policy.", + }, "action": { Type: schema.TypeList, Optional: true, @@ -1285,6 +1290,7 @@ func dataToPolicy(name string, d *schema.ResourceData) bigip.Policy { var polRule bigip.PolicyRule for _, item := range val.([]interface{}) { polRule.Name = item.(map[string]interface{})["name"].(string) + polRule.Description = item.(map[string]interface{})["description"].(string) var policyRulesActions []bigip.PolicyRuleAction for _, itemAction := range item.(map[string]interface{})["action"].([]interface{}) { var a bigip.PolicyRuleAction @@ -1403,6 +1409,9 @@ func flattenPolicyRules(rules []bigip.PolicyRule) []interface{} { if v.Name != "" { obj["name"] = v.Name } + if v.Description != "" { + obj["description"] = v.Description + } if len(v.Actions) > 0 { r := flattenPolicyRuleActions(v.Actions) diff --git a/docs/resources/bigip_ltm_policy.md b/docs/resources/bigip_ltm_policy.md index 11c71733f..633466cc0 100644 --- a/docs/resources/bigip_ltm_policy.md +++ b/docs/resources/bigip_ltm_policy.md @@ -54,11 +54,9 @@ resource "bigip_ltm_policy" "test-policy" { * `controls` - (Optional) Specifies the controls * `rule` - (Optional,type `list`) List of Rules can be applied using the policy. Each rule is block type with following arguments. - * `name` - (Required,type `string`) Name of Rule to be applied in policy. - + * `description` - (Optional) Specifies descriptive text that identifies the irule attached to policy. * `condition` - (Optional,type `set`) Block type. See [condition](#condition) block for more details. - * `action` - (Optional,type `set`) Block type. See [action](#action) block for more details. * `forward` - (Optional) This action will affect forwarding. diff --git a/examples/bigip_ltm_policy_issue794.tf b/examples/bigip_ltm_policy_issue794.tf index 644c10d3b..c19a4be9c 100644 --- a/examples/bigip_ltm_policy_issue794.tf +++ b/examples/bigip_ltm_policy_issue794.tf @@ -145,6 +145,7 @@ resource "bigip_ltm_policy" "policy_issue_838_tc1" { controls = ["forwarding"] rule { name = "rule6" + description = "rule6-create" action { forward = true connection = false diff --git a/vendor/github.com/f5devcentral/go-bigip/ltm.go b/vendor/github.com/f5devcentral/go-bigip/ltm.go index ab2b370e2..b0e626d57 100644 --- a/vendor/github.com/f5devcentral/go-bigip/ltm.go +++ b/vendor/github.com/f5devcentral/go-bigip/ltm.go @@ -747,18 +747,20 @@ type PolicyRules struct { } type PolicyRule struct { - Name string - FullPath string - Ordinal int - Conditions []PolicyRuleCondition - Actions []PolicyRuleAction + Name string + FullPath string + Ordinal int + Description string + Conditions []PolicyRuleCondition + Actions []PolicyRuleAction } type policyRuleDTO struct { - Name string `json:"name"` - Ordinal int `json:"ordinal"` - FullPath string `json:"fullPath,omitempty"` - Conditions struct { + Name string `json:"name"` + Ordinal int `json:"ordinal"` + FullPath string `json:"fullPath,omitempty"` + Description string `json:"description,omitempty"` + Conditions struct { Items []PolicyRuleCondition `json:"items,omitempty"` } `json:"conditionsReference,omitempty"` Actions struct { @@ -768,9 +770,10 @@ type policyRuleDTO struct { func (p *PolicyRule) MarshalJSON() ([]byte, error) { return json.Marshal(policyRuleDTO{ - Name: p.Name, - Ordinal: p.Ordinal, - FullPath: p.FullPath, + Name: p.Name, + Ordinal: p.Ordinal, + FullPath: p.FullPath, + Description: p.Description, Conditions: struct { Items []PolicyRuleCondition `json:"items,omitempty"` }{Items: p.Conditions}, @@ -792,6 +795,7 @@ func (p *PolicyRule) UnmarshalJSON(b []byte) error { p.Actions = dto.Actions.Items p.Conditions = dto.Conditions.Items p.FullPath = dto.FullPath + p.Description = dto.Description return nil }