Terraform overrides
The Golden Path uses Boilerplate templating to set up your infrastructure. To ensure you will get all the benefits from being on the Golden Path, we recommend that you use Terraform overrides when you need to diverge from the path.
You can learn more about how to use overrides in the HashiCorp documentation for override files.
Reference implementation
See how we have used Terraform overrides in pirates-iac
.
Why should you use overrides?
Overrides enable you to make isolated changes based on your individual needs, but still continue to receive relevant updates to your infrastructure. We gather data about which overrides teams create, and will incorporate them in the Golden Path when possible.
Frequently asked questions
What if I don't need a resource created by Boilerplate?
Considerations
Before you remove resources from Boilerplate you should consider if the change you need could be done as a feature toggle in Boilerplate. You should also consider that other parts of the Golden Path may depend on the resource you are trying to remove. Removing resources in this way should be a last resort.
You can remove a resource added by Boilerplate by adding a count
to the resource. Given the following Terraform code:
resource "aws_s3_bucket" "example" {
bucket = "my-tf-test-bucket"
tags = {
Name = "My bucket"
Environment = "Dev"
}
}
Adding a count
override to the resource in a file with the ending _override.tf
removes the resource: