-
Notifications
You must be signed in to change notification settings - Fork 385
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
[AZINTS-2487] Update Azure integration terraform to support metric filitering #2738
Conversation
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.
a couple things I'd like to discuss, either to submit in a follow up PR or discuss offline
state.ResourceProviderConfigs = make([]*ResourceProviderConfigModel, len(resourceProviderConfigs)) | ||
for i, resourceProviderConfig := range resourceProviderConfigs { | ||
state.ResourceProviderConfigs[i] = &ResourceProviderConfigModel{ | ||
Namespace: types.StringValue(resourceProviderConfig.GetNamespace()), | ||
MetricsEnabled: types.BoolValue(resourceProviderConfig.GetMetricsEnabled()), | ||
} | ||
} |
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.
go best practices would be to do this as:
state.ResourceProviderConfigs = make([]*ResourceProviderConfigModel, len(resourceProviderConfigs)) | |
for i, resourceProviderConfig := range resourceProviderConfigs { | |
state.ResourceProviderConfigs[i] = &ResourceProviderConfigModel{ | |
Namespace: types.StringValue(resourceProviderConfig.GetNamespace()), | |
MetricsEnabled: types.BoolValue(resourceProviderConfig.GetMetricsEnabled()), | |
} | |
} | |
state.ResourceProviderConfigs = make([]*ResourceProviderConfigModel, 0, len(resourceProviderConfigs)) | |
for i, resourceProviderConfig := range resourceProviderConfigs { | |
state.ResourceProviderConfigs = append(state.ResourceProviderConfigs, &ResourceProviderConfigModel{ | |
Namespace: types.StringValue(resourceProviderConfig.GetNamespace()), | |
MetricsEnabled: types.BoolValue(resourceProviderConfig.GetMetricsEnabled()), | |
} | |
} |
datadogDefinition.SetMetricsEnabledDefault(state.MetricsEnabledDefault.ValueBool()) | ||
datadogDefinition.SetUsageMetricsEnabled(state.UsageMetricsEnabled.ValueBool()) | ||
|
||
resourceProviderConfigsPayload := make([]datadogV1.ResourceProviderConfig, len(state.ResourceProviderConfigs)) |
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 comment here as above
<a id="nestedatt--resource_provider_configs"></a> | ||
### Nested Schema for `resource_provider_configs` | ||
|
||
Optional: |
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 these be optional? and could we add an example usage to the example terraform?
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 we want to add any additional validation about the ResourceProviderConfigs within terraform? or leave it all up to the API? im thinking probably the latter but wanna make sure we've considered it
Add support for the following options: