Skip to content

Commit 736e091

Browse files
committed
Merge branch 'master' into zzhou-metrics-management-tf
2 parents 43cff88 + 0cbe322 commit 736e091

27 files changed

+1281
-487
lines changed

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1-
## 2.23.1 (Unreleased)
1+
## 2.24.1 (Unreleased)
2+
BUG FIXES:
3+
* Enforce non-empty string validation of `default_normalized_domain` and `domain_mappings` in cse_entity_normalization resource. (GH-540)
24
FEATURES:
35
* **New Resource:** sumologic_metrics_search (GH-528)
46

7+
## 2.24.0 (June 22, 2023)
8+
FEATURES:
9+
* **New Resource:** sumologic_cse_outlier_rule (GH-532)
10+
* Add new optional `global_signal_suppression_window` field to sumologic_cse_insights_configuration (GH-533)
11+
12+
BUG FIXES:
13+
* Enforce validation of `group_by_fields` in cse_*_rule resources, on non empty string elements. (GH-535)
14+
* Fixes `resource_sumologic_cse_match_list` to allow for match lists with more than 1000 items to be created. (GH-536)
15+
516
## 2.23.0 (May 24, 2023)
617
FEATURES:
718
* **New Resource:** sumologic_log_search (GH-432)

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,20 @@ Then run `terraform init` to initialize it.
5353

5454
In order to run the full suite of Acceptance tests, run `make testacc`.
5555

56+
To run a specific acceptance test, run `go test -v ./sumologic -run YourSpecificTestName`
57+
5658
*Note:*
57-
- Acceptance tests *create real resources*, and often cost money to run. The environment variables `SUMOLOGIC_ACCESSID`, `SUMOLOGIC_ACCESSKEY`, and `SUMOLOGIC_ENVIRONMENT` must also be set for acceptance tests to work properly.
59+
- Acceptance tests *create real resources*, and often cost money to run. The environment variables `SUMOLOGIC_ACCESSID`, `SUMOLOGIC_ACCESSKEY`, `SUMOLOGIC_ENVIRONMENT` / `SUMOLOGIC_BASE_URL`, and `TF_ACC` must also be set for acceptance tests to work properly.
60+
- For example, you can generate a personal access key in stag-alpha [here](https://cse-stag-alpha.stag.sumologic.net/ui/#/preferences). Once your test runs, you are then capable of viewing the real resources created by Terraform in the [stag-alpha UI](https://cse-stag-alpha.stag.sumologic.net/sec/hud?hours=24).
61+
```sh
62+
$ export SUMOLOGIC_ACCESSID="yourAccessID"
63+
$ export SUMOLOGIC_ACCESSKEY="yourAccessKey"
64+
$ export SUMOLOGIC_ENVIRONMENT="stag"
65+
$ export SUMOLOGIC_BASE_URL="https://stag-api.sumologic.net/api/"
66+
$ export TF_ACC=1
67+
```
68+
- More information on configuration can be found at the [Terraform Provider codelabs documentation](https://github.com/Sanyaku/codelabs/blob/master/backend/pages/SumoLogicTerraformProvider.md).
69+
5870
- Environment variable `SUMOLOGIC_TEST_GOOGLE_APPLICATION_CREDENTIALS` must be set for gcp metrics acceptance tests to work properly (ex. below).
5971
- export SUMOLOGIC_TEST_GOOGLE_APPLICATION_CREDENTIALS=`cat /path/to/service_acccount.json`
6072
- Set Environment variable `SUMOLOGIC_ENABLE_GCP_METRICS_ACC_TESTS` to false, to disable acceptance test for Gcp Metrics.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ go 1.17
44

55
require (
66
github.com/go-errors/errors v1.4.0
7+
github.com/google/go-cmp v0.5.6
78
github.com/hashicorp/go-retryablehttp v0.7.0
89
github.com/hashicorp/terraform-plugin-sdk v1.17.2
910
github.com/stretchr/testify v1.7.0
@@ -28,7 +29,6 @@ require (
2829
github.com/go-test/deep v1.0.7 // indirect
2930
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
3031
github.com/golang/protobuf v1.5.2 // indirect
31-
github.com/google/go-cmp v0.5.6 // indirect
3232
github.com/google/uuid v1.1.2 // indirect
3333
github.com/googleapis/gax-go/v2 v2.0.5 // indirect
3434
github.com/hashicorp/errwrap v1.0.0 // indirect

sumologic/data_source_sumologic_folder_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func TestAccDataSourceFolder_folder_does_not_exist(t *testing.T) {
3131
{
3232
Config: folderConfig("/Library/Users/[email protected]/doesNotExist"),
3333
ExpectError: regexp.MustCompile(
34-
"folder with path '/Library/Users/dgould\\[email protected]/doesNotExist' does not exist"),
34+
`folder with path '/Library/Users/dgould\[email protected]/doesNotExist' does not exist`),
3535
},
3636
},
3737
})

sumologic/provider.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ func Provider() terraform.ResourceProvider {
6363
"sumologic_cse_match_rule": resourceSumologicCSEMatchRule(),
6464
"sumologic_cse_threshold_rule": resourceSumologicCSEThresholdRule(),
6565
"sumologic_cse_first_seen_rule": resourceSumologicCSEFirstSeenRule(),
66+
"sumologic_cse_outlier_rule": resourceSumologicCSEOutlierRule(),
6667
"sumologic_collector": resourceSumologicCollector(),
6768
"sumologic_installed_collector": resourceSumologicInstalledCollector(),
6869
"sumologic_http_source": resourceSumologicHTTPSource(),

sumologic/resource_sumologic_cse_aggregation_rule.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ func resourceSumologicCSEAggregationRule() *schema.Resource {
5858
Type: schema.TypeList,
5959
Optional: true,
6060
Elem: &schema.Schema{
61-
Type: schema.TypeString,
61+
Type: schema.TypeString,
62+
ValidateFunc: validation.StringIsNotEmpty,
6263
},
6364
},
6465
"is_prototype": {

sumologic/resource_sumologic_cse_chain_rule.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ func resourceSumologicCSEChainRule() *schema.Resource {
4646
Type: schema.TypeList,
4747
Optional: true,
4848
Elem: &schema.Schema{
49-
Type: schema.TypeString,
49+
Type: schema.TypeString,
50+
ValidateFunc: validation.StringIsNotEmpty,
5051
},
5152
},
5253
"is_prototype": {

sumologic/resource_sumologic_cse_entity_normalization_configuration.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package sumologic
22

33
import (
44
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
5+
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
56
"log"
67
)
78

@@ -29,8 +30,9 @@ func resourceSumologicCSEEntityNormalizationConfiguration() *schema.Resource {
2930
Required: true,
3031
},
3132
"default_normalized_domain": {
32-
Type: schema.TypeString,
33-
Optional: true,
33+
Type: schema.TypeString,
34+
Optional: true,
35+
ValidateFunc: validation.StringIsNotEmpty,
3436
},
3537
"normalize_hostnames": {
3638
Type: schema.TypeBool,
@@ -46,12 +48,14 @@ func resourceSumologicCSEEntityNormalizationConfiguration() *schema.Resource {
4648
Elem: &schema.Resource{
4749
Schema: map[string]*schema.Schema{
4850
"normalized_domain": {
49-
Type: schema.TypeString,
50-
Required: true,
51+
Type: schema.TypeString,
52+
Required: true,
53+
ValidateFunc: validation.StringIsNotEmpty,
5154
},
5255
"raw_domain": {
53-
Type: schema.TypeString,
54-
Required: true,
56+
Type: schema.TypeString,
57+
Required: true,
58+
ValidateFunc: validation.StringIsNotEmpty,
5559
},
5660
},
5761
},

sumologic/resource_sumologic_cse_first_seen_rule.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ func resourceSumologicCSEFirstSeenRule() *schema.Resource {
4242
Type: schema.TypeList,
4343
Optional: true,
4444
Elem: &schema.Schema{
45-
Type: schema.TypeString,
45+
Type: schema.TypeString,
46+
ValidateFunc: validation.StringIsNotEmpty,
4647
},
4748
},
4849
"is_prototype": {

sumologic/resource_sumologic_cse_insights_configuration.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ func resourceSumologicCSEInsightsConfiguration() *schema.Resource {
2626
Optional: true,
2727
ForceNew: false,
2828
},
29+
"global_signal_suppression_window": {
30+
Type: schema.TypeFloat,
31+
Optional: true,
32+
ForceNew: false,
33+
},
2934
},
3035
}
3136
}
@@ -49,6 +54,7 @@ func resourceSumologicCSEInsightsConfigurationRead(d *schema.ResourceData, meta
4954

5055
d.Set("lookback_days", CSEInsightsConfiguration.LookbackDays)
5156
d.Set("threshold", CSEInsightsConfiguration.Threshold)
57+
d.Set("global_signal_suppression_window", CSEInsightsConfiguration.GlobalSignalSuppressionWindow)
5258

5359
return nil
5460
}
@@ -93,9 +99,11 @@ func resourceToCSEInsightsConfiguration(d *schema.ResourceData) (CSEInsightsConf
9399

94100
lookbackDays := d.Get("lookback_days").(float64)
95101
threshold := d.Get("threshold").(float64)
102+
globalSignalSuppressionWindow := d.Get("global_signal_suppression_window").(float64)
96103

97104
return CSEInsightsConfiguration{
98-
LookbackDays: &lookbackDays,
99-
Threshold: &threshold,
105+
LookbackDays: &lookbackDays,
106+
Threshold: &threshold,
107+
GlobalSignalSuppressionWindow: &globalSignalSuppressionWindow,
100108
}, nil
101109
}

0 commit comments

Comments
 (0)