astro icon indicating copy to clipboard operation
astro copied to clipboard

Default parameters for modules in astro.yaml

Open btromanova opened this issue 6 years ago • 0 comments

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

btromanova avatar Jan 03 '20 15:01 btromanova