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

AA-1910 #983

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v3.21.1 (February 20, 2025)

FEATURES:

* Add `allow_invocation_manually` and `allow_invocation_from_event_orchestration` to Automation Action's schema

## v3.21.0 (February 17, 2025)

BUG FIXES:
Expand Down Expand Up @@ -1022,14 +1028,14 @@ FEATURES:
IMPROVEMENTS:
* `data_source/pagerduty_user`: Add support for pagination. Gets all users. ([#511](https://github.com/PagerDuty/terraform-provider-pagerduty/pull/511))

BUG FIXES:
BUG FIXES:
* `resource/pagerduty_service_integration`: Fix permadiff in email_parser with type regex & minor docs update ([#479](https://github.com/PagerDuty/terraform-provider-pagerduty/pull/479))

## 2.4.2 (May 20, 2022)

IMPROVEMENTS:
* Acceptance Test Improvements: Use "@foo.test" email addresses in tests. ([#491](https://github.com/PagerDuty/terraform-provider-pagerduty/pull/491))
* Acceptance Test Improvements: Adding better notes to README on running ACC ([#503](https://github.com/PagerDuty/terraform-provider-pagerduty/pull/503))
* Acceptance Test Improvements: Adding better notes to README on running ACC ([#503](https://github.com/PagerDuty/terraform-provider-pagerduty/pull/503))
* `resource/pagerduty_ruleset_rule`: Introduce support for `catch_all` rules. ([#481](https://github.com/PagerDuty/terraform-provider-pagerduty/pull/481))
* Docs: `resource/pagerduty_slack_connection`: Improved notes on resource supporting Slack V2 Next Generation ([#496](https://github.com/PagerDuty/terraform-provider-pagerduty/pull/496))

Expand Down
10 changes: 10 additions & 0 deletions pagerduty/data_source_pagerduty_automation_actions_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ func dataSourcePagerDutyAutomationActionsAction() *schema.Resource {
Computed: true,
Optional: true,
},
"allow_invocation_from_event_orchestration": {
Type: schema.TypeBool,
Computed: true,
Optional: true,
},
"allow_invocation_manually": {
Type: schema.TypeBool,
Computed: true,
Optional: true,
},
},
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ resource "pagerduty_automation_actions_action" "test" {
process_automation_node_filter = "tags: production"
}
only_invocable_on_unresolved_incidents = true
allow_invocation_from_event_orchestration = true
allow_invocation_manually = true
}

data "pagerduty_automation_actions_action" "foo" {
Expand Down
28 changes: 28 additions & 0 deletions pagerduty/resource_pagerduty_automation_actions_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,16 @@ func resourcePagerDutyAutomationActionsAction() *schema.Resource {
Computed: true,
Optional: true,
},
"allow_invocation_manually": {
Type: schema.TypeBool,
Computed: true,
Optional: true,
},
"allow_invocation_from_event_orchestration": {
Type: schema.TypeBool,
Computed: true,
Optional: true,
},
},
}
}
Expand Down Expand Up @@ -166,6 +176,16 @@ func buildAutomationActionsActionStruct(d *schema.ResourceData) (*pagerduty.Auto
attr, _ := d.Get("only_invocable_on_unresolved_incidents").(bool)
automationActionsAction.OnlyInvocableOnUnresolvedIncidents = &attr

if attr, ok := d.GetOk("allow_invocation_manually"); ok {
val := attr.(bool)
automationActionsAction.AllowInvocationManually = &val
}

if attr, ok := d.GetOk("allow_invocation_from_event_orchestration"); ok {
val := attr.(bool)
automationActionsAction.AllowInvocationFromEventOrchestration = &val
}

return &automationActionsAction, nil
}

Expand Down Expand Up @@ -315,6 +335,14 @@ func resourcePagerDutyAutomationActionsActionRead(d *schema.ResourceData, meta i
if automationActionsAction.OnlyInvocableOnUnresolvedIncidents != nil {
d.Set("only_invocable_on_unresolved_incidents", *automationActionsAction.OnlyInvocableOnUnresolvedIncidents)
}

if automationActionsAction.AllowInvocationManually != nil {
d.Set("allow_invocation_manually", *automationActionsAction.AllowInvocationManually)
}

if automationActionsAction.AllowInvocationFromEventOrchestration != nil {
d.Set("allow_invocation_from_event_orchestration", *automationActionsAction.AllowInvocationFromEventOrchestration)
}
}
return nil
})
Expand Down
12 changes: 12 additions & 0 deletions pagerduty/resource_pagerduty_automation_actions_action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ func TestAccPagerDutyAutomationActionsActionTypeProcessAutomation_Basic(t *testi
resource.TestCheckResourceAttrSet("pagerduty_automation_actions_action.foo", "runner_id"),
resource.TestCheckResourceAttr("pagerduty_automation_actions_action.foo", "runner_type", "runbook"),
resource.TestCheckResourceAttr("pagerduty_automation_actions_action.foo", "only_invocable_on_unresolved_incidents", "true"),
resource.TestCheckResourceAttr("pagerduty_automation_actions_action.foo", "allow_invocation_from_event_orchestration", "true"),
resource.TestCheckResourceAttr("pagerduty_automation_actions_action.foo", "allow_invocation_manually", "true"),
),
},
{
Expand Down Expand Up @@ -86,6 +88,8 @@ func TestAccPagerDutyAutomationActionsActionTypeProcessAutomation_Basic(t *testi
resource.TestCheckResourceAttrSet("pagerduty_automation_actions_action.foo", "runner_id"),
resource.TestCheckResourceAttr("pagerduty_automation_actions_action.foo", "runner_type", "runbook"),
resource.TestCheckResourceAttr("pagerduty_automation_actions_action.foo", "only_invocable_on_unresolved_incidents", "false"),
resource.TestCheckResourceAttr("pagerduty_automation_actions_action.foo", "allow_invocation_from_event_orchestration", "false"),
resource.TestCheckResourceAttr("pagerduty_automation_actions_action.foo", "allow_invocation_manually", "false"),
),
},
},
Expand Down Expand Up @@ -130,6 +134,8 @@ func TestAccPagerDutyAutomationActionsActionTypeScript_Basic(t *testing.T) {
resource.TestCheckNoResourceAttr("pagerduty_automation_actions_action.foo", "runner_type"),
resource.TestCheckNoResourceAttr("pagerduty_automation_actions_action.foo", "runner_id"),
resource.TestCheckResourceAttr("pagerduty_automation_actions_action.foo", "only_invocable_on_unresolved_incidents", "false"),
resource.TestCheckResourceAttr("pagerduty_automation_actions_action.foo", "allow_invocation_from_event_orchestration", "false"),
resource.TestCheckResourceAttr("pagerduty_automation_actions_action.foo", "allow_invocation_manually", "false"),
),
},
{
Expand All @@ -156,6 +162,8 @@ func TestAccPagerDutyAutomationActionsActionTypeScript_Basic(t *testing.T) {
resource.TestCheckNoResourceAttr("pagerduty_automation_actions_action.foo", "runner_type"),
resource.TestCheckNoResourceAttr("pagerduty_automation_actions_action.foo", "runner_id"),
resource.TestCheckResourceAttr("pagerduty_automation_actions_action.foo", "only_invocable_on_unresolved_incidents", "false"),
resource.TestCheckResourceAttr("pagerduty_automation_actions_action.foo", "allow_invocation_from_event_orchestration", "false"),
resource.TestCheckResourceAttr("pagerduty_automation_actions_action.foo", "allow_invocation_manually", "false"),
),
},
},
Expand Down Expand Up @@ -220,6 +228,8 @@ resource "pagerduty_automation_actions_action" "foo" {
process_automation_node_filter = "tags: production"
}
only_invocable_on_unresolved_incidents = "true"
allow_invocation_manually = "true"
allow_invocation_from_event_orchestration = "true"
}
`, actionName, actionName)
}
Expand All @@ -245,6 +255,8 @@ resource "pagerduty_automation_actions_action" "foo" {
process_automation_job_id = "updated_pa_job_id_123"
}
only_invocable_on_unresolved_incidents = "false"
allow_invocation_manually = "false"
allow_invocation_from_event_orchestration = "false"
}
`, previousActionName, actionName, actionDescription, actionClassification)
}
Expand Down

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

2 changes: 2 additions & 0 deletions website/docs/d/automation_actions_action.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ The following attributes are exported:
* `action_classification` - (Optional) The category of the action. The only allowed values are `diagnostic` and `remediation`.
* `modify_time` - (Optional) The last time action has been modified. Represented as an ISO 8601 timestamp.
* `only_invocable_on_unresolved_incidents` - (Optional) Whether or not the action can be invoked on unresolved incidents.
* `allow_invocation_manually` - (Optional) Whether or not the action can be invoked manually by a user on the PagerDuty website.
* `allow_invocation_from_event_orchestration` - (Optional) Whether or not the action can be invoked automatically from a PagerDuty Event Orchestration.

Action Data (`action_data_reference`) supports the following:

Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/automation_actions_action.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ Action Data (`action_data_reference`) supports the following:
* `script` - (Required for `script` action_type) Body of the script to be executed on the Runner. Max length is 16777215 characters.
* `invocation_command` - (Optional) The command to execute the script with.
* `only_invocable_on_unresolved_incidents` - (Optional) Whether or not the action can be invoked on unresolved incidents.
* `allow_invocation_manually` - (Optional) Whether or not the action can be invoked manually by a user on the PagerDuty website.
* `allow_invocation_from_event_orchestration` - (Optional) Whether or not the action can be invoked automatically from a PagerDuty Event Orchestration.

## Attributes Reference

Expand Down