Store #forces replacements elements on txt file or json

Hello i want to store only #force replacements elements when i do terraform plan on a txt or json file.

do you have a idea how can i do it ?

Hi @yedder6,

I don’t completely understand what you’re asking, but you can get a json formatted version of the plan using the command:

terraform show -json filename

The json format will record the attributes which the provider indicated caused the replacement under the replace_paths key in the resource "change" object.

i want to store only elements with #force replacment your commande is storing all changes in the file

Yes, you would need to process the json to filter out only the data you are interested in. There is no command to just list the attribute paths which forced replacement of different resources.

thank you for your recommendations