Skip to content

Commit e9192c3

Browse files
committed
add to docs and changelog; clean var name
1 parent b8b358f commit e9192c3

File tree

5 files changed

+44
-23
lines changed

5 files changed

+44
-23
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## 2.10.0 (Unreleased)
22

3+
* Add a provider option `admin_mode`
4+
35
FEATURES:
46

57
* **New Resource:** sumologic_hierarchy (GH-260)

sumologic/provider.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func Provider() terraform.ResourceProvider {
3636
Optional: true,
3737
Default: os.Getenv("SUMOLOGIC_BASE_URL"),
3838
},
39-
"admin": {
39+
"admin_mode": {
4040
Type: schema.TypeBool,
4141
Optional: true,
4242
Default: false,
@@ -123,7 +123,7 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
123123
accessKey := d.Get("access_key").(string)
124124
environment := d.Get("environment").(string)
125125
baseUrl := d.Get("base_url").(string)
126-
isAdmin := d.Get("admin").(bool)
126+
isInAdminMode := d.Get("admin_mode").(bool)
127127

128128
msg := ""
129129
if accessId == "" {
@@ -158,6 +158,6 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
158158
accessKey,
159159
environment,
160160
baseUrl,
161-
isAdmin,
161+
isInAdminMode,
162162
)
163163
}

sumologic/sumologic_client.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ type HttpClient interface {
1717
}
1818

1919
type Client struct {
20-
AccessID string
21-
AccessKey string
22-
Environment string
23-
BaseURL *url.URL
24-
IsAdmin bool
25-
httpClient HttpClient
20+
AccessID string
21+
AccessKey string
22+
Environment string
23+
BaseURL *url.URL
24+
IsInAdminMode bool
25+
httpClient HttpClient
2626
}
2727

2828
var ProviderVersion string
@@ -139,7 +139,7 @@ func (s *Client) Post(urlPath string, payload interface{}) ([]byte, error) {
139139
return nil, err
140140
}
141141

142-
if s.IsAdmin {
142+
if s.IsInAdminMode {
143143
req.Header.Add("isAdminMode", "true")
144144
}
145145

@@ -199,7 +199,7 @@ func (s *Client) Put(urlPath string, payload interface{}) ([]byte, error) {
199199
}
200200
req.Header.Add("If-Match", etag)
201201

202-
if s.IsAdmin {
202+
if s.IsInAdminMode {
203203
req.Header.Add("isAdminMode", "true")
204204
}
205205

@@ -231,7 +231,7 @@ func (s *Client) Get(urlPath string) ([]byte, string, error) {
231231
return nil, "", err
232232
}
233233

234-
if s.IsAdmin {
234+
if s.IsInAdminMode {
235235
req.Header.Add("isAdminMode", "true")
236236
}
237237

@@ -265,7 +265,7 @@ func (s *Client) Delete(urlPath string) ([]byte, error) {
265265
return nil, err
266266
}
267267

268-
if s.IsAdmin {
268+
if s.IsInAdminMode {
269269
req.Header.Add("isAdminMode", "true")
270270
}
271271

@@ -290,11 +290,11 @@ func (s *Client) Delete(urlPath string) ([]byte, error) {
290290

291291
func NewClient(accessID, accessKey, environment, base_url string, admin bool) (*Client, error) {
292292
client := Client{
293-
AccessID: accessID,
294-
AccessKey: accessKey,
295-
httpClient: http.DefaultClient,
296-
Environment: environment,
297-
IsAdmin: admin,
293+
AccessID: accessID,
294+
AccessKey: accessKey,
295+
httpClient: http.DefaultClient,
296+
Environment: environment,
297+
IsInAdminMode: admin,
298298
}
299299

300300
if base_url == "" {

website/docs/d/admin_recommended_folder.html.markdown

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ description: |-
55
Provides an easy way to retrieve the Admin Recommended Folder.
66
---
77

8-
# sumologic_personal_folder
9-
Provides an easy way to retrieve the Personal Folder.
8+
# sumologic_admin_recommended_folder
9+
Provides an easy way to retrieve the Admin Recommended Folder.
1010

1111

1212
## Example Usage
@@ -19,9 +19,9 @@ data "sumologic_admin_recommended_folder" "folder" {}
1919

2020
The following attributes are exported:
2121

22-
- `id` - The ID of the Personal Folder.
23-
- `name` - The name of the Personal Folder.
24-
- `description` - The description of the Personal Folder.
22+
- `id` - The ID of the Admin Recommended Folder.
23+
- `name` - The name of the Admin Recommended Folder.
24+
- `description` - The description of the Admin Recommended Folder.
2525

2626

2727

website/docs/index.html.markdown

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,25 @@ resource "sumologic_http_source" "http_source" {
5050
collector_id = "${sumologic_collector.collector.id}"
5151
}
5252
53+
# Configure the Sumo Logic Provider in Admin Mode
54+
provider "sumologic" {
55+
access_id = "${var.sumologic_access_id}"
56+
access_key = "${var.sumologic_access_key}"
57+
environment = "us2"
58+
admin_mode = true
59+
alias = "admin"
60+
}
61+
62+
# Look up the Admin Recommended Folder
63+
data "sumologic_admin_recommended_folder" "folder" {}
64+
65+
# Create a folder underneath the Admin Recommended Folder (which requires Admin Mode)
66+
resource "sumologic_folder" "test" {
67+
provider = sumologic.admin
68+
name = "test"
69+
description = "A test folder"
70+
parent_id = data.sumologic_admin_recommended_folder.folder.id
71+
}
5372
```
5473

5574
## Authentication

0 commit comments

Comments
 (0)