Skip to content

Commit 69ba1d4

Browse files
committed
provider/triton: Read TRITON_* as well as SDC_*
The Triton CLI tools have been using TRITON_* as their configuration environment variables for some time now. This commit makes Terraform use them in preference to any SDC_* variables set, and allows Terraform to work with the credentials set by the `triton env` in the CLI.
1 parent 192601b commit 69ba1d4

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎builtin/providers/triton/provider.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,25 @@ func Provider() terraform.ResourceProvider {
2222
"account": {
2323
Type: schema.TypeString,
2424
Required: true,
25-
DefaultFunc: schema.EnvDefaultFunc("SDC_ACCOUNT", ""),
25+
DefaultFunc: schema.MultiEnvDefaultFunc([]string{"TRITON_ACCOUNT", "SDC_ACCOUNT"}, ""),
2626
},
2727

2828
"url": {
2929
Type: schema.TypeString,
3030
Required: true,
31-
DefaultFunc: schema.EnvDefaultFunc("SDC_URL", "https://us-west-1.api.joyentcloud.com"),
31+
DefaultFunc: schema.MultiEnvDefaultFunc([]string{"TRITON_URL", "SDC_URL"}, "https://us-west-1.api.joyentcloud.com"),
3232
},
3333

3434
"key_material": {
3535
Type: schema.TypeString,
3636
Optional: true,
37-
DefaultFunc: schema.EnvDefaultFunc("SDC_KEY_MATERIAL", ""),
37+
DefaultFunc: schema.MultiEnvDefaultFunc([]string{"TRITON_KEY_MATERIAL", "SDC_KEY_MATERIAL"}, ""),
3838
},
3939

4040
"key_id": {
4141
Type: schema.TypeString,
4242
Required: true,
43-
DefaultFunc: schema.EnvDefaultFunc("SDC_KEY_ID", ""),
43+
DefaultFunc: schema.MultiEnvDefaultFunc([]string{"TRITON_KEY_ID", "SDC_KEY_ID"}, ""),
4444
},
4545
},
4646

0 commit comments

Comments
 (0)