terraform icon indicating copy to clipboard operation
terraform copied to clipboard

Ability to disable data source read messages during plan/apply

Open mgzenitech opened this issue 4 years ago • 7 comments

Current Terraform Version

v0.13.0-beta2

Use-cases

If terraform configuration has lots of different data sources that depend on other data sources or resources plan/apply gets spammed with useless messages about data sources being read, ie: Screenshot from 2020-07-08 13-29-37 and it becomes annoyance to search through all of these to actually find the resources that are going to have changes applied. t would be really nice to either have some sort of cli switch or

terraform {}

configuration option to disable these and only show the resources planned to be changed.

Attempted Solutions

Proposal

terraform apply -skip-datasource-info

or

terraform {
    switches {
        skip_datasource_info = 1
    }
}

References

mgzenitech avatar Jul 08 '20 10:07 mgzenitech

This is even crucial with terraform-provider-azurerm. Most of the data source in azurerm are referenced via id. And Terraform will even go as far as replacing all resources that depends on data {} because the id will need to be re-read and re-apply without any changes to HCL configuration file.

ghost avatar Aug 11 '21 12:08 ghost

Is there any movement on this?

Giving us a lot of issues with vault_generic_secret data source.

Any time there is any other change in the terraform state the plan also shows 20+ records of data sources that will be "read during apply".

As a result it's extremely hard to figure out the actual changes to be made, especially when reviewing past changes.

I'd also say that these "will be read during apply" holds 0 useful information and belong in debug mode.

odu14ick avatar Dec 05 '22 10:12 odu14ick

Any update for this issue?

there are so many read operation is printed on plan output. And it is hard to figure out the real difference

Yaseen17 avatar Jan 10 '23 11:01 Yaseen17

Same issue here, lot of read operations from external data sources. It's really disturbing and dangerous since you don't clearly see what are the applied changes when you have more that 100+ data read actions.

clementtournier avatar Jan 12 '23 10:01 clementtournier

I created sed filter to cut off talkative datasources from terraform <plan|apply> output. It may not be as good as it supposed to be, but at least it works.

terraform plan | \
  sed \
    -e 's/.\+#\( .\+\) will be read during apply\(.\+\)/  \x1b\[1m# \x1b\[36m<=\x1b\[0m\x1b\[1m\1/g' \
    -e '/<=.\+ data /{:a;N;/\n    }\n$/!ba};  /<=.\+ data /d' \
    -e 's/with changes pending).\+/&\n/g' \
    -e 's/values not yet known).\+/&\n/g'

image

kyxap1 avatar Feb 24 '23 02:02 kyxap1

I have stopped using aws_iam_policy_document altogether because of this. It's a bummer because it's a valuable data source that really eases some of the pain of crafting policy documents, but I've found that reducing noise from plans is more important

bholzer avatar Jul 21 '23 17:07 bholzer

I refactored my setup to dynamically read data from aws parameter store and every value I read causes like 10 lines of output. Multiplied with ~50 parameters I use in my environment causes quite some noise. I'll check the grep script as a workaround.

AQS-DTheuke avatar Feb 20 '24 12:02 AQS-DTheuke

Any updates? Working with many EKS Clusters have become a real problem because of this issue

Teethew avatar Mar 07 '24 23:03 Teethew