There is no supported in-process Go library API for Terraform. Terraform is a CLI tool and so its interface is via running CLI commands only. There are some parts of the CLI that are designed for programmatic consumption, such as
terraform show -json to obtain JSON-formatted descriptions of the current state and of saved plans, or
terraform output -json to retrieve the current root module output values.
Terraform Cloud and Enterprise interact with Terraform by running the CLI and, where appropriate, capturing the JSON-formatted output. For example, Terraform Cloud/Enterprise both save the result of
terraform show -json planfile against each run so that other subsystems can consume that data.