Skip to content

Commit

Permalink
Restore whitelist for backward compatibility (#429)
Browse files Browse the repository at this point in the history
  • Loading branch information
akonarska authored May 10, 2023
1 parent 04b8bd2 commit b4d2f1a
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 6 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
## Unreleased
## Unreleased

## 6.24.0
BUGFIXES:
* Fixes backwards incompatibility for GCP integration resource introduced in `6.21.0`

IMPROVEMENTS:
* Deprecate `use_get_metric_data_method` in AWS integration resource

## 6.23.0
WARNING: This version is NOT backward compatible for GCP integration resource. This is fixed in 6.24.0

IMPROVEMENTS:
* provider: Use go-retryablehttp for automatic retries with exponential backoff. Add `retry_max_attempts` (default=4), `retry_wait_min_seconds` (default=1), and `retry_wait_max_seconds` (default=30) configuration options. [#416](https://github.com/splunk-terraform/terraform-provider-signalfx/pull/416)
* resource/signalfx_metric_ruleset: added along with docs

## 6.22.0
WARNING: This version is NOT backward compatible for GCP integration resource. This is fixed in 6.24.0

BUGFIXES
* resource/signalfx_table_chart: Added `color` option to `viz_options` to fix `Error: Invalid address to set: []string{"viz_options", "0", "color"}` [#410](https://github.com/splunk-terraform/terraform-provider-signalfx/pull/410)

## 6.21.0
WARNING: This version is NOT backward compatible for GCP integration resource. This is fixed in 6.24.0

IMPROVEMENTS:
* resource/signalfx_gcp_integration: Add `custom_metric_type_domains` option and rename deprecated field `whitelist` to `include_list` [#412](https://github.com/splunk-terraform/terraform-provider-signalfx/pull/412)

Expand Down
27 changes: 24 additions & 3 deletions signalfx/resource_signalfx_gcp_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,22 @@ func integrationGCPResource() *schema.Resource {
Description: "When this value is set to true Observability Cloud will force usage of a quota from the project where metrics are stored. For this to work the service account provided for the project needs to be provided with serviceusage.services.use permission or Service Usage Consumer role in this project. When set to false default quota settings are used.",
},
"include_list": &schema.Schema{
Type: schema.TypeSet,
Optional: true,
Description: "List of custom metadata keys that you want Observability Cloud to collect for Compute Engine instances. This field replaces the deprecated field `whiteList`.",
Type: schema.TypeSet,
Optional: true,
Computed: true,
Description: "List of custom metadata keys that you want Observability Cloud to collect for Compute Engine instances.",
ConflictsWith: []string{"whitelist"},
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"whitelist": &schema.Schema{
Type: schema.TypeSet,
Optional: true,
Computed: true,
Description: "Compute Metadata Whitelist",
Deprecated: "Please use include_list instead",
ConflictsWith: []string{"include_list"},
Elem: &schema.Schema{
Type: schema.TypeString,
},
Expand Down Expand Up @@ -177,6 +190,10 @@ func getGCPPayloadIntegration(d *schema.ResourceData) *integration.GCPIntegratio
gcp.IncludeList = expandStringSetToSlice(val.(*schema.Set))
}

if val, ok := d.GetOk("whitelist"); ok {
gcp.Whitelist = expandStringSetToSlice(val.(*schema.Set))
}

if val, ok := d.GetOk("custom_metric_type_domains"); ok {
gcp.CustomMetricTypeDomains = expandStringSetToSlice(val.(*schema.Set))
}
Expand Down Expand Up @@ -224,6 +241,10 @@ func gcpIntegrationAPIToTF(d *schema.ResourceData, gcp *integration.GCPIntegrati
return err
}

if err := d.Set("whitelist", flattenStringSliceToSet(gcp.Whitelist)); err != nil {
return err
}

if err := d.Set("custom_metric_type_domains", flattenStringSliceToSet(gcp.CustomMetricTypeDomains)); err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion signalfx/resource_signalfx_gcp_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ resource "signalfx_gcp_integration" "gcp_myteamXX" {
use_metric_source_project_for_quota = true
custom_metric_type_domains = ["networking.googleapis.com/google_service/request_bytes_count"]
custom_metric_type_domains = ["networking.googleapis.com"]
import_gcp_metrics = false
}
Expand Down
3 changes: 2 additions & 1 deletion website/docs/r/gcp_integration.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ resource "signalfx_gcp_integration" "gcp_myteam" {
## Argument Reference

* `enabled` - (Required) Whether the integration is enabled.
* `include_list` - (Optional) [Compute Metadata Include List](https://dev.splunk.com/observability/docs/integrations/gcp_integration_overview/).
* `name` - (Required) Name of the integration.
* `named_token` - (Optional) Name of the org token to be used for data ingestion. If not specified then default access token is used.
* `poll_rate` - (Optional) GCP integration poll rate (in seconds). Value between `60` and `600`. Default: `300`.
* `project_service_keys` - (Required) GCP projects to add.
* `services` - (Optional) GCP service metrics to import. Can be an empty list, or not included, to import 'All services'. See the documentation for [Creating Integrations](https://dev.splunk.com/observability/reference/api/integrations/latest#endpoint-create-integration) for valid values.
* `use_metric_source_project_for_quota` - (Optional) When this value is set to true Observability Cloud will force usage of a quota from the project where metrics are stored. For this to work the service account provided for the project needs to be provided with serviceusage.services.use permission or Service Usage Consumer role in this project. When set to false default quota settings are used.
* `include_list` - (Optional) [Compute Metadata Include List](https://dev.splunk.com/observability/docs/integrations/gcp_integration_overview/).
* `whitelist` - (Optional, Deprecated) [Compute Metadata Include List](https://dev.splunk.com/observability/docs/integrations/gcp_integration_overview/).

## Attributes Reference

Expand Down

0 comments on commit b4d2f1a

Please sign in to comment.