Convox Community

Default environment variables don't apply to resources

As far as I can tell, given a config like:

resources:
  database:
    type: postgres
    options:
      class: "${DATABASE_CLASS}"
      durable: false
      encrypted: "${DATABASE_DURABLE}"
      storage: "${DATABASE_STORAGE}"
      version: '9.6'
services:
  web:
    build: .
    command: bundle exec rails server -b 0.0.0.0 -p 3000
    port: 3000
    resources:
      - database
environment:
  - DATABASE_CLASS=db.t3.micro
  - DATABASE_STORAGE=32
  - DATABASE_DURABLE=false

The default values for the DATABASE_* environment variables don’t apply when cloudfront goes to set up the resource. I have to set them with

convox env set DATABASE_CLASS=db.t3.micro DATABASE_STORAGE=32 DATABASE_DURABLE=false

for the resource configuration to apply. It sounds like this is the expected behavior, as the documentation doesn’t mention anything about environment applying to resources, but I think people are likely to assume that’s how it works.