Skip to content

Commit

Permalink
Adding support for collecting only recommended stats (#563)
Browse files Browse the repository at this point in the history
  • Loading branch information
MovieStoreGuy authored Jan 23, 2025
1 parent 024c6e1 commit 06f04e3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
25 changes: 18 additions & 7 deletions signalfx/resource_signalfx_aws_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 06f04e3

Please sign in to comment.