Skip to content

Commit

Permalink
Merge pull request #855 from F5Networks/devel_25082023_policy_irule_fix
Browse files Browse the repository at this point in the history
adding policy irule fix
  • Loading branch information
RavinderReddyF5 authored Aug 25, 2023
2 parents 151fd97 + 1906992 commit 1307d7b
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 23 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)
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 != "" {
obj["description"] = v.Description
}

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
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ require (
github.com/Azure/azure-storage-blob-go v0.13.0
github.com/Azure/go-autorest/autorest v0.11.18
github.com/Azure/go-autorest/autorest/adal v0.9.13
github.com/f5devcentral/go-bigip v0.0.0-20230824164833-0e0156dbe878
github.com/f5devcentral/go-bigip/f5teem v0.0.0-20230824164833-0e0156dbe878
github.com/f5devcentral/go-bigip v0.0.0-20230825175646-ebe63e33298c
github.com/f5devcentral/go-bigip/f5teem v0.0.0-20230825175646-ebe63e33298c
github.com/google/uuid v1.3.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.25.0
github.com/stretchr/testify v1.8.4
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -480,10 +480,10 @@ github.com/envoyproxy/go-control-plane v0.10.3/go.mod h1:fJJn/j26vwOu972OllsvAgJ
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/envoyproxy/protoc-gen-validate v0.6.7/go.mod h1:dyJXwwfPK2VSqiB9Klm1J6romD608Ba7Hij42vrOBCo=
github.com/envoyproxy/protoc-gen-validate v0.9.1/go.mod h1:OKNgG7TCp5pF4d6XftA0++PMirau2/yoOwVac3AbF2w=
github.com/f5devcentral/go-bigip v0.0.0-20230824164833-0e0156dbe878 h1:+n4ejONpTYfIkRsnKSpR7sEoYWknBRuZKfRmJp0mWCc=
github.com/f5devcentral/go-bigip v0.0.0-20230824164833-0e0156dbe878/go.mod h1:JZj/iVxDmEnGPyEwuNj7x0fuH2CtUBbD2J48MMp/SE8=
github.com/f5devcentral/go-bigip/f5teem v0.0.0-20230824164833-0e0156dbe878 h1:NiDT+oH4wnaiNKsMLCVPr0zsmogw2qid7jub0ljzU10=
github.com/f5devcentral/go-bigip/f5teem v0.0.0-20230824164833-0e0156dbe878/go.mod h1:r7o5I22EvO+fps2u10bz4ZUlTlNHopQSWzVcW19hK3U=
github.com/f5devcentral/go-bigip v0.0.0-20230825175646-ebe63e33298c h1:T9+v2O4pFkDjASOoPhSOoBKU5BhqIDg1ndZg1sGjLxs=
github.com/f5devcentral/go-bigip v0.0.0-20230825175646-ebe63e33298c/go.mod h1:JZj/iVxDmEnGPyEwuNj7x0fuH2CtUBbD2J48MMp/SE8=
github.com/f5devcentral/go-bigip/f5teem v0.0.0-20230825175646-ebe63e33298c h1:CxHMUixpOiK00IvO1ql2hEa5QPLfiV+/zy/izf98eGM=
github.com/f5devcentral/go-bigip/f5teem v0.0.0-20230825175646-ebe63e33298c/go.mod h1:r7o5I22EvO+fps2u10bz4ZUlTlNHopQSWzVcW19hK3U=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
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.

4 changes: 2 additions & 2 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ github.com/apparentlymart/go-textseg/v13/textseg
# github.com/davecgh/go-spew v1.1.1
## explicit
github.com/davecgh/go-spew/spew
# github.com/f5devcentral/go-bigip v0.0.0-20230824164833-0e0156dbe878
# github.com/f5devcentral/go-bigip v0.0.0-20230825175646-ebe63e33298c
## explicit
github.com/f5devcentral/go-bigip
# github.com/f5devcentral/go-bigip/f5teem v0.0.0-20230824164833-0e0156dbe878
# github.com/f5devcentral/go-bigip/f5teem v0.0.0-20230825175646-ebe63e33298c
## explicit; go 1.13
github.com/f5devcentral/go-bigip/f5teem
# github.com/fatih/color v1.13.0
Expand Down

0 comments on commit 1307d7b

Please sign in to comment.