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

new resource azurerm_monitor_action_rule_action_group, azurerm_monitor_action_rule_suppression #6563

Merged
merged 5 commits into from Jun 4, 2020

Conversation

njuCZ
Copy link
Contributor

@njuCZ njuCZ commented Apr 21, 2020

fix #6564

image

@njuCZ njuCZ changed the title new resource azurerm_alerts_management_action_rule new resource azurerm_monitor_action_rule May 12, 2020
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Hi @njuCZ,

In addition to the comments i've left inline i think it may be better to split this into three resources. It would simplify the code and also make it explicit what properties are required for each type. WDYT?

Comment on lines 31 to 65
func schemaActionRuleAlertContextCondtion() *schema.Schema {
return schemaActionRuleCondtion(
validation.StringInSlice([]string{
string(alertsmanagement.Equals),
string(alertsmanagement.NotEquals),
string(alertsmanagement.Contains),
string(alertsmanagement.DoesNotContain),
}, false),
validation.StringIsNotEmpty,
)
}

func schemaActionRuleAlertRuleIDCondtion() *schema.Schema {
return schemaActionRuleCondtion(
validation.StringInSlice([]string{
string(alertsmanagement.Equals),
string(alertsmanagement.NotEquals),
string(alertsmanagement.Contains),
string(alertsmanagement.DoesNotContain),
}, false),
validation.StringIsNotEmpty,
)
}

func schemaActionRuleDescriptionCondtion() *schema.Schema {
return schemaActionRuleCondtion(
validation.StringInSlice([]string{
string(alertsmanagement.Equals),
string(alertsmanagement.NotEquals),
string(alertsmanagement.Contains),
string(alertsmanagement.DoesNotContain),
}, false),
validation.StringIsNotEmpty,
)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are these all different when they all do the exact same thing?

Copy link
Contributor Author

@njuCZ njuCZ May 25, 2020

Choose a reason for hiding this comment

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

in the rest api, there are different kinds of condition (something like filters), to explicitly show they are different kinds, I made individual functions for each condition.

As next comment suggests, unwrap these functions and make them inline, there will no this problem in revised version

website/docs/r/monitor_action_rule.html.markdown Outdated Show resolved Hide resolved
website/docs/r/monitor_action_rule.html.markdown Outdated Show resolved Hide resolved
website/docs/r/monitor_action_rule.html.markdown Outdated Show resolved Hide resolved
website/docs/r/monitor_action_rule.html.markdown Outdated Show resolved Hide resolved
@katbyte katbyte added this to the v2.11.0 milestone May 20, 2020
@katbyte katbyte modified the milestones: v2.11.0, v2.12.0 May 22, 2020
@njuCZ njuCZ changed the title new resource azurerm_monitor_action_rule new resource azurerm_monitor_action_rule_action_group, azurerm_monitor_action_rule_suppression May 25, 2020
@njuCZ
Copy link
Contributor Author

njuCZ commented May 25, 2020

@katbyte thanks for your suggestion. I have splitted and made two resources azurerm_monitor_action_rule_action_group, azurerm_monitor_action_rule_suppression, please have a look again.

@ghost ghost removed the waiting-response label May 25, 2020
@katbyte katbyte modified the milestones: v2.12.0, v2.13.0 May 28, 2020
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Thanks for the changes @njuCZ, aside from a couple more small comments this is looking good!

@njuCZ
Copy link
Contributor Author

njuCZ commented Jun 3, 2020

@katbyte thanks for the suggestions. I have refined the PR, Could you please have a check again?

Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Thanks @njuCZ! LGTM now 👍

@katbyte katbyte merged commit ae66527 into hashicorp:master Jun 4, 2020
@ghost
Copy link

ghost commented Jun 4, 2020

This has been released in version 2.13.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.13.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Jul 4, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@hashicorp hashicorp locked and limited conversation to collaborators Jul 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for Alerts Management Action Rule
3 participants