Skip to content

Commit 793d2c8

Browse files
committed
feature/cml_token
1 parent a3b40aa commit 793d2c8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

iterative/resource_runner.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ func resourceRunnerCreate(ctx context.Context, d *schema.ResourceData, m interfa
126126

127127
utils.SetId(d)
128128

129+
token := os.Getenv("CML_TOKEN")
130+
if len(d.Get("token").(string)) == 0 && len(token) != 0 {
131+
d.Set("token", token)
132+
}
133+
129134
startupScript, err := provisionerCode(d)
130135
if err != nil {
131136
diags = append(diags, diag.Diagnostic{
@@ -136,8 +141,7 @@ func resourceRunnerCreate(ctx context.Context, d *schema.ResourceData, m interfa
136141
}
137142
d.Set("startup_script", startupScript)
138143

139-
cloud := d.Get("cloud").(string)
140-
if len(cloud) == 0 {
144+
if len(d.Get("cloud").(string)) == 0 {
141145
diags = append(diags, diag.Diagnostic{
142146
Severity: diag.Error,
143147
Summary: fmt.Sprintf("Local runner not yet implemented"),

0 commit comments

Comments
 (0)