Prerequisites
Prerequisites Summary
You’ll need to set up the following:
- A Terraspace project repo on GitHub
- The ci plugin gem
A Terraspace project repo on GitHub
If you need a Terraspace project, you can go through one of the Getting Started Guides. For this guide, we’ll use a simple stack that creates a random_pet
resource.
Create a GitHub repo and push the project to it. Here are some example commands
git init
git add .
git commit -m 'first commit'
git remote add origin git@github.com:USER/REPO.git # replace USER and REPO with your own info
git push -u origin main
The ci plugin gem
Double-check and make sure terraspace_ci_circleci
is in your Terraspace project’s Gemfile. It looks something like this.
Gemfile
source "https://rubygems.org"
gem "terraspace"
gem "rspec-terraspace"
gem "terraspace_plugin_aws"
gem "terraspace_ci_circleci" # Gets VCS info from CI environment
gem "terraspace_vcs_github" # Posts PR comment on GitHub
The terraspace_ci_circleci
gem is how Terraspace gathers the VCS info from the CI enviroment. We’re also using terraspace_vcs_github
so a PR comment can be posted with the plan or apply info. If you’re using GitLab instead of GitHub, you should use the terraspace_vcs_gitlab
plugin instead.
The Gemfile also happens to be using AWS cloud plugin. You can use another Terraspace Plugin, of course.
Also, make sure that you’re using Terraspace 2.1 or above. You can check with bundle info terraspace
and should see something like:
$ bundle info terraspace
* terraspace (2.1.0)
If not, you can update terraspace with
bundle update terraspace
Or more generally, update all gem dependencies
bundle update
Next, we’ll generate the CI structure.