diff --git a/pagerduty/data_source_pagerduty_automation_actions_action.go b/pagerduty/data_source_pagerduty_automation_actions_action.go index f977beed4..e08af93ba 100644 --- a/pagerduty/data_source_pagerduty_automation_actions_action.go +++ b/pagerduty/data_source_pagerduty_automation_actions_action.go @@ -99,6 +99,11 @@ func dataSourcePagerDutyAutomationActionsAction() *schema.Resource { Computed: true, Optional: true, }, + "map_to_all_services": { + Type: schema.TypeBool, + Computed: true, + Optional: true, + }, }, } } diff --git a/pagerduty/data_source_pagerduty_automation_actions_action_test.go b/pagerduty/data_source_pagerduty_automation_actions_action_test.go index d44cfdfb1..aeecd6cc6 100644 --- a/pagerduty/data_source_pagerduty_automation_actions_action_test.go +++ b/pagerduty/data_source_pagerduty_automation_actions_action_test.go @@ -76,6 +76,7 @@ resource "pagerduty_automation_actions_action" "test" { process_automation_node_filter = "tags: production" } only_invocable_on_unresolved_incidents = true + map_to_all_services = true } data "pagerduty_automation_actions_action" "foo" { diff --git a/pagerduty/resource_pagerduty_automation_actions_action.go b/pagerduty/resource_pagerduty_automation_actions_action.go index 2384f3860..5ea5e9116 100644 --- a/pagerduty/resource_pagerduty_automation_actions_action.go +++ b/pagerduty/resource_pagerduty_automation_actions_action.go @@ -104,6 +104,11 @@ func resourcePagerDutyAutomationActionsAction() *schema.Resource { Computed: true, Optional: true, }, + "map_to_all_services": { + Type: schema.TypeBool, + Computed: true, + Optional: true, + }, }, } } @@ -166,6 +171,14 @@ func buildAutomationActionsActionStruct(d *schema.ResourceData) (*pagerduty.Auto attr, _ := d.Get("only_invocable_on_unresolved_incidents").(bool) automationActionsAction.OnlyInvocableOnUnresolvedIncidents = &attr + if attr, ok := d.GetOk("map_to_all_services"); ok { + val := attr.(bool) + automationActionsAction.MapToAllServices = &val + } + + attr2, _ := d.Get("map_to_all_services").(bool) + automationActionsAction.MapToAllServices = &attr2 + return &automationActionsAction, nil } @@ -315,6 +328,10 @@ func resourcePagerDutyAutomationActionsActionRead(d *schema.ResourceData, meta i if automationActionsAction.OnlyInvocableOnUnresolvedIncidents != nil { d.Set("only_invocable_on_unresolved_incidents", *automationActionsAction.OnlyInvocableOnUnresolvedIncidents) } + + if automationActionsAction.MapToAllServices != nil { + d.Set("map_to_all_services", *automationActionsAction.MapToAllServices) + } } return nil }) diff --git a/pagerduty/resource_pagerduty_automation_actions_action_test.go b/pagerduty/resource_pagerduty_automation_actions_action_test.go index 94e312d43..7ccb83530 100644 --- a/pagerduty/resource_pagerduty_automation_actions_action_test.go +++ b/pagerduty/resource_pagerduty_automation_actions_action_test.go @@ -58,6 +58,7 @@ 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", "map_to_all_services", "true"), ), }, { @@ -86,6 +87,7 @@ 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", "map_to_all_services", "false"), ), }, }, @@ -130,6 +132,7 @@ 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", "map_to_all_services", "false"), ), }, { @@ -156,6 +159,7 @@ 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", "map_to_all_services", "false"), ), }, }, @@ -220,6 +224,7 @@ resource "pagerduty_automation_actions_action" "foo" { process_automation_node_filter = "tags: production" } only_invocable_on_unresolved_incidents = "true" + map_to_all_services = "true" } `, actionName, actionName) } @@ -245,6 +250,7 @@ resource "pagerduty_automation_actions_action" "foo" { process_automation_job_id = "updated_pa_job_id_123" } only_invocable_on_unresolved_incidents = "false" + map_to_all_services = "false" } `, previousActionName, actionName, actionDescription, actionClassification) } diff --git a/vendor/github.com/heimweh/go-pagerduty/pagerduty/automation_actions_action.go b/vendor/github.com/heimweh/go-pagerduty/pagerduty/automation_actions_action.go index 65ab7d850..ef1736999 100644 --- a/vendor/github.com/heimweh/go-pagerduty/pagerduty/automation_actions_action.go +++ b/vendor/github.com/heimweh/go-pagerduty/pagerduty/automation_actions_action.go @@ -22,6 +22,7 @@ type AutomationActionsAction struct { CreationTime *string `json:"creation_time,omitempty"` ModifyTime *string `json:"modify_time,omitempty"` OnlyInvocableOnUnresolvedIncidents *bool `json:"only_invocable_on_unresolved_incidents,omitempty"` + MapToAllServices *bool `json:"map_to_all_services,omitempty"` } type AutomationActionsActionDataReference struct { diff --git a/website/docs/d/automation_actions_action.html.markdown b/website/docs/d/automation_actions_action.html.markdown index 9b50201c8..08750ceba 100644 --- a/website/docs/d/automation_actions_action.html.markdown +++ b/website/docs/d/automation_actions_action.html.markdown @@ -40,6 +40,7 @@ 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. +* `map_to_all_services` - (Optional) If the action should be able to be run against all services or just specified ones. Action Data (`action_data_reference`) supports the following: