-
Notifications
You must be signed in to change notification settings - Fork 216
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
[ORCA-3463] Orchestration Path Router Resource #493
[ORCA-3463] Orchestration Path Router Resource #493
Conversation
490486e
to
3ef1d80
Compare
3ef1d80
to
eb73b4a
Compare
95ae983
to
fd10926
Compare
fd10926
to
547d4e5
Compare
8f00542
to
0979f81
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some potential blockers that we haven't discussed that we may need to resolve for all the path types. We can pair/mob on them to figure out what we want to do
pagerduty/resource_pagerduty_event_orchestration_path_router.go
Outdated
Show resolved
Hide resolved
} | ||
|
||
return resource.Retry(2*time.Minute, func() *resource.RetryError { | ||
path := buildRouterPathParent(d) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a BLOCKER BLOCKER but good to fix: TF reads a resource after it's created and the ID is assigned so I don't think we need to build the path
here if it's only used in client.EventOrchestrationPaths.Get(path.Parent.ID, "router")
, we can just call Get()
with d.Id():
client.EventOrchestrationPaths.Get(d.Id(), "router")
pagerduty/resource_pagerduty_event_orchestration_path_router.go
Outdated
Show resolved
Hide resolved
if attr, ok := d.GetOk("sets"); ok { | ||
orchPath.Sets = expandSets(attr.([]interface{})) | ||
} | ||
|
||
if attr, ok := d.GetOk("catch_all"); ok { | ||
orchPath.CatchAll = expandCatchAll(attr.([]interface{})) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a blocker: Do we need to convert attr to a slice here: attr.([]interface{})
? Ca we drop the conversion since we're converting it in expandSets
and expandCatchAll
again?
Type: p["type"].(string), | ||
Self: p["self"].(string), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a blocker: if Type
and Self
are computed we don't need to send them to the API
} | ||
|
||
func expandRouterConditions(v interface{}) []*pagerduty.EventOrchestrationPathRuleCondition { | ||
var conditions []*pagerduty.EventOrchestrationPathRuleCondition |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocker: I think we may have to do the same thing here as we did with the rules - if a user wants to delete conditions we need to explicitly send them as an empty list. And we should probably add a test for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
conditions are cleared if not supplied I think. In test step 3 conditions are added, step 4 more conditions are added, step 6, they are cleared. Resultant file is here. Does that cover the case?
CheckDestroy: testAccCheckPagerDutyEventOrchestrationPathDestroy, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccCheckPagerDutyEventOrchestrationPathConfigNoRules(team, escalation_policy, service, orchestration), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a blocker: should we have the word "router" present in function names, maybe instead of "path"? Because we are going to have similar tests for unrouted and service paths
resource "pagerduty_user" "foo" { | ||
name = "user" | ||
email = "user@pagerduty.com" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the user have the name prefixed with tf-
in order for the sweeper to delete it?
* router path * Add support for parent * refactor * update handler and actions support * support conditions * move conditions to util * move parent to util * test for multiple rules and conditions * actions and catchall * refactor tests * validateFunc * refactor * undo local vendor module path change * rules schema change and test * PR comments addressed
* ORCA-3459 - event orchestration resource * reformat * [REVERT LATER] Temporarily pointing to the local copy of go-pagerduty * rename Orchestration references to EventOrchestration * add more properties, mapping logic; add tests * more tests to event_orchestration_resource * add datasource event orchestration * [REVERT LATER]-local testing * fix create logic (set integrations), remove description and routes from orchestration data source * fix data source, add data source tests * reformat * Add import tests * update to latest alenapan/go-pagerduty * add team checks to the tests * [ORCA-3475] Allow deleting event orchestration team from an orchestration (#494) * support unsetting orch team * add retry logic to the event orchestration update method * [ORCA-3463] Orchestration Path Router Resource (#493) * router path * Add support for parent * refactor * update handler and actions support * support conditions * move conditions to util * move parent to util * test for multiple rules and conditions * actions and catchall * refactor tests * validateFunc * refactor * undo local vendor module path change * rules schema change and test * PR comments addressed * Event orchestration unrouted resource (#495) * Init commit for unrouted * Added tests for unrouted * Added catch_all to unrouted schema * Tweaked catch_all * Merge event-orchestrations * Add testacc for unrouted * Added full config test for unrouted * Add test for number of extractions and variables * Cleaned router and added new test checks to unrouted * Change escalation_policy from snake case to camel case * make type computed and set it on read/update * Orca 3486 refactor (#500) * Clean sweeper function for router/unrouted * Clean sweeper function * [ORCA-3465] - Event Orchestration Service path resource (#499) * ORCA-3465 - Event Orchestration Service Path resource * add resource file * fix read/update, add test * more tests * more service path tests, add conditions * more tests * more tests * add more service path props * fix orch path PUT payload, add tests * fix Suspend * ToDos * add catch_all support, fix tests * add support for regex extractions, add mor tests, add service path import test * update client * PR feedback * Flatten teams block (#506) * Flatten teams block * Fixed naming for the test orchestration * ORCA-3486 - remove team attribute from service path * flatten/rename parent to 'service' for service path * remove type attribute from unrouted * remove type attribute from router * flatten/rename parent to 'event_orchestration' for router * set event_orchestration attr on router import * flatten/rename parent to 'event_orchestration' for unrouted * Clean teams block * revert changes on web file * [ORCA-3486] - Reuse shared Event Orchestration Path logic, add import tests (#509) * ORCA-3486 - add import tests for router/unrouted * ORCA-3486 - add import tests for router, unrouted * reuse severity/event_action validation functions in unrouted/service * reuse variables and extractions schema in router/unrouted * reuse shared conditions schema and mapping functions in router/unrouted/service * [ORCA-3486] Extend unrouted tests, add CustomizeDiff, clean shared functions (#510) * Extend unrouted tests, add CustomizeDiff, clean shared functions * Move shared functions for unrouted and service paths to utils file * orchestration and path resource documentation * datasource documentation * refactor * update comment * update type field documentation * update documentation * cleanup * Remove mention of the suppress action from event_orchestration_unrouted docs * Add "Optional" info to 1 attribute in event_orchestration_service docs * give a better datasource example * cleanup * Add Event Orchestration info to the CHANGELOG (release date TBD) (#514) * update go-pagerduty package * Router - make sets, rules, conditions singular * Unrouted, Service - make sets, rules, conditions, variables, extractions, pd_automation_actions, automations_action (headers, params) singular * Event Orchestration - make integrations singular * update Event Orchestration documentation * EO data source - retry on any error * EO data source - retry on any error Co-authored-by: Pari Dhanakoti <pdhanakoti@pagerduty.com> Co-authored-by: Alex Zakabluk <azakabluk@pagerduty.com> Co-authored-by: Marcos Wright-Kuhns <webmaster@wrightkuhns.com> Co-authored-by: Scott McAllister <smcallister@pagerduty.com>
* ORCA-3459 - event orchestration resource * reformat * [REVERT LATER] Temporarily pointing to the local copy of go-pagerduty * rename Orchestration references to EventOrchestration * add more properties, mapping logic; add tests * more tests to event_orchestration_resource * add datasource event orchestration * [REVERT LATER]-local testing * fix create logic (set integrations), remove description and routes from orchestration data source * fix data source, add data source tests * reformat * Add import tests * update to latest alenapan/go-pagerduty * add team checks to the tests * [ORCA-3475] Allow deleting event orchestration team from an orchestration (#494) * support unsetting orch team * add retry logic to the event orchestration update method * [ORCA-3463] Orchestration Path Router Resource (#493) * router path * Add support for parent * refactor * update handler and actions support * support conditions * move conditions to util * move parent to util * test for multiple rules and conditions * actions and catchall * refactor tests * validateFunc * refactor * undo local vendor module path change * rules schema change and test * PR comments addressed * Event orchestration unrouted resource (#495) * Init commit for unrouted * Added tests for unrouted * Added catch_all to unrouted schema * Tweaked catch_all * Merge event-orchestrations * Add testacc for unrouted * Added full config test for unrouted * Add test for number of extractions and variables * Cleaned router and added new test checks to unrouted * Change escalation_policy from snake case to camel case * make type computed and set it on read/update * Orca 3486 refactor (#500) * Clean sweeper function for router/unrouted * Clean sweeper function * [ORCA-3465] - Event Orchestration Service path resource (#499) * ORCA-3465 - Event Orchestration Service Path resource * add resource file * fix read/update, add test * more tests * more service path tests, add conditions * more tests * more tests * add more service path props * fix orch path PUT payload, add tests * fix Suspend * ToDos * add catch_all support, fix tests * add support for regex extractions, add mor tests, add service path import test * update client * PR feedback * Flatten teams block (#506) * Flatten teams block * Fixed naming for the test orchestration * ORCA-3486 - remove team attribute from service path * flatten/rename parent to 'service' for service path * remove type attribute from unrouted * remove type attribute from router * flatten/rename parent to 'event_orchestration' for router * set event_orchestration attr on router import * flatten/rename parent to 'event_orchestration' for unrouted * Clean teams block * revert changes on web file * [ORCA-3486] - Reuse shared Event Orchestration Path logic, add import tests (#509) * ORCA-3486 - add import tests for router/unrouted * ORCA-3486 - add import tests for router, unrouted * reuse severity/event_action validation functions in unrouted/service * reuse variables and extractions schema in router/unrouted * reuse shared conditions schema and mapping functions in router/unrouted/service * [ORCA-3486] Extend unrouted tests, add CustomizeDiff, clean shared functions (#510) * Extend unrouted tests, add CustomizeDiff, clean shared functions * Move shared functions for unrouted and service paths to utils file * orchestration and path resource documentation * datasource documentation * refactor * update comment * update type field documentation * update documentation * cleanup * Remove mention of the suppress action from event_orchestration_unrouted docs * Add "Optional" info to 1 attribute in event_orchestration_service docs * give a better datasource example * cleanup * Add Event Orchestration info to the CHANGELOG (release date TBD) (#514) * update go-pagerduty package * Router - make sets, rules, conditions singular * Unrouted, Service - make sets, rules, conditions, variables, extractions, pd_automation_actions, automations_action (headers, params) singular * Event Orchestration - make integrations singular * update Event Orchestration documentation * EO data source - retry on any error * EO data source - retry on any error Co-authored-by: Pari Dhanakoti <pdhanakoti@pagerduty.com> Co-authored-by: Alex Zakabluk <azakabluk@pagerduty.com> Co-authored-by: Marcos Wright-Kuhns <webmaster@wrightkuhns.com> Co-authored-by: Scott McAllister <smcallister@pagerduty.com>
* ORCA-3459 - event orchestration resource * reformat * [REVERT LATER] Temporarily pointing to the local copy of go-pagerduty * rename Orchestration references to EventOrchestration * add more properties, mapping logic; add tests * more tests to event_orchestration_resource * add datasource event orchestration * [REVERT LATER]-local testing * fix create logic (set integrations), remove description and routes from orchestration data source * fix data source, add data source tests * reformat * Add import tests * update to latest alenapan/go-pagerduty * add team checks to the tests * [ORCA-3475] Allow deleting event orchestration team from an orchestration (#494) * support unsetting orch team * add retry logic to the event orchestration update method * [ORCA-3463] Orchestration Path Router Resource (#493) * router path * Add support for parent * refactor * update handler and actions support * support conditions * move conditions to util * move parent to util * test for multiple rules and conditions * actions and catchall * refactor tests * validateFunc * refactor * undo local vendor module path change * rules schema change and test * PR comments addressed * Event orchestration unrouted resource (#495) * Init commit for unrouted * Added tests for unrouted * Added catch_all to unrouted schema * Tweaked catch_all * Merge event-orchestrations * Add testacc for unrouted * Added full config test for unrouted * Add test for number of extractions and variables * Cleaned router and added new test checks to unrouted * Change escalation_policy from snake case to camel case * make type computed and set it on read/update * Orca 3486 refactor (#500) * Clean sweeper function for router/unrouted * Clean sweeper function * [ORCA-3465] - Event Orchestration Service path resource (#499) * ORCA-3465 - Event Orchestration Service Path resource * add resource file * fix read/update, add test * more tests * more service path tests, add conditions * more tests * more tests * add more service path props * fix orch path PUT payload, add tests * fix Suspend * ToDos * add catch_all support, fix tests * add support for regex extractions, add mor tests, add service path import test * update client * PR feedback * Flatten teams block (#506) * Flatten teams block * Fixed naming for the test orchestration * ORCA-3486 - remove team attribute from service path * flatten/rename parent to 'service' for service path * remove type attribute from unrouted * remove type attribute from router * flatten/rename parent to 'event_orchestration' for router * set event_orchestration attr on router import * flatten/rename parent to 'event_orchestration' for unrouted * Clean teams block * revert changes on web file * [ORCA-3486] - Reuse shared Event Orchestration Path logic, add import tests (#509) * ORCA-3486 - add import tests for router/unrouted * ORCA-3486 - add import tests for router, unrouted * reuse severity/event_action validation functions in unrouted/service * reuse variables and extractions schema in router/unrouted * reuse shared conditions schema and mapping functions in router/unrouted/service * [ORCA-3486] Extend unrouted tests, add CustomizeDiff, clean shared functions (#510) * Extend unrouted tests, add CustomizeDiff, clean shared functions * Move shared functions for unrouted and service paths to utils file * orchestration and path resource documentation * datasource documentation * refactor * update comment * update type field documentation * update documentation * cleanup * Remove mention of the suppress action from event_orchestration_unrouted docs * Add "Optional" info to 1 attribute in event_orchestration_service docs * give a better datasource example * cleanup * Add Event Orchestration info to the CHANGELOG (release date TBD) (#514) * update go-pagerduty package * Router - make sets, rules, conditions singular * Unrouted, Service - make sets, rules, conditions, variables, extractions, pd_automation_actions, automations_action (headers, params) singular * Event Orchestration - make integrations singular * update Event Orchestration documentation * EO data source - retry on any error * EO data source - retry on any error Co-authored-by: Pari Dhanakoti <pdhanakoti@pagerduty.com> Co-authored-by: Alex Zakabluk <azakabluk@pagerduty.com> Co-authored-by: Marcos Wright-Kuhns <webmaster@wrightkuhns.com> Co-authored-by: Scott McAllister <smcallister@pagerduty.com>
Adds a router orchestration resource. Test router resource created by the 4 steps described in test file is here