Skip to content

Commit 05db6f7

Browse files
committed
SUMO-172016 changes per code review comments
1 parent e677dc2 commit 05db6f7

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

sumologic/provider.go

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,14 @@ func Provider() terraform.ResourceProvider {
1818
Schema: map[string]*schema.Schema{
1919
"access_id": {
2020
Type: schema.TypeString,
21-
Optional: true,
21+
Required: true,
2222
DefaultFunc: schema.EnvDefaultFunc("SUMOLOGIC_ACCESSID", nil),
2323
},
2424
"access_key": {
2525
Type: schema.TypeString,
26-
Optional: true,
26+
Required: true,
2727
DefaultFunc: schema.EnvDefaultFunc("SUMOLOGIC_ACCESSKEY", nil),
2828
},
29-
"auth_jwt": {
30-
Type: schema.TypeString,
31-
Optional: true,
32-
DefaultFunc: schema.EnvDefaultFunc("SUMOLOGIC_AUTHJWT", nil),
33-
},
3429
"environment": {
3530
Type: schema.TypeString,
3631
Optional: true,
@@ -143,32 +138,22 @@ func resolveRedirectURL(accessId string, accessKey string, authJwt string) (stri
143138
func providerConfigure(d *schema.ResourceData) (interface{}, error) {
144139
accessId := d.Get("access_id").(string)
145140
accessKey := d.Get("access_key").(string)
146-
authJwt := d.Get("auth_jwt").(string)
141+
authJwt := os.Getenv("SUMOLOGIC_AUTHJWT")
147142
environment := d.Get("environment").(string)
148143
baseUrl := d.Get("base_url").(string)
149144
isInAdminMode := d.Get("admin_mode").(bool)
150145

151146
msg := ""
152147
if authJwt == "" {
153148
if accessId == "" || accessKey == "" {
154-
msg = "sumologic provider: auth_jwt is not set;"
149+
msg = "sumologic provider: "
155150
}
156151
if accessId == "" {
157152
msg = fmt.Sprintf("%s access_id should be set;", msg)
158153
}
159154
if accessKey == "" {
160155
msg = fmt.Sprintf("%s access_key should be set; ", msg)
161156
}
162-
} else {
163-
if accessId != "" || accessKey != "" {
164-
msg = "sumologic provider: auth_jwt is set;"
165-
}
166-
if accessId != "" {
167-
msg = fmt.Sprintf("%s access_id should not be set;", msg)
168-
}
169-
if accessKey != "" {
170-
msg = fmt.Sprintf("%s access_key should not be set; ", msg)
171-
}
172157
}
173158

174159
if environment == "" && baseUrl == "" {

0 commit comments

Comments
 (0)