Description
This is not an issue rather asking for a recommendation.
We use terraform to create our infrastructure in google cloud and also to create service account and its keys.
We use gitlab CI/CD to run terraform plan and terraform apply as two separate jobs.
The terraform-plan job outputs a plan file that we pass on as an artifact to the terraform-apply job.
It has come to our notice that the terraform plan file is in a zip format and contains a tfstate file that contains all the information including the service account keys which are sensitive. As this terraform plan file is passed on as an artifact in the GitLab job, this artifact is available to everyone in our organization.
Can you recommend any workaround or best practices for us so that the terraform plan file does not have this sensitive data?
We have thought of using Google KMS in the terraform-plan job to encrypt the plan file before passing it as an artefact to the terraform-apply job and the terraform-apply job decrypts the plan before applying the plan.
Can you suggest a better solution to this?