Skip to content

feat(jobs): support secret manager references in serverless jobs defi… #3030

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 15, 2025
Merged
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
3 changes: 1 addition & 2 deletions cmd/tftemplate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import (
"log"
"text/template"

"tftemplate/models"

"github.com/AlecAivazis/survey/v2"
"tftemplate/models"
)

var (
Expand Down
36 changes: 36 additions & 0 deletions docs/resources/job_definition.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,35 @@ resource scaleway_job_definition main {
}
```

### With Secret Reference

```terraform
resource scaleway_job_definition main {
name = "testjob"
cpu_limit = 140
memory_limit = 256
image_uri = "docker.io/alpine:latest"
command = "ls"
timeout = "10m"
cron {
schedule = "5 4 1 * *" # cron at 04:05 on day-of-month 1
timezone = "Europe/Paris"
}
secret_reference {
secret_id = "11111111-1111-1111-1111-111111111111"
file = "/home/dev/secret_file"
}
secret_reference {
secret_id = scaleway_secret.job_secret.id
secret_version = "1"
environment = "FOO"
}
}
```

## Argument Reference

The following arguments are supported:
Expand All @@ -48,6 +77,13 @@ The following arguments are supported:
- `timezone` - The timezone, must be a canonical TZ identifier as found in this [list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#regions) of the Job.
- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the Job is associated with.
- `secret_reference` - (Optional) A reference to a secret stored in [Secret Manager](../resources/secret.md).
- `secret_id` - (Required) The secret unique identifier, it could be formatted as region/UUID or UUID. In case the region is passed, it must be the same as the job definition. You could reference the same secret multiple times in the same job definition.
- `secret_version` - (Default: `latest`) The secret version.
- `file` - (Optional) The absolute file path where the secret will be mounted. Must be specified if `environment` is not specified.
- `environment` - (Optional) An environment variable containing the secret value. Must be specified if `file` is not specified.
- `secret_reference_id` - The secret reference UUID that is automatically generated by the provider.


## Attributes Reference

Expand Down
215 changes: 0 additions & 215 deletions internal/services/jobs/definition_test.go

This file was deleted.

Loading
Loading