-
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
base: main
Are you sure you want to change the base?
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?
return pointer.To(true), nil | ||
} | ||
|
||
func (r TagRulesResource) basic(data acceptance.TestData) string { |
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.
The basic test is typically creating the resource with the minimal required properties, could we change this test to only the required properties and have a separate complete
test which includes all the properties?
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: