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

Rename azurerm_metric_alertrule to azurerm_monitor_metric_alertrule #2762

Merged
merged 2 commits into from
Jan 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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'
`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've got a local branch with a guide and slightly different wording (for the other resources we're renaming):

DeprecationMessage: `The 'azurerm_autoscale_setting' resource is deprecated in favour of the renamed version 'azurerm_monitor_autoscale_setting'.

Information on migrating to the renamed resource can be found here: https://terraform.io/docs/providers/azurerm/guides/migrating-to-monitor-resources.html

As such the existing 'azurerm_autoscale_setting' resource is deprecated and will be removed in the next major version of the AzureRM Provider (2.0).
`,

rather than change the wording in this PR I'm going to merge this and then update this in my branch with the other resources


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