From 633efbfb5296c0932c5a651b73fb5566195c8bcc Mon Sep 17 00:00:00 2001 From: Sean Marciniak Date: Thu, 23 Jan 2025 20:36:39 +1030 Subject: [PATCH] Adding support for collecting only recommended stats --- go.mod | 2 +- go.sum | 4 +-- signalfx/resource_signalfx_aws_integration.go | 25 +++++++++++++------ 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 5f653732..f333ed4e 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/hashicorp/terraform-plugin-log v0.9.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.35.0 github.com/mitchellh/go-homedir v1.1.0 - github.com/signalfx/signalfx-go v1.44.0 + github.com/signalfx/signalfx-go v1.45.0 github.com/stretchr/testify v1.10.0 go.uber.org/multierr v1.11.0 ) diff --git a/go.sum b/go.sum index 15bccc89..3f508e2f 100644 --- a/go.sum +++ b/go.sum @@ -136,8 +136,8 @@ github.com/rogpeppe/go-internal v1.6.2 h1:aIihoIOHCiLZHxyoNQ+ABL4NKhFTgKLBdMLyEA github.com/rogpeppe/go-internal v1.6.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= -github.com/signalfx/signalfx-go v1.44.0 h1:BkLtohTJkq3mr1Yl1OzCWK+e2DZRqZ0M0zD9Gs+c41Q= -github.com/signalfx/signalfx-go v1.44.0/go.mod h1:I30umyhRTu8mPpEtMzEbG0z9wOYjkUKTp9U0gFxFsmk= +github.com/signalfx/signalfx-go v1.45.0 h1:hOa38ndqqotE6qACrh9B7L6qcwd4bvfNtL3sJp5+eE8= +github.com/signalfx/signalfx-go v1.45.0/go.mod h1:I30umyhRTu8mPpEtMzEbG0z9wOYjkUKTp9U0gFxFsmk= github.com/skeema/knownhosts v1.2.2 h1:Iug2P4fLmDw9f41PB6thxUkNUkJzB5i+1/exaj40L3A= github.com/skeema/knownhosts v1.2.2/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/signalfx/resource_signalfx_aws_integration.go b/signalfx/resource_signalfx_aws_integration.go index e7132436..9c0542d9 100644 --- a/signalfx/resource_signalfx_aws_integration.go +++ b/signalfx/resource_signalfx_aws_integration.go @@ -239,6 +239,12 @@ func integrationAWSResource() *schema.Resource { Default: false, Description: "Indicates that Splunk Observability should sync metrics and metadata from custom AWS namespaces only (see the `custom_namespace_sync_rule` field for details). Defaults to `false`.", }, + "collect_only_recommended_stats": { + Type: schema.TypeBool, + Optional: true, + Default: false, + Description: "Indicates that Splunk Observability should only sync recommended statistics", + }, }, Create: integrationAWSCreate, @@ -327,6 +333,10 @@ func awsIntegrationAPIToTF(d *schema.ResourceData, aws *integration.AwsCloudWatc return err } + if err := d.Set("collect_only_recommended_stats", aws.CollectOnlyRecommendedStats); err != nil { + return err + } + if aws.Token != "" { if err := d.Set("token", aws.Token); err != nil { return err @@ -434,13 +444,14 @@ func awsIntegrationAPIToTF(d *schema.ResourceData, aws *integration.AwsCloudWatc func getPayloadAWSIntegration(d *schema.ResourceData) (*integration.AwsCloudWatchIntegration, error) { aws := &integration.AwsCloudWatchIntegration{ - Name: d.Get("name").(string), - Type: "AWSCloudWatch", - Enabled: d.Get("enabled").(bool), - EnableAwsUsage: d.Get("enable_aws_usage").(bool), - ImportCloudWatch: d.Get("import_cloud_watch").(bool), - EnableCheckLargeVolume: d.Get("enable_check_large_volume").(bool), - SyncCustomNamespacesOnly: d.Get("sync_custom_namespaces_only").(bool), + Name: d.Get("name").(string), + Type: "AWSCloudWatch", + Enabled: d.Get("enabled").(bool), + EnableAwsUsage: d.Get("enable_aws_usage").(bool), + ImportCloudWatch: d.Get("import_cloud_watch").(bool), + EnableCheckLargeVolume: d.Get("enable_check_large_volume").(bool), + SyncCustomNamespacesOnly: d.Get("sync_custom_namespaces_only").(bool), + CollectOnlyRecommendedStats: d.Get("collect_only_recommended_stats").(bool), } if d.Get("use_metric_streams_sync").(bool) {