-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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_datadog_monitor_tag_rule
- correctly handle default rule
#22806
Changes from 2 commits
6aab4d4
89294bf
c1d9203
f8b1593
8598b5e
2533a65
f23be0f
39e1044
e9a4c83
3fc673a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,21 +48,6 @@ func TestAccDatadogMonitorTagRules_basic(t *testing.T) { | |
}) | ||
} | ||
|
||
func TestAccDatadogMonitorTagRules_requiresImport(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azurerm_datadog_monitor_tag_rule", "test") | ||
r := TagRulesDatadogMonitorResource{} | ||
r.populateFromEnvironment(t) | ||
data.ResourceTest(t, r, []acceptance.TestStep{ | ||
{ | ||
Config: r.basic(data), | ||
Check: acceptance.ComposeTestCheckFunc( | ||
check.That(data.ResourceName).ExistsInAzure(r), | ||
), | ||
}, | ||
data.RequiresImportErrorStep(r.requiresImport), | ||
}) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we revert this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I reverted it. |
||
|
||
func TestAccDatadogMonitorTagRules_update(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azurerm_datadog_monitor_tag_rule", "test") | ||
r := TagRulesDatadogMonitorResource{} | ||
|
@@ -139,10 +124,6 @@ resource "azurerm_datadog_monitor" "test" { | |
|
||
func (r TagRulesDatadogMonitorResource) basic(data acceptance.TestData) string { | ||
return fmt.Sprintf(` | ||
provider "azurerm" { | ||
features {} | ||
} | ||
|
||
%s | ||
|
||
resource "azurerm_datadog_monitor_tag_rule" "test" { | ||
|
@@ -161,33 +142,8 @@ resource "azurerm_datadog_monitor_tag_rule" "test" { | |
`, r.template(data)) | ||
} | ||
|
||
func (r TagRulesDatadogMonitorResource) requiresImport(data acceptance.TestData) string { | ||
return fmt.Sprintf(` | ||
%s | ||
|
||
resource "azurerm_datadog_monitor_tag_rule" "import" { | ||
datadog_monitor_id = azurerm_datadog_monitor_tag_rule.test.datadog_monitor_id | ||
name = azurerm_datadog_monitor_tag_rule.test.name | ||
log { | ||
subscription_log_enabled = true | ||
} | ||
metric { | ||
filter { | ||
name = "Test" | ||
value = "Testing-Logs" | ||
action = "Include" | ||
} | ||
} | ||
} | ||
`, r.basic(data)) | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we revert this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I reverted it. |
||
func (r TagRulesDatadogMonitorResource) update(data acceptance.TestData) string { | ||
return fmt.Sprintf(` | ||
provider "azurerm" { | ||
features {} | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these should be specified in each test, can we revert this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It has been defined in template func. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently, in main branch, provider block is defined in both template function and each test. So I assume this is a bug. So I removed provider block from template function otherwise test case would fail. |
||
%s | ||
|
||
resource "azurerm_datadog_monitor_tag_rule" "test" { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a core behavioural feature of the provider, so we shouldn't be requiring the
requiredImports
check, instead we can update it to confirm if this is configured with the default settings, and raise therequiredImports
error if so - can we update this?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the code to check if the "Tag Rule" exists or the "Tag Rule" is with default settings.
Service team confirmed that below behaviors are expected.