Skip to content

Commit

Permalink
Fix perpetual drift in conditions field of integration resource (#446)
Browse files Browse the repository at this point in the history
  • Loading branch information
koushik-swaminathan authored Jul 31, 2024
1 parent 84f47ec commit 09d062c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 9 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
## 0.6.37 (July 30, 2024)
* BUGFIX: [#446](https://github.com/opsgenie/terraform-provider-opsgenie/pull/446)
* **Integration Policy**
* Fixed perpetual time drift in the conditions field in Integration policy
## 0.6.36 (July 7, 2024)
* BUGFIX: [#411](https://github.com/opsgenie/terraform-provider-opsgenie/pulls/411), [#440](https://github.com/opsgenie/terraform-provider-opsgenie/pulls/440)
* **API backoff mechanism**
* Add options to customize the API backoff mechanism
* **Integration Action Policy**
* Fixed integration_action filter conditions field by giving support for extra-properties
* IMPROVEMENTS [#296](https://github.com/opsgenie/terraform-provider-opsgenie/pulls/296)
* **Integration Policy**
* Updated Integration request to allow configuration access flag
## 0.6.35 (December 18, 2023)
* BUGFIX: [#413](https://github.com/opsgenie/terraform-provider-opsgenie/pulls/413), [#416](https://github.com/opsgenie/terraform-provider-opsgenie/pulls/416)
* **time_restriction:**
* Fixed drift for empty time_restriction
* Fixed time_restriction argument in team_routing_rule resource documentation
* IMPROVEMENTS: [#405](https://github.com/opsgenie/terraform-provider-opsgenie/pulls/405)
* **README**
* Update the README setup instructions and Make commands
## 0.6.34 (November 06, 2023)
* BUGFIX: [#404](https://github.com/opsgenie/terraform-provider-opsgenie/pulls/404)
* **Notification Policy:**
Expand Down
18 changes: 9 additions & 9 deletions opsgenie/resource_opsgenie_integration_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func resourceOpsgenieIntegrationAction() *schema.Resource {
ValidateFunc: validation.StringInSlice([]string{"match-all", "match-any-condition", "match-all-conditions"}, false),
},
"conditions": {
Type: schema.TypeList,
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down Expand Up @@ -237,7 +237,7 @@ func resourceOpsgenieIntegrationAction() *schema.Resource {
ValidateFunc: validation.StringInSlice([]string{"match-all", "match-any-condition", "match-all-conditions"}, false),
},
"conditions": {
Type: schema.TypeList,
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down Expand Up @@ -320,7 +320,7 @@ func resourceOpsgenieIntegrationAction() *schema.Resource {
ValidateFunc: validation.StringInSlice([]string{"match-all", "match-any-condition", "match-all-conditions"}, false),
},
"conditions": {
Type: schema.TypeList,
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down Expand Up @@ -403,7 +403,7 @@ func resourceOpsgenieIntegrationAction() *schema.Resource {
ValidateFunc: validation.StringInSlice([]string{"match-all", "match-any-condition", "match-all-conditions"}, false),
},
"conditions": {
Type: schema.TypeList,
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down Expand Up @@ -486,7 +486,7 @@ func resourceOpsgenieIntegrationAction() *schema.Resource {
ValidateFunc: validation.StringInSlice([]string{"match-all", "match-any-condition", "match-all-conditions"}, false),
},
"conditions": {
Type: schema.TypeList,
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down Expand Up @@ -567,20 +567,20 @@ func expandOpsgenieFilter(input []interface{}) integration.Filter {
filter := integration.Filter{}
for _, r := range input {
inputMap := r.(map[string]interface{})
conditions := expandOpsgenieIntegrationConditions(inputMap["conditions"].([]interface{}))
conditions := expandOpsgenieIntegrationConditions(inputMap["conditions"].(*schema.Set))
filter.Conditions = conditions
filter.ConditionMatchType = og.ConditionMatchType(inputMap["type"].(string))
}
return filter
}

func expandOpsgenieIntegrationConditions(input []interface{}) []og.Condition {
conditions := make([]og.Condition, 0, len(input))
func expandOpsgenieIntegrationConditions(input *schema.Set) []og.Condition {
conditions := make([]og.Condition, 0, input.Len())

if input == nil {
return conditions
}
for _, v := range input {
for _, v := range input.List() {
inputMap := v.(map[string]interface{})
condition := og.Condition{}
key := inputMap["key"].(string)
Expand Down

0 comments on commit 09d062c

Please sign in to comment.