Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions internal/services/jobs/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ func ResourceDefinition() *schema.Resource {
"secret_reference_id": {
Type: schema.TypeString,
Computed: true,
Optional: true,
Description: "The secret reference UUID",
},
"secret_version": {
Expand All @@ -150,6 +151,8 @@ func ResourceDefinition() *schema.Resource {
},
},
},
EnableLegacyTypeSystemPlanErrors: true,
EnableLegacyTypeSystemApplyErrors: true,
}
}

Expand Down Expand Up @@ -234,14 +237,22 @@ func ResourceJobDefinitionRead(ctx context.Context, d *schema.ResourceData, m an
_ = d.Set("cpu_limit", int(definition.CPULimit))
_ = d.Set("memory_limit", int(definition.MemoryLimit))
_ = d.Set("image_uri", definition.ImageURI)
_ = d.Set("command", definition.Command)
_ = d.Set("env", types.FlattenMap(definition.EnvironmentVariables))
_ = d.Set("description", definition.Description)
if _, ok := d.GetOk("command"); ok {
d.Set("command", definition.Command)
}
if _, ok := d.GetOk("env"); ok {
_ = d.Set("env", types.FlattenMap(definition.EnvironmentVariables))
}
if _, ok := d.GetOk("description"); ok {
_ = d.Set("description", definition.Description)
}
_ = d.Set("timeout", definition.JobTimeout.ToTimeDuration().String())
_ = d.Set("cron", flattenJobDefinitionCron(definition.CronSchedule))
_ = d.Set("region", definition.Region)
_ = d.Set("project_id", definition.ProjectID)
_ = d.Set("secret_reference", flattenJobDefinitionSecret(rawSecretRefs.Secrets))
if _, ok := d.GetOk("secret_reference"); ok {
_ = d.Set("secret_reference", flattenJobDefinitionSecret(rawSecretRefs.Secrets))
}

return nil
}
Expand Down
4 changes: 2 additions & 2 deletions internal/services/jobs/jobs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestAccJobDefinition_Timeout(t *testing.T) {
cpu_limit = 120
memory_limit = 256
image_uri = "docker.io/alpine:latest"
timeout = "20m"
timeout = "20m0s"
}
`,
Check: resource.ComposeTestCheckFunc(
Expand All @@ -78,7 +78,7 @@ func TestAccJobDefinition_Timeout(t *testing.T) {
cpu_limit = 120
memory_limit = 256
image_uri = "docker.io/alpine:latest"
timeout = "1h30m"
timeout = "1h30m0s"
}
`,
Check: resource.ComposeTestCheckFunc(
Expand Down
Loading