Using terraform in gitlab file getting error

Viewed 225

I want to pass variables gotten from gitlab to my terraform. I can see gitlab getting the vars but it errors out at the terraform apply/

In my gitlab file i have

    - echo "$CI_COMMIT_REF_SLUG"
    - echo "$GITLAB_USER_NAME"
    - terraform apply --auto-approve -var branch_name=$CI_COMMIT_REF_SLUG -var branch_creator=$GITLAB_USER_NAME

in my terraform i'm setting branch_name and etc as variables

i keep getting this error in my gitlab build

Failed to load Terraform configuration or plan: open "last name": no such file or directory
1 Answers

You could try again with GitLab 13.5 (October 2020)

Get started quickly with GitLab and Terraform

A new GitLab CI/CD template enables you to set up Terraform pipelines without any manual work, lowering the barrier to entry for your teams to adopt Terraform.

See Documentation and Issue.

From that generated example, you can check if it includes a similar terraform call and compare it with your use-case.

Related