I’m trying to automate the Glue deployment using Gitlab and Terraform running in a docker container in one of our Gitlab runner (EC2 Instance).
I know that I can have secret environment variables in GitLab, but I’m not sure how I can push those variables into my Terraform script – .gitlab-ci.yml file.
I’m having set of terraform files places in the below format to automate my Glue deployment process(Fig.1). I have placed variable in GitLab CICD variables as below(Fig.2).
Fig.1
Fig.2
In .gitlab-ci.yml file, i tried with below approaches to pass the CICD variables from GitLab but it is not helping me to figure it out.
1st approach using variables in .gitlab-ci.yml file as below(Fig.3),
Fig.3
2nd approach using export command in the script as below(Fig.4),
Fig.4
I did a dry run to cross check whether the variable which I’m passing in script is valid or not without any environmental variable locally from Visio, it is working fine.
How can I pipe it to my Terraform scripts? Any ideas? I would need to read the secrets from GitLab’s environment and pass it on to the Terraform scripts!
Sarathkumar U is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.