Check out a free preview of the full Enterprise DevOps & Cloud Infrastructure course

The "Updating the TFE Repo" Lesson is part of the full, Enterprise DevOps & Cloud Infrastructure course featured in this preview video. Here's what you'd learn in this lesson:

Erik commits the local changes in the fem-eci-terraform-tfe repository and pushes the changes up to GitHub.com.

Preview
Close

Transcript from the "Updating the TFE Repo" Lesson

[00:00:00]
>> Okay, cool, so here's what I wanna do. Let's quickly, again, make sure to plan one more time just to make sure we don't have any changes. I wanna make sure that you guys are all caught up as well, cuz we're about to go into the next section, which is setting up VCS tracking.

[00:00:13]
So, okay, I'm gonna, looks good. Okay, so before we move to that, let's do one more thing, which is I'm going to actually commit my changes. So I'm gonna say git status, right? I'm gonna do git add -A. So I wanna just add everything, right? But when I do that, look at what I'm accidentally adding here.

[00:00:35]
I don't want my terraform plan in my repository, right? And so this is something else to pay attention to is, the git ignore can help you. But sometimes, if you have custom naming conventions or stuff like that, there might be generated files that accidentally get generated by terraform that you wanna make sure not to commit.

[00:00:53]
So in this case, we'd actually say, git rm terraform plan. Oops, sorry, actually get, what is it, sorry, is it git
>> Rm
>> Is it rm? I thought that's what it was. Is it just force, there we go, git rmm-- force.terraform, tfplan. So now if I do get status, you'll see that that's now gone, right?

[00:01:23]
So that makes sure that we don't accidentally add that to state. If you wanted to, you could also do that to the lock file. There's a bunch of other discussions on why you'll do or do not wanna do that. For now, we're just gonna keep the lock file.

[00:01:35]
If you don't know what a lock file is, it's essentially a file that holds specific version to SHAs of every thing that you may use. And so this makes sure that if you wanna use the provider tfe 48, that if you try installing a new one, the lock file will actually say whoa, whoa, whoa, whoa, you've got 48, you can't do 49.

[00:01:58]
You got to update my lock file to let you do that. So that's why people sometimes like it, that's why sometimes people hate it cuz it's really annoying. I'm not a big fan of it, but for now just to make our lives easier, we'll do it. So I'm gonna say git commit m "feat: initialized repository", right?

[00:02:20]
And then I'm gonna push origin main, bam. So now if I go to my repo, I should also see all of my other stuff. So you guys should be able to see this too, right? This is now our source of truth, right? This is the GitOps part.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now