Skip to content

Commit

Permalink
Merge pull request #4638 from mcdafydd/r/remaining-action-groups
Browse files Browse the repository at this point in the history
azurerm_monitor_action_group: Add Arm Role Receiver and more common alert schema support
  • Loading branch information
tombuildsstuff committed Nov 18, 2019
2 parents 2be1f19 + 0aa98b6 commit 08cff6a
Show file tree
Hide file tree
Showing 6 changed files with 1,831 additions and 135 deletions.
209 changes: 209 additions & 0 deletions azurerm/data_source_monitor_action_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,56 @@ func dataSourceArmMonitorActionGroup() *schema.Resource {
},

"email_receiver": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Computed: true,
},
"email_address": {
Type: schema.TypeString,
Computed: true,
},
"use_common_alert_schema": {
Type: schema.TypeBool,
Computed: true,
},
},
},
},

"itsm_receiver": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Computed: true,
},
"workspace_id": {
Type: schema.TypeString,
Computed: true,
},
"connection_id": {
Type: schema.TypeString,
Computed: true,
},
"ticket_configuration": {
Type: schema.TypeString,
Computed: true,
},
"region": {
Type: schema.TypeString,
Computed: true,
},
},
},
},

"azure_app_push_receiver": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Expand Down Expand Up @@ -97,6 +147,138 @@ func dataSourceArmMonitorActionGroup() *schema.Resource {
},
},
},

"automation_runbook_receiver": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Computed: true,
},
"automation_account_id": {
Type: schema.TypeString,
Computed: true,
},
"runbook_name": {
Type: schema.TypeString,
Computed: true,
},
"webhook_resource_id": {
Type: schema.TypeString,
Computed: true,
},
"is_global_runbook": {
Type: schema.TypeBool,
Computed: true,
},
"service_uri": {
Type: schema.TypeString,
Computed: true,
},
"use_common_alert_schema": {
Type: schema.TypeBool,
Computed: true,
},
},
},
},

"voice_receiver": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Computed: true,
},
"country_code": {
Type: schema.TypeString,
Computed: true,
},
"phone_number": {
Type: schema.TypeString,
Computed: true,
},
},
},
},

"logic_app_receiver": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Computed: true,
},
"resource_id": {
Type: schema.TypeString,
Computed: true,
},
"callback_url": {
Type: schema.TypeString,
Computed: true,
},
"use_common_alert_schema": {
Type: schema.TypeBool,
Computed: true,
},
},
},
},

"azure_function_receiver": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Computed: true,
},
"function_app_resource_id": {
Type: schema.TypeString,
Computed: true,
},
"function_name": {
Type: schema.TypeString,
Computed: true,
},
"http_trigger_url": {
Type: schema.TypeString,
Computed: true,
},
"use_common_alert_schema": {
Type: schema.TypeBool,
Computed: true,
},
},
},
},
"arm_role_receiver": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Computed: true,
},
"role_id": {
Type: schema.TypeString,
Computed: true,
},
"use_common_alert_schema": {
Type: schema.TypeBool,
Computed: true,
},
},
},
},
},
}
}
Expand Down Expand Up @@ -126,13 +308,40 @@ func dataSourceArmMonitorActionGroupRead(d *schema.ResourceData, meta interface{
return fmt.Errorf("Error setting `email_receiver`: %+v", err)
}

if err = d.Set("itsm_receiver", flattenMonitorActionGroupItsmReceiver(group.ItsmReceivers)); err != nil {
return fmt.Errorf("Error setting `itsm_receiver`: %+v", err)
}

if err = d.Set("azure_app_push_receiver", flattenMonitorActionGroupAzureAppPushReceiver(group.AzureAppPushReceivers)); err != nil {
return fmt.Errorf("Error setting `azure_app_push_receiver`: %+v", err)
}

if err = d.Set("sms_receiver", flattenMonitorActionGroupSmsReceiver(group.SmsReceivers)); err != nil {
return fmt.Errorf("Error setting `sms_receiver`: %+v", err)
}

if err = d.Set("webhook_receiver", flattenMonitorActionGroupWebHookReceiver(group.WebhookReceivers)); err != nil {
return fmt.Errorf("Error setting `webhook_receiver`: %+v", err)
}

if err = d.Set("automation_runbook_receiver", flattenMonitorActionGroupAutomationRunbookReceiver(group.AutomationRunbookReceivers)); err != nil {
return fmt.Errorf("Error setting `automation_runbook_receiver`: %+v", err)
}

if err = d.Set("voice_receiver", flattenMonitorActionGroupVoiceReceiver(group.VoiceReceivers)); err != nil {
return fmt.Errorf("Error setting `voice_receiver`: %+v", err)
}

if err = d.Set("logic_app_receiver", flattenMonitorActionGroupLogicAppReceiver(group.LogicAppReceivers)); err != nil {
return fmt.Errorf("Error setting `logic_app_receiver`: %+v", err)
}

if err = d.Set("azure_function_receiver", flattenMonitorActionGroupAzureFunctionReceiver(group.AzureFunctionReceivers)); err != nil {
return fmt.Errorf("Error setting `azure_function_receiver`: %+v", err)
}
if err = d.Set("arm_role_receiver", flattenMonitorActionGroupArmRoleReceiver(group.ArmRoleReceivers)); err != nil {
return fmt.Errorf("Error setting `arm_role_receiver`: %+v", err)
}
}

return nil
Expand Down
Loading

0 comments on commit 08cff6a

Please sign in to comment.