Terraform extract

Is there a way to extract the existing infrastructure details (setup manually) by using terraform

e.g get a list of Linux server’s version, firewall policy, opened ports, software packages installed etc…

My aim is to generate a block of code to describe the current server setup, then I can use a check list if validate against the code. therefor security loopholes can be identified and fixed