Terraform: -target warning is opinionated

Created on 17 Feb 2020  路  4Comments  路  Source: hashicorp/terraform

SDK version

N/A

Use-cases

In agreement with this post :

https://discuss.hashicorp.com/t/target-warning-seems-innapropriate/4091

The warning about using -target is opinionated and not related to a syntax error or the use of a feature that is deprecated etc. There are perfectly legitimate use-cases for -target and being warned about it upon every invocation of Terraform is intrusive.

Attempted Solutions


N/A

Proposal

An informational warning such as this should have a corresponding flag or config option - for those of us who know why we are using it - to disable the warning.

References


https://github.com/hashicorp/terraform-plugin-sdk/pull/182/files

Most helpful comment

Just bumping this. Is there a plan to deprecate -target or will it just remain a warning? I'd rather get ahead of this by reworking our deploys if it will be deprecated. Thanks.

All 4 comments

Going to relocate this to core as I don't think its something handled on the SDK side of the codebase. The duplication of Terraform core code in this repository is solely for test execution, not the normal CLI code users execute.

We used terraform for over a year with -target during application deploys to target our ASG Launch Template. We filter for new AMI images (via filter) and want to isolate changes. Now everyone gets a page full of warnings on every deploy.

To my mind -target is an _essential_ feature of Terraform. It is poweful in more complex use cases involving bigger states where splitting in smaller states does not make sense, it offers the possibility to create modules just to allow the user to target them and avoid the other hundreds of resources (i.e. create modules for organization sake only with no purpose for reusability).

I hope this warning will disappear as Terraform improves, it makes me a bit worried that Terraform ends up to break -target driven states at some point as the warning is rather alarmist.

Just bumping this. Is there a plan to deprecate -target or will it just remain a warning? I'd rather get ahead of this by reworking our deploys if it will be deprecated. Thanks.

Was this page helpful?
0 / 5 - 0 ratings