Skip to content

Commit

Permalink
AA-1837 add only_invocable_on_unresolved_incidents attribute to autom…
Browse files Browse the repository at this point in the history
…ation action
  • Loading branch information
juliannagreen1 committed Oct 30, 2024
1 parent ff3b756 commit aa93eab
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 19 deletions.
5 changes: 5 additions & 0 deletions pagerduty/data_source_pagerduty_automation_actions_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ func dataSourcePagerDutyAutomationActionsAction() *schema.Resource {
Computed: true,
Optional: true,
},
"only_invocable_on_unresolved_incidents": {
Type: schema.TypeBool,
Computed: true,
Optional: true,
},
},
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ resource "pagerduty_automation_actions_action" "test" {
process_automation_job_arguments = "-arg 1"
process_automation_node_filter = "tags: production"
}
only_invocable_on_unresolved_incidents: true
}
data "pagerduty_automation_actions_action" "foo" {
Expand Down
14 changes: 14 additions & 0 deletions pagerduty/resource_pagerduty_automation_actions_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ func resourcePagerDutyAutomationActionsAction() *schema.Resource {
Computed: true,
Optional: true,
},
"only_invocable_on_unresolved_incidents": {
Type: schema.TypeBool,
Computed: true,
Optional: true,
},
},
}
}
Expand Down Expand Up @@ -153,6 +158,11 @@ func buildAutomationActionsActionStruct(d *schema.ResourceData) (*pagerduty.Auto
automationActionsAction.ModifyTime = &val
}

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

return &automationActionsAction, nil
}

Expand Down Expand Up @@ -298,6 +308,10 @@ func resourcePagerDutyAutomationActionsActionRead(d *schema.ResourceData, meta i
if automationActionsAction.ActionClassification != nil {
d.Set("action_classification", &automationActionsAction.ActionClassification)
}

if automationActionsAction.OnlyInvocableOnUnresolvedIncidents != nil {
d.Set("only_invocable_on_unresolved_incidents", &automationActionsAction.OnlyInvocableOnUnresolvedIncidents)
}
}
return nil
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ func TestAccPagerDutyAutomationActionsActionTypeProcessAutomation_Basic(t *testi
resource.TestCheckResourceAttrSet("pagerduty_automation_actions_action.foo", "modify_time"),
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"),
),
},
{
Expand Down Expand Up @@ -84,6 +85,7 @@ func TestAccPagerDutyAutomationActionsActionTypeProcessAutomation_Basic(t *testi
resource.TestCheckResourceAttrSet("pagerduty_automation_actions_action.foo", "modify_time"),
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"),
),
},
},
Expand Down Expand Up @@ -127,6 +129,7 @@ func TestAccPagerDutyAutomationActionsActionTypeScript_Basic(t *testing.T) {
resource.TestCheckResourceAttrSet("pagerduty_automation_actions_action.foo", "modify_time"),
resource.TestCheckNoResourceAttr("pagerduty_automation_actions_action.foo", "runner_type"),
resource.TestCheckNoResourceAttr("pagerduty_automation_actions_action.foo", "runner_id"),
resource.TestCheckNoResourceAttr("pagerduty_automation_actions_action.foo", "only_invocable_on_unresolved_incidents"),
),
},
{
Expand All @@ -152,6 +155,7 @@ func TestAccPagerDutyAutomationActionsActionTypeScript_Basic(t *testing.T) {
resource.TestCheckResourceAttrSet("pagerduty_automation_actions_action.foo", "modify_time"),
resource.TestCheckNoResourceAttr("pagerduty_automation_actions_action.foo", "runner_type"),
resource.TestCheckNoResourceAttr("pagerduty_automation_actions_action.foo", "runner_id"),
resource.TestCheckNoResourceAttr("pagerduty_automation_actions_action.foo", "only_invocable_on_unresolved_incidents"),
),
},
},
Expand Down Expand Up @@ -214,7 +218,8 @@ resource "pagerduty_automation_actions_action" "foo" {
process_automation_job_id = "pa_job_id_123"
process_automation_job_arguments = "-arg 1"
process_automation_node_filter = "tags: production"
}
},
only_invocable_on_unresolved_incidents = "true"
}
`, actionName, actionName)
}
Expand Down

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

7 changes: 4 additions & 3 deletions website/docs/d/automation_actions_action.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ The following attributes are exported:
* `id` - The ID of the action.
* `name` - The name of the action.
* `type` - The type of object. The value returned will be `action`.
* `action_type` - The type of the action. The only allowed values are `process_automation` and `script`.
* `action_type` - The type of the action. The only allowed values are `process_automation` and `script`.
* `creation_time` - The time action was created. Represented as an ISO 8601 timestamp.
* `action_data_reference` - Action Data block. Action Data is documented below.
* `description` - (Optional) The description of the action.
* `runner_id` - (Optional) The Process Automation Actions runner to associate the action with.
* `runner_id` - (Optional) The Process Automation Actions runner to associate the action with.
* `runner_type` - (Optional) The type of the runner associated with the action.
* `action_classification` - (Optional) The category of the action. The only allowed values are `diagnostic` and `remediation`.
* `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.

Action Data (`action_data_reference`) supports the following:

Expand Down
3 changes: 2 additions & 1 deletion website/docs/r/automation_actions_action.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ The following arguments are supported:
* `action_type` - (Required) The type of the action. The only allowed values are `process_automation` and `script`. Cannot be changed once set.
* `action_data_reference` - (Required) Action Data block. Action Data is documented below.
* `runner_id` - (Optional) The Process Automation Actions runner to associate the action with. Cannot be changed for the `process_automation` action type once set.
* `action_classification` - (Optional) The category of the action. The only allowed values are `diagnostic` and `remediation`.
* `action_classification` - (Optional) The category of the action. The only allowed values are `diagnostic` and `remediation`.

Action Data (`action_data_reference`) supports the following:

Expand All @@ -52,6 +52,7 @@ Action Data (`action_data_reference`) supports the following:
* `process_automation_node_filter` - (Optional) The expression that filters on which nodes a Process Automation Job executes [Learn more](https://docs.rundeck.com/docs/manual/05-nodes.html#node-filtering).
* `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.

## Attributes Reference

Expand Down

0 comments on commit aa93eab

Please sign in to comment.