Skip to content
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

Feat/add iw inline steps inputs support #768

Conversation

brandonw
Copy link
Contributor

@brandonw brandonw commented Nov 10, 2023

This update brings support for using inline_steps_inputs when building Incident Workflows. inline_steps_inputs are specialized inputs of certain Actions that can be identified by looking for `@metadata.format="inlineSteps".

These specialized inputs diverge from the standard value format of string, and instead are composed of a specific schema that allows inline steps to be configured. This allows for a series of inline steps to be executed conditionally, or within a loop, while still being defined as part of a single workflow.

I have also included several fixes for configured workflows with inputs that have default values, or are ordered differently from the canonical action input ordering. These changes will prevent plan diffs from always existing, even after having just applied the current config.

Test cases were extended for both IncidentWorkflow and IncidentWorkflowTrigger:

$ PAGERDUTY_ACC_INCIDENT_WORKFLOWS=1 make testacc TESTARGS="-run IncidentWorkflow"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run IncidentWorkflow -timeout 120m
?   	github.com/terraform-providers/terraform-provider-pagerduty	[no test files]
=== RUN   TestAccDataSourcePagerDutyIncidentWorkflow
--- PASS: TestAccDataSourcePagerDutyIncidentWorkflow (8.33s)
=== RUN   TestAccDataSourcePagerDutyIncidentWorkflow_Missing
--- PASS: TestAccDataSourcePagerDutyIncidentWorkflow_Missing (1.51s)
=== RUN   TestAccPagerDutyIncidentWorkflow_import
--- PASS: TestAccPagerDutyIncidentWorkflow_import (6.61s)
=== RUN   TestAccPagerDutyIncidentWorkflowTrigger_import
--- PASS: TestAccPagerDutyIncidentWorkflowTrigger_import (15.93s)
=== RUN   TestAccPagerDutyIncidentWorkflow_Basic
--- PASS: TestAccPagerDutyIncidentWorkflow_Basic (10.48s)
=== RUN   TestAccPagerDutyIncidentWorkflow_Team
--- PASS: TestAccPagerDutyIncidentWorkflow_Team (7.98s)
=== RUN   TestAccPagerDutyIncidentWorkflow_InlineInputs
--- PASS: TestAccPagerDutyIncidentWorkflow_InlineInputs (10.30s)
=== RUN   TestFlattenIncidentWorkflowStepsOneGenerated
--- PASS: TestFlattenIncidentWorkflowStepsOneGenerated (0.00s)
=== RUN   TestAccPagerDutyIncidentWorkflowTrigger_BadType
--- PASS: TestAccPagerDutyIncidentWorkflowTrigger_BadType (1.10s)
=== RUN   TestAccPagerDutyIncidentWorkflowTrigger_ConditionWithManualType
--- PASS: TestAccPagerDutyIncidentWorkflowTrigger_ConditionWithManualType (1.09s)
=== RUN   TestAccPagerDutyIncidentWorkflowTrigger_ConditionalTypeWithoutCondition
--- PASS: TestAccPagerDutyIncidentWorkflowTrigger_ConditionalTypeWithoutCondition (1.09s)
=== RUN   TestAccPagerDutyIncidentWorkflowTrigger_SubscribedToAllWithInvalidServices
--- PASS: TestAccPagerDutyIncidentWorkflowTrigger_SubscribedToAllWithInvalidServices (1.08s)
=== RUN   TestAccPagerDutyIncidentWorkflowTrigger_BasicManual
--- PASS: TestAccPagerDutyIncidentWorkflowTrigger_BasicManual (13.52s)
=== RUN   TestAccPagerDutyIncidentWorkflowTrigger_BasicConditionalAllServices
--- PASS: TestAccPagerDutyIncidentWorkflowTrigger_BasicConditionalAllServices (9.97s)
=== RUN   TestAccPagerDutyIncidentWorkflowTrigger_CannotChangeType
--- PASS: TestAccPagerDutyIncidentWorkflowTrigger_CannotChangeType (13.27s)
PASS
ok  	github.com/terraform-providers/terraform-provider-pagerduty/pagerduty	102.852s

Merging depends on heimweh/go-pagerduty#141

@brandonw brandonw force-pushed the feat/add-iw-inline-steps-inputs-support branch from 9f2590d to befe99b Compare November 10, 2023 20:55
@brandonw brandonw marked this pull request as ready for review November 10, 2023 21:11
Copy link
Contributor

@imjaroiswebdev imjaroiswebdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order for the unit tests to run without issues, please introduce a module replacement pointing to the HEAD of your version of go-pagerduty with latest changes.

I left a few comments, which should be addressed first to proceed with merge.

Copy link
Contributor

@imjaroiswebdev imjaroiswebdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @brandonw. Thank you! Inline Inputs enhancement to Incident Workflows will be pretty appreciated by PagerDuty Terraform provider users 🎉 🥳

@imjaroiswebdev imjaroiswebdev marked this pull request as draft November 29, 2023 21:15
@brandonw brandonw force-pushed the feat/add-iw-inline-steps-inputs-support branch 2 times, most recently from a721945 to b4cb42c Compare December 1, 2023 16:58
@brandonw brandonw force-pushed the feat/add-iw-inline-steps-inputs-support branch from b4cb42c to f2f3363 Compare December 1, 2023 17:05
@brandonw brandonw marked this pull request as ready for review December 1, 2023 17:11
@imjaroiswebdev imjaroiswebdev merged commit a6aba6a into PagerDuty:master Dec 1, 2023
1 check passed
@brandonw brandonw deleted the feat/add-iw-inline-steps-inputs-support branch December 1, 2023 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants