Terraform overrides

Digger uses Terraform under the hood. You can add your custom Terraform code that will be picked it up during compilation (while running generate command). This means that you have full control over the way infrastructure is implemented.

Overrides can be block-level or top-level. This is just a convention, behaviour is the same.

To use overrides, just add your Terraform files into the relevant /overrides directory.

├── myAppBlock
│   └── overrides
├── dgctl.json
└── overrides
  • If a .tf file with the same name is produced by Digger (see in generated folder), then the file is going to be replaced. You may want to manually copy the attributes you want to keep from the auto-generated file.

  • Otherwise your .tf file will be simply added and run in the same Terraform context as others

TODO: should the overrides behavior actually be the same for block-level and top-level? At the moment it is, but maybe we should pass different options based on the block type or smth similar.

TODO: smarter override merging logic. Maybe some kind of a "smart merge" option that will add-or-replace attrribute-by-attribute in HCL, not file-by-file

Last updated