Skip to content

Commit

Permalink
Merge pull request #2762 from terraform-providers/monitor/refactor-al…
Browse files Browse the repository at this point in the history
…ertrule

Rename azurerm_metric_alertrule to azurerm_monitor_metric_alertrule
  • Loading branch information
tombuildsstuff authored Jan 25, 2019
2 parents 4d42718 + a8fae78 commit 83656a4
Show file tree
Hide file tree
Showing 7 changed files with 957 additions and 16 deletions.
1 change: 0 additions & 1 deletion azurerm/data_source_batch_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ func dataSourceArmBatchAccountRead(d *schema.ResourceData, meta interface{}) err

ctx := meta.(*ArmClient).StopContext
resp, err := client.Get(ctx, resourceGroup, name)

if err != nil {
if utils.ResponseWasNotFound(resp.Response) {
return fmt.Errorf("Error: Batch account %q (Resource Group %q) was not found", name, resourceGroup)
Expand Down
1 change: 1 addition & 0 deletions azurerm/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ func Provider() terraform.ResourceProvider {
"azurerm_monitor_diagnostic_setting": resourceArmMonitorDiagnosticSetting(),
"azurerm_monitor_log_profile": resourceArmMonitorLogProfile(),
"azurerm_monitor_metric_alert": resourceArmMonitorMetricAlert(),
"azurerm_monitor_metric_alertrule": resourceArmMonitorMetricAlertRule(),
"azurerm_mssql_elasticpool": resourceArmMsSqlElasticPool(),
"azurerm_mysql_configuration": resourceArmMySQLConfiguration(),
"azurerm_mysql_database": resourceArmMySqlDatabase(),
Expand Down
17 changes: 6 additions & 11 deletions azurerm/resource_arm_metric_alertrule.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,16 @@ func resourceArmMetricAlertRule() *schema.Resource {
Read: resourceArmMetricAlertRuleRead,
Update: resourceArmMetricAlertRuleCreateUpdate,
Delete: resourceArmMetricAlertRuleDelete,

Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},

DeprecationMessage: `This resource has been renamed to 'azurerm_monitor_metric_alertrule' to match the other monitor resources and will be removed in v2.0.
Functionally these resources are the same and to upgrade all that will need to be done is replace 'azurerm_metric_alertrule' with 'azurerm_monitor_metric_alertrule'
`,

Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Expand Down Expand Up @@ -423,17 +429,6 @@ func expandAzureRmMetricThresholdAlertRule(d *schema.ResourceData) (*insights.Al
return &alertRule, nil
}

func resourceGroupAndAlertRuleNameFromId(alertRuleId string) (string, string, error) {
id, err := parseAzureResourceID(alertRuleId)
if err != nil {
return "", "", err
}
name := id.Path["alertrules"]
resourceGroup := id.ResourceGroup

return resourceGroup, name, nil
}

func validateMetricAlertRuleTags(v interface{}, f string) (warnings []string, errors []error) {
// Normal validation required by any AzureRM resource.
warnings, errors = validateAzureRMTags(v, f)
Expand Down
Loading

0 comments on commit 83656a4

Please sign in to comment.