-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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_dynatrace_tag_rules
#27985
Conversation
@katbyte Do we have any ETA by when can we expect this PR to be reviewed? It's already couple of weeks. This PR is a follow-up for a dependent child RT related to the previously released monitors resource. It is crucial for our functionality, and without it, our service will have a broken experience. Could you please help prioritize it |
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.
Hi @jiaweitao001 I've had a look through this and left some comments inline, I can take another look once those are addressed. Thanks!
internal/services/arckubernetes/log
Outdated
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.
should this be removed?
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.
Sure. Will do.
MaxItems: 1, | ||
Elem: &pluginsdk.Resource{ | ||
Schema: map[string]*schema.Schema{ | ||
"send_aad_logs": { |
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.
"send_aad_logs": { | |
"send_azure_active_directory_logs": { |
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.
Will change.
Type: pluginsdk.TypeString, | ||
Optional: true, | ||
ValidateFunc: validation.StringInSlice([]string{ | ||
"Enabled", | ||
"Disabled", |
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.
should we consider making this a bool?
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.
Will change.
}, false), | ||
}, | ||
|
||
"send_activity_logs": { |
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.
should we consider making this a bool?
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.
Will change.
}, false), | ||
}, | ||
|
||
"send_subscription_logs": { |
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.
should we consider making this a bool?
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.
Will do.
if input.SendAadLogs != nil { | ||
sendAadLogs = string(*input.SendAadLogs) | ||
} |
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.
if input.SendAadLogs != nil { | |
sendAadLogs = string(*input.SendAadLogs) | |
} | |
sendAadLogs = pointer.From(input.SendAadLogs) | |
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.
Will fix.
if input.SendSubscriptionLogs != nil { | ||
sendSubscriptionLogs = string(*input.SendSubscriptionLogs) | ||
} |
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.
if input.SendSubscriptionLogs != nil { | |
sendSubscriptionLogs = string(*input.SendSubscriptionLogs) | |
} | |
sendSubscriptionLogs = pointer.From(input.SendSubscriptionLogs) | |
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.
same.
var name string | ||
var value string | ||
var action string | ||
tags := *input | ||
v := tags[0] | ||
|
||
if v.Name != nil { | ||
name = *v.Name | ||
} | ||
|
||
if v.Value != nil { | ||
value = *v.Value | ||
} | ||
|
||
if v.Action != nil { | ||
action = string(*v.Action) | ||
} | ||
|
||
return []FilteringTag{ | ||
{ | ||
Name: name, | ||
Value: value, | ||
Action: action, | ||
}, | ||
} |
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.
var name string | |
var value string | |
var action string | |
tags := *input | |
v := tags[0] | |
if v.Name != nil { | |
name = *v.Name | |
} | |
if v.Value != nil { | |
value = *v.Value | |
} | |
if v.Action != nil { | |
action = string(*v.Action) | |
} | |
return []FilteringTag{ | |
{ | |
Name: name, | |
Value: value, | |
Action: action, | |
}, | |
} | |
tags := pointer.From(input)[0] | |
return []FilteringTag{ | |
{ | |
Name: pointer.From(tags.Name), | |
Value: pointer.From(tags.Value), | |
Action: string(pointer.From(tags.Action)), | |
}, | |
} |
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.
Will fix.
return []MetricRule{} | ||
} | ||
|
||
var filteringTags []FilteringTag |
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.
var filteringTags []FilteringTag | |
filteringTags := make([]FilteringTag, 0) |
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.
Will change.
* `create` - (Defaults to 1 hour) Used when creating the Dynatrace tag rules. | ||
* `read` - (Defaults to 5 minutes) Used when retrieving the Dynatrace tag rules. | ||
* `update` - (Defaults to 1 hour) Used when updating the Dynatrace tag rules. | ||
* `delete` - (Defaults to 1 hour) Used when deleting the Dynatrace tag rules. |
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.
* `create` - (Defaults to 1 hour) Used when creating the Dynatrace tag rules. | |
* `read` - (Defaults to 5 minutes) Used when retrieving the Dynatrace tag rules. | |
* `update` - (Defaults to 1 hour) Used when updating the Dynatrace tag rules. | |
* `delete` - (Defaults to 1 hour) Used when deleting the Dynatrace tag rules. | |
* `create` - (Defaults to 30 minutes) Used when creating the Dynatrace tag rules. | |
* `read` - (Defaults to 5 minutes) Used when retrieving the Dynatrace tag rules. | |
* `delete` - (Defaults to 30 minutes) Used when deleting the Dynatrace tag rules. |
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.
Will fix.
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.
Thanks for updating this @jiaweitao001. I ran the tests on this and it looks like there are some failures. Could you take a look at fixing these up and then we can have another look at this? Thanks!
------- Stdout: -------
=== RUN TestAccDynatraceTagRules_basic
=== PAUSE TestAccDynatraceTagRules_basic
=== CONT TestAccDynatraceTagRules_basic
testcase.go:173: Step 1/3 error: Error running pre-apply plan: exit status 1
Error: expected "user.0.first_name" to not be an empty string, got
with azurerm_dynatrace_monitor.test,
on terraform_plugin_test.tf line 50, in resource "azurerm_dynatrace_monitor" "test":
50: first_name = ""
Error: expected "user.0.last_name" to not be an empty string, got
with azurerm_dynatrace_monitor.test,
on terraform_plugin_test.tf line 51, in resource "azurerm_dynatrace_monitor" "test":
51: last_name = ""
Error: test: user.0.email, "" is not an valida email address
with azurerm_dynatrace_monitor.test,
on terraform_plugin_test.tf line 52, in resource "azurerm_dynatrace_monitor" "test":
52: email = ""
Error: expected "user.0.phone_number" to not be an empty string, got
with azurerm_dynatrace_monitor.test,
on terraform_plugin_test.tf line 53, in resource "azurerm_dynatrace_monitor" "test":
53: phone_number = ""
Error: expected "user.0.country" to not be an empty string, got
with azurerm_dynatrace_monitor.test,
on terraform_plugin_test.tf line 54, in resource "azurerm_dynatrace_monitor" "test":
54: country = ""
--- FAIL: TestAccDynatraceTagRules_basic (4.70s)
FAIL
Hi @catriona-m , these acc tests should not be triggered automatically, I've add some logics to prevent it from happening. As mentioned in the description, because of some cost issue, I'll have to manually run the tests on the subs provided by the service team and paste the results here. |
Thanks @jiaweitao001 - I'll take another look at this once the test results are available. |
Hi @catriona-m , these tests should not be available on your teamcity pipeline because of cost issue. We have agreed that acc tests related to this resource will be ran under the subs provided by the service team, same as a previous resource here: #27432 . You can find the tests results in the description above. |
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.
Thanks @jiaweitao001 - I had another look through a left a couple more comments. I also wanted to note that if it is not possible to update his resource, then all the properties should be marked as ForceNew
.
"send_azure_active_directory_logs_enabled": { | ||
Type: pluginsdk.TypeBool, | ||
Optional: true, | ||
}, | ||
|
||
"send_activity_logs_enabled": { | ||
Type: pluginsdk.TypeBool, | ||
Optional: true, | ||
}, | ||
|
||
"send_subscription_logs_enabled": { | ||
Type: pluginsdk.TypeBool, | ||
Optional: true, | ||
}, |
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.
do these have default values?
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.
Yes, the default value is false
. I'll update it.
449647a
to
a66c159
Compare
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.
Thanks for updating this @jiaweitao001. I just wanted to note that the comments on the test are still waiting to be addressed.
I also wondered if you could confirm whether or not it is possible to for this resource to be updated? If not, could we mark all the properties asForceNew
. If it is possible to update, we would need to add an Update func for this.
Thanks!
Hi @catriona-m , thanks for replying. I'll update the resource names in the acc tests. |
I think we should mark them all if it's not possible to update, thanks @jiaweitao001 |
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.
Thanks for updating @jiaweitao001, once the final few commenst are addressed this should be good! Thanks!
%[1]s | ||
|
||
resource "azurerm_dynatrace_tag_rules" "test" { | ||
name = "acctestragrules%d" |
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.
name = "acctestragrules%d" | |
name = "acctesttagrules%d" |
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.
Will fix.
log_rule { | ||
filtering_tag { | ||
name = "Environment" | ||
value = "Prod" | ||
action = "Include" | ||
} | ||
} | ||
|
||
metric_rule { | ||
filtering_tag { | ||
name = "Environment" | ||
value = "Prod" | ||
action = "Include" | ||
} | ||
} |
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.
since neither of these are not required, we should be able to create the resource in the basic test without them
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.
Will remove.
%[1]s | ||
|
||
resource "azurerm_dynatrace_tag_rules" "test" { | ||
name = "acctestragrules%d" |
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.
name = "acctestragrules%d" | |
name = "acctesttagrules%d" |
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.
Will fix.
d9d97b4
to
5ac3b19
Compare
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.
Thanks @jiaweitao001 LGTM!
* Update CHANGELOG.md for #28233 * Update for #28215 * Update CHANGELOG.md for #28279 * Update CHANGELOG.md #28269 * Update CHANGELOG.md #27876 * Update CHANGELOG.md #28069 * Update CHANGELOG.md for #28312 * Update CHANGELOG.md for #28278 * Update CHANGELOG.md #28311 * Update CHANGELOG.md undo 28311 * Update CHANGELOG.md #27874 * Update CHANGELOG.md * Update CHANGELOG for #28352 * Update CHANGELOG.md for #28390 * Update CHANGELOG.md for #28398 * Update CHANGELOG.md for #28425 * Update CHANGELOG.md #28427 * Update CHANGELOG.md #28280 * Update CHANGELOG.md for #28319 * Update CHANGELOG.md #24801 * Update for #28360 #28216 #27830 #28404 #27401 #27122 #27931 #28442 * Update for #28379 * Update CHANGELOG.md for #28281 * Update for #28380 * Update for #27375 * Update for #25695 * Update CHANGELOG.md #27985 * Update CHANGELOG.md - update release date manually until can be scripted * Update CHANGELOG.md revert date change as script available * pre-release script updates --------- Co-authored-by: stephybun <[email protected]> Co-authored-by: catriona-m <[email protected]> Co-authored-by: Wyatt Fry <[email protected]> Co-authored-by: sreallymatt <[email protected]> Co-authored-by: Matthew Frahry <[email protected]> Co-authored-by: kt <[email protected]>
Community Note
Description
PR Checklist
For example: “
resource_name_here
- description of change e.g. adding propertynew_property_name_here
”Changes to existing Resource / Data Source
Testing
Change Log
Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.
azurerm_resource
- support for thething1
property [GH-00000]This is a (please select all that apply):
Related Issue(s)
Fixes #0000
Note
This PR is related to #27432, the same as the previous one, it cannot be tested on TeamCity. Here is the test result from my end with service team's subscription: