This repository was archived by the owner on Feb 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
This repository was archived by the owner on Feb 14, 2023. It is now read-only.
Dynamic list of imported resources #11
Copy link
Copy link
Open
Description
Is there a way to dinamically provide the list of resources to include depending on some other value (eg: provider.region) ?
I've tried several approaches but none of them worked.
- Use a variable in path
custom:
import:
- resources/resource.${self:provider.region}.yml
cannot find the file. I think is trying to import it before variable value expansion.
Cannot import resources/resource.${self:provider.region}.yml: the given file doesn't exist
- Relying on serverless variable expansion (it works well with other config elements)
custom:
import: ${file(resources/resource.${self:provider.region}.yml):import}
cannot find the file either. I think it is the same reason.
Cannot import ${file(resources/resource.${self:provider.region}.yml):import}: the given module cannot be resolved
Tried:
- ${file(resources/resource.${self:provider.region}.yml):import}/serverless.yml
- ${file(resources/resource.${self:provider.region}.yml):import}/serverless.yaml
- ${file(resources/resource.${self:provider.region}.yml):import}/serverless.js
- Finally I've tried using
.jsimport (despite having to workaround .js modules not found #10)
custom:
import:
- module: resources.js
inputs:
region: ${self:provider.region}
and resources.js being:
module.exports = ({region}) => {
return {
custom: {
import: [
`resources/resource.${region}.yml`
]
}
}
}
with the same result:
Cause: Cannot import resources/resource.${self:provider.region}.yml: the given file doesn't exist
Does anyone know how to workaround this issue?
Metadata
Metadata
Assignees
Labels
No labels