How to run terraform as a container

I have been assigned a task, where i need to run two containers 1. container is running Jenkins and the 2. container is running terraform inside a docker container. now i need to run the pipeline and execute the terraform script inside a terraform container. I am facing issue in configuring the terraform container inside the jenkins.

You should be able to have a step like this in your Jenkinsfile:

script {
    sh "docker cp . <TERRAFORM_CONTAINER>:/workspace"
    sh "docker exec <TERRAFORM_CONTAINER> sh -c 'cd /workspace && terraform init && terraform plan && terraform apply -auto-approve'"
}