Reputation: 1
I followed this link: https://spacelift.io/blog/gitlab-terraform so I can run my terraform code through a GitLab pipeline. (I should mention I do not have GitLab Premium).
I created a project in GitLab and cloned the project to VS code. The folder are showing and I created three files: main.tf, variables.tf and provider.tf (as per the guide in the link above). I saved the file and I ran 'git commit' but I can't see the terraform files in my GitLab account.
Error message in GitLab> Project> Build> Jobs
ERROR: No files to upload
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1
I suspect it's because the terraform code on my local machine hasn't been pushed to my GitLab repo. This is the part I'm struggling with.
what am I doing wrong?
Upvotes: 0
Views: 427
Reputation: 11
I recommend using Terraform state from gitlab, You need to configure a backend service in your terraform project. Terraform state files are plain text, so all sensitive information will be revealed.
https://docs.gitlab.com/ee/user/infrastructure/iac/terraform_state.html
Upvotes: 0
Reputation: 16809
You need to push your commit to the gitlab repository.
https://git-scm.com/docs/git-push
Try typing git push and follow the instructions printed on the command line.
Upvotes: 0