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

[AZINTS-2487] Update Azure integration terraform to support metric filitering #2738

Merged
merged 17 commits into from
Jan 6, 2025

Conversation

gpalmz
Copy link
Contributor

@gpalmz gpalmz commented Dec 21, 2024

Add support for the following options:

  • metrics_enabled
  • metrics_enabled_default
  • usage_metrics_enabled
  • resource_provider_configs

@gpalmz gpalmz requested a review from ava-silver January 6, 2025 12:21
@gpalmz gpalmz marked this pull request as ready for review January 6, 2025 12:23
@gpalmz gpalmz requested review from a team as code owners January 6, 2025 12:23
@jack-edmonds-dd jack-edmonds-dd merged commit 0509c7c into master Jan 6, 2025
13 of 14 checks passed
@jack-edmonds-dd jack-edmonds-dd deleted the gpalmz/azure-metric-filtering branch January 6, 2025 14:50
Copy link
Contributor

@ava-silver ava-silver left a 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

Comment on lines +304 to +310
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()),
}
}
Copy link
Contributor

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:

Suggested change
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))
Copy link
Contributor

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:
Copy link
Contributor

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?

Copy link
Contributor

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

@jack-edmonds-dd
Copy link
Contributor

@gpalmz Sorry, I reverted this so that people would get a chance to comment. Revert was in #2752

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants