Skip to content

Commit 083a1dd

Browse files
author
Pedro Montiel
committed
address missing comments from GH-274 and GH-281
1 parent 15d2b7c commit 083a1dd

File tree

4 files changed

+30
-24
lines changed

4 files changed

+30
-24
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
## 2.11.0 (Unreleased)
2+
3+
* Address missing feedback from GH-274 and GH-281 (GH-285)
4+
25
FEATURES:
36

47
* **New Resource:** sumologic_cse_rule_tuning_expression (GH-281)
58
* **New Resource:** sumologic_cse_insights_resolution (GH-274)
69
* **New Resource:** sumologic_cse_insights_status (GH-274)
710
* **New Resource:** sumologic_cse_insights_configuration (GH-274)
811

12+
913
## 2.10.0 (September 22, 2021)
1014

1115
* Add a provider option `admin_mode`

sumologic/resource_sumologic_cse_rule_tuning_expression.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,37 +19,30 @@ func resourceSumologicCSERuleTuningExpression() *schema.Resource {
1919
"description": {
2020
Type: schema.TypeString,
2121
Required: true,
22-
ForceNew: false,
2322
},
2423
"name": {
2524
Type: schema.TypeString,
2625
Required: true,
27-
ForceNew: false,
2826
},
2927
"expression": {
3028
Type: schema.TypeString,
3129
Required: true,
32-
ForceNew: false,
3330
},
3431
"enabled": {
3532
Type: schema.TypeBool,
3633
Required: true,
37-
ForceNew: false,
3834
},
3935
"exclude": {
4036
Type: schema.TypeBool,
4137
Required: true,
42-
ForceNew: false,
4338
},
4439
"is_global": {
4540
Type: schema.TypeBool,
4641
Required: true,
47-
ForceNew: false,
4842
},
4943
"rule_ids": {
5044
Type: schema.TypeList,
5145
Required: true,
52-
ForceNew: false,
5346
Elem: &schema.Schema{
5447
Type: schema.TypeString,
5548
},
@@ -115,7 +108,7 @@ func resourceSumologicCSERuleTuningExpressionCreate(d *schema.ResourceData, meta
115108
d.SetId(id)
116109
}
117110

118-
return resourceSumologicCSERuleTuningExpressionUpdate(d, meta)
111+
return resourceSumologicCSERuleTuningExpressionRead(d, meta)
119112
}
120113

121114
func resourceSumologicCSERuleTuningExpressionUpdate(d *schema.ResourceData, meta interface{}) error {

sumologic/sumologic_client.go

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"fmt"
88
"io"
99
"io/ioutil"
10+
"log"
1011
"net/http"
1112
"net/url"
1213
"time"
@@ -28,15 +29,16 @@ type Client struct {
2829
var ProviderVersion string
2930

3031
var endpoints = map[string]string{
31-
"us1": "https://api.sumologic.com/api/",
32-
"us2": "https://api.us2.sumologic.com/api/",
33-
"fed": "https://api.fed.sumologic.com/api/",
34-
"eu": "https://api.eu.sumologic.com/api/",
35-
"au": "https://api.au.sumologic.com/api/",
36-
"de": "https://api.de.sumologic.com/api/",
37-
"jp": "https://api.jp.sumologic.com/api/",
38-
"ca": "https://api.ca.sumologic.com/api/",
39-
"in": "https://api.in.sumologic.com/api/",
32+
"us1": "https://api.sumologic.com/api/",
33+
"us2": "https://api.us2.sumologic.com/api/",
34+
"fed": "https://api.fed.sumologic.com/api/",
35+
"eu": "https://api.eu.sumologic.com/api/",
36+
"au": "https://api.au.sumologic.com/api/",
37+
"de": "https://api.de.sumologic.com/api/",
38+
"jp": "https://api.jp.sumologic.com/api/",
39+
"ca": "https://api.ca.sumologic.com/api/",
40+
"in": "https://api.in.sumologic.com/api/",
41+
"nite": "https://nite-api.sumologic.net/api/",
4042
}
4143

4244
var rateLimiter = time.NewTicker(time.Minute / 240)
@@ -132,8 +134,10 @@ func (s *Client) GetWithCookies(urlPath string, cookies []*http.Cookie) ([]byte,
132134
func (s *Client) Post(urlPath string, payload interface{}) ([]byte, error) {
133135
relativeURL, _ := url.Parse(urlPath)
134136
sumoURL := s.BaseURL.ResolveReference(relativeURL)
135-
137+
log.Printf("[INFO] Post URL: %s", sumoURL)
136138
body, _ := json.Marshal(payload)
139+
140+
log.Printf("[INFO] POST body: %s", body)
137141
req, err := createNewRequest(http.MethodPost, sumoURL.String(), bytes.NewBuffer(body), s.AccessID, s.AccessKey)
138142
if err != nil {
139143
return nil, err
@@ -189,10 +193,12 @@ func (s *Client) PostRawPayload(urlPath string, payload string) ([]byte, error)
189193
func (s *Client) Put(urlPath string, payload interface{}) ([]byte, error) {
190194
relativeURL, _ := url.Parse(urlPath)
191195
sumoURL := s.BaseURL.ResolveReference(relativeURL)
192-
196+
log.Printf("[INFO] Put URL: %s", sumoURL)
193197
_, etag, _ := s.Get(sumoURL.String())
194198

195199
body, _ := json.Marshal(payload)
200+
201+
log.Printf("[INFO] PUT body: %s", body)
196202
req, err := createNewRequest(http.MethodPut, sumoURL.String(), bytes.NewBuffer(body), s.AccessID, s.AccessKey)
197203
if err != nil {
198204
return nil, err
@@ -225,7 +231,7 @@ func (s *Client) Put(urlPath string, payload interface{}) ([]byte, error) {
225231
func (s *Client) Get(urlPath string) ([]byte, string, error) {
226232
relativeURL, _ := url.Parse(urlPath)
227233
sumoURL := s.BaseURL.ResolveReference(relativeURL)
228-
234+
log.Printf("[INFO] Get URL: %s", sumoURL)
229235
req, err := createNewRequest(http.MethodGet, sumoURL.String(), nil, s.AccessID, s.AccessKey)
230236
if err != nil {
231237
return nil, "", err
@@ -246,7 +252,7 @@ func (s *Client) Get(urlPath string) ([]byte, string, error) {
246252
if err != nil {
247253
return nil, "", err
248254
}
249-
255+
log.Printf("[INFO] Get response: %s", string(d))
250256
if resp.StatusCode == 404 {
251257
return nil, "", nil
252258
} else if resp.StatusCode >= 400 {
@@ -259,7 +265,7 @@ func (s *Client) Get(urlPath string) ([]byte, string, error) {
259265
func (s *Client) Delete(urlPath string) ([]byte, error) {
260266
relativeURL, _ := url.Parse(urlPath)
261267
sumoURL := s.BaseURL.ResolveReference(relativeURL)
262-
268+
log.Printf("[INFO] Delete URL: %s", sumoURL)
263269
req, err := createNewRequest(http.MethodDelete, sumoURL.String(), nil, s.AccessID, s.AccessKey)
264270
if err != nil {
265271
return nil, err

website/docs/r/cse_insights_configuration.html.markdown

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ The following attributes are exported:
2929

3030
## Import
3131

32-
Insights Configuration can be imported using the field id, e.g.:
32+
Insights Configuration can be imported using the id `cse-insights-configuration`:
33+
34+
~> **NOTE:** Only `cse-insights-configuration` id should be used when importing hte insights configuration. Using any other id may have unintended consequences.
35+
3336
```hcl
34-
terraform import sumologic_cse_insights_configuration.insights_configuration ID
37+
terraform import sumologic_cse_insights_configuration.insights_configuration cse-insights-configuration
3538
```

0 commit comments

Comments
 (0)