From the course: Advanced Terraform

Exercise files

- [Instructor] The exercise files for this course are stored in a repository on GitHub. If you don't have a GitHub account, you'll need to create one. This will allow you to create a GitHub hosted copy called a fork, of the Exercise Files repository. You'll need that fork for some of the course exercises. First, I'll show you how to create a fork, then you'll clone the fork to your local system or to the Google Cloud shell. Create your GitHub account if you don't have one, then log in. You can search for the exercise files by entering into the search bar here on the very top left LinkedIn Learning/Advanced-Terraform. You should see only the one listed here. LinkedIn Learning Advanced Terraform 3099246. Click that and then click the fork button here at the top right. Click Create Fork and your fork will be created. The next thing we need to do is create a personal access token that the GI CLI will use to authenticate to GitHub. Click your profile icon at the very top right here. Go to Settings, and then scroll all the way down to developer settings. Expand personal access tokens, and select fine-grained tokens, and then click Generate New Token. Give it a name, I'll call it TF-Token. You can leave the expiration at 30 days. If it does expire during the course, you can always generate a new one. And then I recommend selecting only select repositories. If this is a new account for you on GitHub, you should only see the one repository listed here. Select that. And then under repository permissions, expand this section here and scroll down to contents. You'll want to change that to read and write, and then scroll down a little further to web hooks, and read and write for that one as well. Click Generate Token, and we have our token. It's important that you copy it immediately and save it somewhere permanent and safe, like a text file on your local system or in a private cloud folder like Google Drive. This token is like a password. It grants all the permissions we selected to anyone who has it. Make sure to keep the token somewhere only you can access it. Also, be sure not to add it to your repository at any point. Secrets such as tokens should never be published to a Git repository. For security purposes, GitHub will never display this token again. If you lose it, you'll need to revoke it and generate a new one with the same permissions. Throughout the course, I'll be using the Git command line utility to switch between local branches. You'll need the Git CLI to follow along and to push changes to your fork. I'll be demonstrating with Visual Studio Code, executing commands from my local system. If Visual Studio Code is your preferred method for working with the exercises, you'll need to make sure that the Git CLI is downloaded to your system and working. You also have the option to use the Code Editor and Cloud Shell and GCP. If that's your preference, then you're all set. The Git CLI is pre-installed to Cloud Shell. For those that want to work locally in Visual Studio, open a local terminal and execute Git--version. You should see the version here. If not, you'll need to download the Git CLI from this website. Follow the installation instructions for your platform. After the installation is complete, restart your terminal and open a new one. You should then be able to run Git--version, and see the version. Now return to your browser with your fork open in GitHub. New forks are created as private repositories by default as we can see here. This means that you'll need to authenticate to GitHub from the CLI. This will allow you to clone your repo, which means to download it locally and push, which means to push your local changes back to your repo and GitHub. Don't worry if you're not familiar with Git, I'll walk you through each command and explain what is happening as we go. Click the Code button here, make sure HTTPS is selected, and click the Copy button. Then return to your terminal. You should be in your home directory. If not, execute CD space Tilda on a Mac or in Cloud Shell, or CDspace\ on a Windows machine. Now, type in Git Clone and paste in the URL for your fork. Hit Enter and it'll prompt you for username and password. Enter in your GitHub username, this one's mine, and then at Enter. And now, paste in the personal access token that you created earlier. Copy it, make sure you don't get any spaces. Paste it in, you won't see it show here, that's fine. Hit Enter, and it is cloned locally. We can do a quick LS and see that we have Advanced Terraform 3099246. I can change into that directory, and there we are. Now we're on a command to cash your token so you don't have to enter it with each clone or push. Enter in Gitconfig global credential.helper cache, C-A-C-H-E. Hit Enter, and that's it. Great, we have our exercise files downloaded and we're ready to move on.

Contents