terraform
terraform copied to clipboard
Ability to disable data source read messages during plan/apply
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:
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
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.
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.
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
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.
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'
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
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.
Any updates? Working with many EKS Clusters have become a real problem because of this issue