Testing Another’s Project#
In this final milestone you’ll test another student’s project using your account. The purpose of the test is to give you practice with using Terraform configurations and Ansible playbooks from another person. You will be assigned another student’s repository to look at.
Test Process#
These steps were (somewhat badly) demonstrated in class:
1. Create a new GCP Project#
To properly test another’s configuration you should create a new GCP project in your account. Once you’ve created a project visit the APIs & Services dashboard in GCP and enable the following APIs:
Compute Engine API
Cloud Logging API
Cloud Resource Manager API
Identity and Access Management (IAM) API
Privileged Access Manager API
Those APIs are needed for a complete project. In your cloud shell run this command to select your new project:
$ gcloud config set project the-id-of-your-new-project
2. Upload your SSH Public Key#
Your new project needs to have your SSH public key in the Compute Engine Metadata. The key should match the one in your Cloud Shell Editor. Copy and paste the output of the following command into the project metadata:
$ cat ~/.ssh/id_ed25519.pub
3. Clone The Repository#
Now you’re ready to clone the other student’s repository and try to run their
configuration and playbooks. You will be assigned a repo with a URL. Use git
to clone it into your home directory. Here’s an example of the command with a
fake URL:
$ cd
$ git clone https://use-the-url-you-were-assigned cis91-verify
That command will create a directory called cis91-verify where the other
student’s code will be located. The other student will have a
terraform.tfstate file that needs to be deleted because you’re starting from
scratch. Remove that file:
$ cd cis91-verify
$ rm terraform.tfstate
4. Customize the Project#
The other student may have hard-coded their project ID in a few places. Make
sure that you point the configurations to your new project. Start with the
terraform.tfvars file:
$ echo 'project = "the-name-of-your-project"' > terraform.tfvars
Replace
the-name-of-your-projectwith the correct project ID.
You should also edit the gcp.yaml file to contain your project ID. It’s a good
idea to check their main.tf file for the project ID as well.
5. Execute Their Configuration#
Now that you have the other student’s code setup you should be able to build their project with the following commands:
$ terraform init
$ terraform apply
$ ansible-playbook -i ./gcp.yaml playbook.yaml
Giving Feedback#
The purpose of this project is for you to get practice, not to grade another student’s work. If you get stuck in a part of the procedure take a screenshot and post it. If it works for you post a screenshot of the MediaWiki installation page.
Post your screenshot on the class discussion forum.