{"id":15156368,"url":"https://github.com/norbjd/scaleway-serverless-module","last_synced_at":"2026-01-26T18:57:45.156Z","repository":{"id":219465604,"uuid":"749115199","full_name":"norbjd/scaleway-serverless-module","owner":"norbjd","description":"A Terraform module to easily create Scaleway serverless functions and containers.","archived":false,"fork":false,"pushed_at":"2024-01-31T19:17:53.000Z","size":45,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-13T16:50:28.011Z","etag":null,"topics":["scaleway","scaleway-serverless","serverless","terraform","terraform-module"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/norbjd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-27T16:17:05.000Z","updated_at":"2024-04-08T11:09:35.000Z","dependencies_parsed_at":"2024-06-21T14:27:21.293Z","dependency_job_id":"b96f6dc7-b79f-491d-946c-403acfb12b25","html_url":"https://github.com/norbjd/scaleway-serverless-module","commit_stats":null,"previous_names":["norbjd/scaleway-serverless-module"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/norbjd%2Fscaleway-serverless-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/norbjd%2Fscaleway-serverless-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/norbjd%2Fscaleway-serverless-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/norbjd%2Fscaleway-serverless-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/norbjd","download_url":"https://codeload.github.com/norbjd/scaleway-serverless-module/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247666018,"owners_count":20975789,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["scaleway","scaleway-serverless","serverless","terraform","terraform-module"],"created_at":"2024-09-26T19:20:37.468Z","updated_at":"2026-01-26T18:57:40.105Z","avatar_url":"https://github.com/norbjd.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# scaleway-serverless-module\n\nA Terraform module to easily create Scaleway serverless functions and containers.\n\n\u003e [!WARNING]\n\u003e - this module is a work in progress, so **use with caution**\n\u003e - this module is **NOT** endorsed - nor supported - by Scaleway\n\nCreates serverless functions and containers resources from a YAML config file.\n\n## Example\n\n`scaleway_serverless_config.yaml`:\n\n```yaml\nfunction_namespaces:\n  - name: my-namespace-1\n    region: ${region}\n    project_id: ${project_id}\n    description: \"1st namespace\"\n    environment_variables:\n      - key: var1\n        value: value1\n    secret_environment_variables:\n      - key: secret_var1\n        value: ${secret_var1}\n    functions:\n      - name: func1\n        runtime: node20\n        memory_limit: 512\n        handler: handler.handle\n        source: ./func1\n        privacy: private\n        description: \"Just a simple function\"\n        min_scale: 0\n        max_scale: 10\n        timeout: 300\n        triggers:\n          crons:\n            - name: cron1\n              schedule: 0 0 * * *\n              json_args: |\n                {\n                  \"key1\": \"value1\",\n                  \"key2\": \"value2\"\n                }\n          sqs:\n            - name: trigger-sqs-1\n              queue: queue1\n          nats:\n             - name: trigger-nats-1\n               account_id: \"AXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\"\n               subject: subject1\n        domains:\n           - some.domain.example.com\n        tokens:\n          - description: a function token\n            expires_at: \"2100-01-01T00:00:00+00:00\"\ncontainer_namespaces:\n  - name: my-namespace-1\n    region: ${region}\n    project_id: ${project_id}\n    containers:\n      - name: custom-nginx\n        cpu_limit: 240\n        memory_limit: 512\n        build:\n          context: ./custom_nginx\n        port: 80\n        privacy: public\n        min_scale: 0\n        max_scale: 10\n```\n\n\u003e [!WARNING]\n\u003e Paths inside the config file (`function_namespaces.functions.source` or `container_namespaces.namespaces.build.context`) **MUST** be relative to the config file.\n\nThe config file also supports templating. You can inject variables by defining a `.scaleway_serverless_config.env.yaml` file:\n\n```yaml\nregion: \"fr-par\"\nsecret_var1: \"something\"\nproject_id: \"00000000-0000-0000-0000-000000000000\"\n```\n\n## Motivation\n\nThis module is particularly useful for users that don't want to write resources with Terraform as it can be somehow verbose.\n\nJust write a YAML file `scaleway_serverless_config.yaml` describing your resources (everybody loves YAML, see [format](#config-file-format)), your functions/containers code/images, and the following Terraform definition:\n\n```hcl\nterraform {\n  required_providers {\n    scaleway = {\n      source  = \"scaleway/scaleway\"\n      version = \"\u003e= 2.36.0\"\n    }\n  }\n}\n\n// you must pass at least SCW_ACCESS_KEY and SCW_SECRET_KEY environment variables\n// or, configure Scaleway provider as you want if you want to manage other Scaleway resources\nprovider \"scaleway\" {}\n\n// optional: **only** if you want to build and push custom containers\nvariable \"push_images_secret_key\" {\n  type    = string\n  default = \"\"\n}\n\nmodule \"scaleway_serverless\" {\n  source = \"git::https://github.com/norbjd/scaleway-serverless-module.git?ref=main\"\n\n  container_push_secret_key = var.push_images_secret_key // optional\n}\n```\n\nAnd voilà!\n\n## Requirements\n\nIf you're using this module to build custom container images, `docker` **MUST** be installed, because it's used to build and push the images. If so, provide a valid value for the `container_push_secret_key` variable: this secret key will be used to push images to SCW container registry.\n\n## Config file format\n\nConfig file must be in YAML format, and must match the JSON schema located [here](scaleway-serverless-module-validator/config_json_schema.json).\n\n\u003e [!WARNING]\n\u003e JSON schema is far from being perfect, but it helps to catch obvious errors. I'll refine this schema with the time.\n\n### Validate the config file\n\nTo validate the config file, you can use the validator provided [here](scaleway-serverless-module-validator/):\n\n```shell\ngo install github.com/norbjd/scaleway-serverless-module/scaleway-serverless-module-validator@main\n\nscaleway-serverless-module-validator -context-dir /path/to/dir\n```\n\nI highly encourage users to run the validator before running any `terraform` operation to catch common mistakes (e.g. invalid function name) before getting rejected by `terraform`, or worse, getting a cryptic error from the module (e.g. if `function_namespaces` contains a `string` instead of an `object`).\n\nWhen developing locally, it's useful to add the JSON schema when editing config files, to have a quicker feedback:\n\n- with JetBrains based IDEs: https://www.jetbrains.com/help/idea/json.html#ws_json_schema_add_custom\n- with code: add `# yaml-language-server: $schema=https://raw.githubusercontent.com/norbjd/scaleway-serverless-module/main/scaleway-serverless-module-validator/config_json_schema.json` at the top of the YAML file, assuming you have installed [this extension](https://github.com/redhat-developer/yaml-language-server)\n\nSee also [validator's README.md](scaleway-serverless-module-validator/README.md) for more details.\n\n## Examples\n\nSee [examples/full_example/scaleway_serverless_config.yaml](examples/full_example/scaleway_serverless_config.yaml) for a full example.\n\nThis YAML config file supports templating: define values in a `.scaleway_serverless_config.env.yaml` file (see [examples/full_example/.scaleway_serverless_config.env.yaml](examples/full_example/.scaleway_serverless_config.env.yaml)).\n\n## Functions\n\nWhen building the archive containing the function code, some files or folders could be ignored. This is useful to avoid putting not needed files in the archive.\n\nTo ignore files, just put a `.scaleway_serverless.ignore` alongside the function directory. Each line of the file is a file or folder that will be ignored when packaging:\n\n```ignore\na_file_to_ignore\na_folder_to_ignore\n```\n\n\u003e [!WARNING]\n\u003e This doesn't support wildcards.\n\u003e When ignoring folders, **DON'T** put `/` at the end.\n\n## Terraform module details\n\n\u003c!-- BEGIN_TF_DOCS --\u003e\n### Requirements\n\n| Name | Version |\n|------|---------|\n| \u003ca name=\"requirement_scaleway\"\u003e\u003c/a\u003e [scaleway](#requirement\\_scaleway) | \u003e= 2.36.0 |\n\n### Providers\n\n| Name | Version |\n|------|---------|\n| \u003ca name=\"provider_archive\"\u003e\u003c/a\u003e [archive](#provider\\_archive) | n/a |\n| \u003ca name=\"provider_null\"\u003e\u003c/a\u003e [null](#provider\\_null) | n/a |\n| \u003ca name=\"provider_scaleway\"\u003e\u003c/a\u003e [scaleway](#provider\\_scaleway) | \u003e= 2.36.0 |\n| \u003ca name=\"provider_time\"\u003e\u003c/a\u003e [time](#provider\\_time) | n/a |\n\n### Modules\n\nNo modules.\n\n### Resources\n\n| Name | Type |\n|------|------|\n| [null_resource.check_container_images_build_prerequisites](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |\n| [scaleway_container.containers](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/container) | resource |\n| [scaleway_container_cron.container_crons](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/container_cron) | resource |\n| [scaleway_container_domain.container_domains](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/container_domain) | resource |\n| [scaleway_container_namespace.namespaces](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/container_namespace) | resource |\n| [scaleway_container_token.container_tokens](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/container_token) | resource |\n| [scaleway_container_token.namespace_tokens](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/container_token) | resource |\n| [scaleway_container_trigger.container_nats_triggers](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/container_trigger) | resource |\n| [scaleway_container_trigger.container_sqs_triggers](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/container_trigger) | resource |\n| [scaleway_function.functions](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/function) | resource |\n| [scaleway_function_cron.function_crons](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/function_cron) | resource |\n| [scaleway_function_domain.function_domains](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/function_domain) | resource |\n| [scaleway_function_namespace.namespaces](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/function_namespace) | resource |\n| [scaleway_function_token.function_tokens](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/function_token) | resource |\n| [scaleway_function_token.namespace_tokens](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/function_token) | resource |\n| [scaleway_function_trigger.function_nats_triggers](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/function_trigger) | resource |\n| [scaleway_function_trigger.function_sqs_triggers](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/function_trigger) | resource |\n| [time_static.container_built_images](https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/static) | resource |\n| [archive_file.functions](https://registry.terraform.io/providers/hashicorp/archive/latest/docs/data-sources/file) | data source |\n\n### Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| \u003ca name=\"input_config_filename\"\u003e\u003c/a\u003e [config\\_filename](#input\\_config\\_filename) | Name of the config file. This file must be located in context\\_dir | `string` | `\"scaleway_serverless_config.yaml\"` | no |\n| \u003ca name=\"input_container_push_secret_key\"\u003e\u003c/a\u003e [container\\_push\\_secret\\_key](#input\\_container\\_push\\_secret\\_key) | If you're using containers with custom images, this is the SCW secret key used to push images in the SCW container registry after building them. | `string` | `\"\"` | no |\n| \u003ca name=\"input_context_dir\"\u003e\u003c/a\u003e [context\\_dir](#input\\_context\\_dir) | The base directory where config is located, and from which relative paths (e.g. functions codes, containers build context) are resolved | `string` | `\".\"` | no |\n| \u003ca name=\"input_env_filename\"\u003e\u003c/a\u003e [env\\_filename](#input\\_env\\_filename) | Name of the file used to store variables used to template the config file. This file must be located in context\\_dir | `string` | `\".scaleway_serverless_config.env.yaml\"` | no |\n\n### Outputs\n\nNo outputs.\n\u003c!-- END_TF_DOCS --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnorbjd%2Fscaleway-serverless-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnorbjd%2Fscaleway-serverless-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnorbjd%2Fscaleway-serverless-module/lists"}