terraform
terraform copied to clipboard
"Applied changes may be incomplete" please dont have warnings on common usage patterns
Terraform 0.12.24
Small issue really, but still:
terraform -target now gives you a warning that "Applied changes may be incomplete"
Is this really necessary? For a lot of people, -target
is, and must be part of their "routine" use, despite intended use by the hashicorp team.
Can this warning not be moved to the docs, or the cmdline docs, rather than on every valid use of the terraform command. It rather interrupts the visual assessment of whether there are actual problems or actual possible problems with the code.
Warnings are incredibly useful for deprecation, behaviour which might not be as you expect, or possible problems, whereas if the user has chosen to use -target
then they surely know exactly what they are doing and the consequences of it.
Still open... please push this topic.
No other option for our inline cluster-blue-green deployment via AGIC controller.
Having a warning that appears during normal operation makes it harder to train people on using TF, and causes warning fatigue which may lead to other, more important warnings being disregarded too.
The nature of the plan-apply design means that many common patterns that lead to a dependency from apply of one resource -> plan of another can only be implemented in one of three ways:
- Write your configuration in stages, not adding resources to the configuration until all resources that they need at plan time have been added. This makes code review cumbersome since what would logically be reviewed as a single unit must now be reviewed in (potentially many) small pieces instead.
- Write & review it all at once, but plan & apply multiple times, initially using
-target
, to allow resources to be applied before other resources that depend on them at plan time are considered. - Split your config into (potentially many) "layers" with plan-apply dependencies now being between totally separate TF configs. Has some of the downsides of option 1 with the additional downside of much higher CI/CD complexity.
Most orgs end up choosing option 2, which means they see constant warnings from TF while doing totally normal things. If Hashicorp wants people to stop using -target
then Terraform & providers would need to improve first to make it unnecessary, e.g. by having first-class support for the kind of dependencies between apply of one resource -> plan of another that actually exist in most configs beyond a certain size. I guess that would be a major design change and cause unacceptable churn, so getting rid of the excessive warning seems like a more reasonable path.