When implementing configuration features (variables, flags, resources), thoroughly document their behavior in all scenarios, especially edge cases and interactions with dependencies. Configuration options should have well-defined and tested behaviors across all contexts where they might be used.
When implementing configuration features (variables, flags, resources), thoroughly document their behavior in all scenarios, especially edge cases and interactions with dependencies. Configuration options should have well-defined and tested behaviors across all contexts where they might be used.
For features like ephemeral resources, variable marks, or command flags like -exclude
, ensure you clearly specify:
# When using ephemeral variables, document if and how the mark propagates
variable "secret" {
type = string
ephemeral = true
}
locals {
# Does this local automatically become ephemeral too?
config = "${var.secret}_suffix"
}
# When implementing features like -exclude, document how dependencies are handled
# For example, when excluding resource A that resource B depends on:
resource "null_resource" "a" {}
resource "null_resource" "b" {
triggers = {
a_id = null_resource.a.id
}
}
# Document: Will `tofu plan -exclude=null_resource.a` also exclude resource B?
When introducing new marks or configuration attributes, thoroughly test their interactions with existing marks to prevent subtle bugs. For example, ensure sensitive()
doesn’t accidentally strip ephemeral marks, and that marked values maintain their properties when transformed or combined.
Enter the URL of a public GitHub repository