Skip to content

Default parameters for modules in astro.yaml #57

@btromanova

Description

@btromanova

Sometimes we have to add the same configuration to all the modules, it'd be great if astro
allows to specify default values that apply for everything and can be overwritten if needed.

Having an ability to specify default values for modules has the following advantages:

  • eliminate code duplication
  • prevent human errors (oops, I forgot to add this line to a new module)
  • central place for further configuration changes

Proposed example:
without default parameters:

---

terraform:
  version: <>

modules:
  - name: module1
    remote:
      backend_config:
        bucket: bucket
        region: us-east-1
        key: module1
        dynamodb_table: table

  - name: module2
    remote:
      backend_config:
        bucket: bucket
        region: us-west-1
        key: module2
        dynamodb_table: table

With default parameters

---

terraform:
  version: <>

default:
  remote:
    backend_config:
      bucket: bucket
      region: us-east-1
      dynamodb_table: table

modules:
  - name: module1
    remote:
      backend_config:
        key: module1

  - name: module2
    remote:
      backend_config:
        key: module2
        region: us-west-1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions