Skip to content

Commit

Permalink
adding policy irule fix
Browse files Browse the repository at this point in the history
  • Loading branch information
RavinderReddyF5 committed Aug 25, 2023
1 parent 151fd97 commit 5e2cabc
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 15 deletions.
9 changes: 9 additions & 0 deletions bigip/resource_bigip_ltm_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)

Check failure on line 1293 in bigip/resource_bigip_ltm_policy.go

View workflow job for this annotation

GitHub Actions / golint

polRule.Description undefined (type "github.com/f5devcentral/go-bigip".PolicyRule has no field or method Description)

Check failure on line 1293 in bigip/resource_bigip_ltm_policy.go

View workflow job for this annotation

GitHub Actions / golint

polRule.Description undefined (type "github.com/f5devcentral/go-bigip".PolicyRule has no field or method Description)
var policyRulesActions []bigip.PolicyRuleAction
for _, itemAction := range item.(map[string]interface{})["action"].([]interface{}) {
var a bigip.PolicyRuleAction
Expand Down Expand Up @@ -1403,6 +1409,9 @@ func flattenPolicyRules(rules []bigip.PolicyRule) []interface{} {
if v.Name != "" {
obj["name"] = v.Name
}
if v.Description != "" {

Check failure on line 1412 in bigip/resource_bigip_ltm_policy.go

View workflow job for this annotation

GitHub Actions / golint

v.Description undefined (type "github.com/f5devcentral/go-bigip".PolicyRule has no field or method Description)

Check failure on line 1412 in bigip/resource_bigip_ltm_policy.go

View workflow job for this annotation

GitHub Actions / golint

v.Description undefined (type "github.com/f5devcentral/go-bigip".PolicyRule has no field or method Description)
obj["description"] = v.Description

Check failure on line 1413 in bigip/resource_bigip_ltm_policy.go

View workflow job for this annotation

GitHub Actions / golint

v.Description undefined (type "github.com/f5devcentral/go-bigip".PolicyRule has no field or method Description)) (typecheck)

Check failure on line 1413 in bigip/resource_bigip_ltm_policy.go

View workflow job for this annotation

GitHub Actions / golint

v.Description undefined (type "github.com/f5devcentral/go-bigip".PolicyRule has no field or method Description) (typecheck)
}

if len(v.Actions) > 0 {
r := flattenPolicyRuleActions(v.Actions)
Expand Down
4 changes: 1 addition & 3 deletions docs/resources/bigip_ltm_policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions examples/bigip_ltm_policy_issue794.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 16 additions & 12 deletions vendor/github.com/f5devcentral/go-bigip/ltm.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5e2cabc

Please sign in to comment.