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

azurerm_monitor_action_group: Add Arm Role Receiver and more common alert schema support #4638

Merged
merged 35 commits into from
Nov 18, 2019
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4bf7ab1
First pass adding new action group receivers
mcdafydd Sep 5, 2019
ffc99ab
Update go.mod, go.sum; Change Computed to Optional
Sep 5, 2019
c8c20ce
Make all data source properties Computed
Sep 7, 2019
5e6421c
Revert go.mod/go.sum to master
Sep 7, 2019
b870072
Remove imports
Sep 7, 2019
6319f6e
First pass at doc updates for action groups
Sep 7, 2019
0fba52b
Add resources to test plans; remove unused common alert schemas
mcdafydd Sep 15, 2019
796278e
Merge remote-tracking branch 'upstream/master' into r/action-groups-all
mcdafydd Sep 15, 2019
6a163cb
Add more resource references
mcdafydd Sep 15, 2019
717eef1
Resolve PR comments
mcdafydd Sep 17, 2019
7e584bb
Construct resource IDs for new tests
mcdafydd Sep 18, 2019
83fb561
Reduce Config tests when using ImportStateVerify
mcdafydd Sep 18, 2019
76e2adf
Merge remote-tracking branch 'upstream/master' into r/action-groups-all
Sep 23, 2019
faf090c
Change imports to terraform-plugin-sdk
Oct 10, 2019
021fd6c
Fix terraform plugin import path
Oct 10, 2019
45524bb
Merge remote-tracking branch 'upstream/master' into r/action-groups-all
Oct 10, 2019
165f3ec
Fix linting error
Oct 10, 2019
4a87ce2
fixing comments from code review
tombuildsstuff Oct 14, 2019
6c4ddf7
r/monitor_action_group: fixing the validation
tombuildsstuff Oct 14, 2019
9bc431b
Merge remote-tracking branch 'upstream/master' into r/action-groups-all
mcdafydd Oct 16, 2019
560950f
fix typo
mcdafydd Oct 16, 2019
3855aa3
Fixes #3603 and comments
mcdafydd Oct 16, 2019
632a651
Remove UseCommonAlertSchema push receiver
mcdafydd Oct 18, 2019
fd91605
Update docs
mcdafydd Oct 18, 2019
13fa0a0
Update docs
mcdafydd Oct 18, 2019
251bb1b
Apply suggestions from code review
mcdafydd Nov 2, 2019
76f788f
Alphabetize monitor action group receivers
mcdafydd Nov 2, 2019
06034c2
Merge remote-tracking branch 'upstream/master' into r/remaining-actio…
mcdafydd Nov 2, 2019
418e6c7
Update azurerm/resource_arm_monitor_action_group.go
mcdafydd Nov 2, 2019
2dd4bd7
Update azurerm/resource_arm_monitor_action_group.go
mcdafydd Nov 2, 2019
6b567a8
Update azurerm/resource_arm_monitor_action_group.go
mcdafydd Nov 2, 2019
8eec8d1
Fix tests
mcdafydd Nov 3, 2019
3f7c90f
Apply suggestions from code review
mcdafydd Nov 6, 2019
327acb2
Make requested changes
mcdafydd Nov 8, 2019
0aa98b6
r/monitor_action_group: fixing up the test failures
tombuildsstuff Nov 18, 2019
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
216 changes: 216 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,57 @@ 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,
Optional: true,
mcdafydd marked this conversation as resolved.
Show resolved Hide resolved
Default: false,
mcdafydd marked this conversation as resolved.
Show resolved Hide resolved
},
},
},
},

"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 +148,144 @@ 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,
Optional: true,
mcdafydd marked this conversation as resolved.
Show resolved Hide resolved
Default: false,
mcdafydd marked this conversation as resolved.
Show resolved Hide resolved
},
},
},
},

"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,
Optional: true,
mcdafydd marked this conversation as resolved.
Show resolved Hide resolved
Default: false,
mcdafydd marked this conversation as resolved.
Show resolved Hide resolved
},
},
},
},

"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,
Optional: true,
mcdafydd marked this conversation as resolved.
Show resolved Hide resolved
Default: false,
mcdafydd marked this conversation as resolved.
Show resolved Hide resolved
},
},
},
},
"arm_role_receiver": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
mcdafydd marked this conversation as resolved.
Show resolved Hide resolved
ValidateFunc: validate.NoEmptyStrings,
mcdafydd marked this conversation as resolved.
Show resolved Hide resolved
},
"role_id": {
Type: schema.TypeString,
Required: true,
mcdafydd marked this conversation as resolved.
Show resolved Hide resolved
ValidateFunc: validate.UUID,
mcdafydd marked this conversation as resolved.
Show resolved Hide resolved
},
"use_common_alert_schema": {
Type: schema.TypeBool,
Optional: true,
mcdafydd marked this conversation as resolved.
Show resolved Hide resolved
Default: false,
mcdafydd marked this conversation as resolved.
Show resolved Hide resolved
},
},
},
},
},
}
}
Expand Down Expand Up @@ -126,13 +315,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