Skip to content

Commit 6c1a1c1

Browse files
committed
Updated README and screenshots
1 parent 66bc7a8 commit 6c1a1c1

File tree

5 files changed

+26
-66
lines changed

5 files changed

+26
-66
lines changed

lab01-gettingstarted/README.md

Lines changed: 26 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ This lab demonstrates how to connect Terraform Enterprise to a source code manag
1313
- Task 1: Connect GitHub to TFE and Fork a GitHub Repo
1414
- Task 2: Configure Variables
1515
- Task 3: Queue a Plan
16-
- Task 4: Edit Code on GitHub to Use Variables instead of file
17-
- Task 5: Confirm and Apply the Plan
16+
- Task 4: Confirm and Apply the Plan
17+
- Task 5: Destroy provisioned infrastructure
1818

1919
### Terraform Enterprise
2020

@@ -36,18 +36,12 @@ Connecting Terraform Enterprise to GitHub will give us a continuous integration
3636

3737
Visit this GitHub repository and fork it so you have a copy in your own GitHub account:
3838

39-
https://github.com/hashicorp/demo-terraform-101
39+
https://github.com/kawsark/aws-terraform-workshop.git
4040

4141
Optionally, clone the repository to your local machine (if you prefer to edit code locally instead of in the browser).
4242

4343
```bash
44-
$ git clone https://github.com/$USER/demo-terraform-101.git
45-
```
46-
47-
We will work with the `after-tfe` branch. If you choose to work locally, check out this branch:
48-
49-
```bash
50-
$ git checkout -t origin/after-tfe
44+
$ git clone https://github.com/$USER/aws-terraform-workshop.git
5145
```
5246

5347
#### Step 1.2: Connect GitHub to TFE
@@ -104,17 +98,21 @@ Back at Terraform Enterprise, you’ll see that it’s connected.
10498

10599
Finally, we’re ready to fully create a Terraform Enterprise workspace. Go to https://app.terraform.io and click the "New Workspace" button at the top right.
106100

107-
Give it a name such as "training-demo".
101+
Give it a name such as "training-lab01".
108102

109-
GitHub is our only VCS connection. Click the "Repository" field and you’ll see a list of available repositories in an auto-complete menu. Find the `demo-terraform-101` repo. If yours isn’t here, refresh the page.
103+
- Choose GitHub as VCS connection.
104+
- Click the "Repository" field and you’ll see a list of available repositories in an auto-complete menu. Find the `aws-terraform-workshop` repo. If yours isn’t here, refresh the page.
110105

111-
![TFE](images/tfe-basics/06.png "TFE")
106+
![TFE](images/tfe-basics/lab01-06.png "TFE")
112107

113-
Terraform Enterprise can deploy from any branch. We'll use the `after-tfe` branch which has been minimally modified to work with Terraform Enterprise.
108+
- Click the "More Options" link
109+
- **TERRAFORM WORKING DIRECTORY:** By default Terraform will use repository root directory. In this case we will specify `lab01-gettingstarted`.
114110

115-
![TFE](images/tfe-basics/07.png "TFE")
111+
- **VCS BRANCH:** Terraform Enterprise can deploy from any branch. We'll use the default branch; alternatively you can specify `master`.
116112

117-
Click the "More Options" link and scroll down to "VCS Branch." Type `after-tfe` to use that branch.
113+
![TFE](images/tfe-basics/lab01-07.png "TFE")
114+
115+
- Click the **Create Workspace** button.
118116

119117
You’ll see a screen showing that a Terraform Enterprise workspace is connected to your GitHub repository. But we still need to provide Terraform with our secret key, access key, and other variables defined in the Terraform code as variables.
120118

@@ -125,9 +123,11 @@ Go to the "Variables" tab. On the variables page, you'll see there are two kind
125123
- Terraform variables: these are fed into Terraform, similar to `terraform.tfvars`
126124
- Environment variables: these are populated in the runtime environment where Terraform executes
127125

128-
In the top "Terraform Variables" section, click "Edit" and add keys and values for all the variables in the project's `variables.tf` file. The only one you'll need initially is `identity` which is your unique animal name.
126+
### Step 2.2: Enter Terraform Variables
127+
128+
In the top "Terraform Variables" section, click "Edit" and add keys and values for all the variables in the project's `variables.tf` file. The only one you'll need initially is `identity` which is a your username.
129129

130-
### Step 2.1: Enter AWS Credentials
130+
### Step 2.3: Enter AWS Credentials as Environment Variables
131131

132132
There is also a section for environment variables. We'll use these to store AWS credentials.
133133

@@ -136,10 +136,11 @@ Click "Edit" and add variables for your AWS credentials.
136136
```bash
137137
AWS_ACCESS_KEY_ID="AAAA"
138138
AWS_SECRET_ACCESS_KEY="AAAA"
139-
AWS_DEFAULT_REGION="us-west-2"
140139
```
141140

142-
Click the "Save" button.
141+
Click the "Save Variable" button. Optionally you can mark these variables as Sensitive, which will make them write-only.
142+
143+
![TFE](images/tfe-basics/lab01-tfe-variables.png "TFE")
143144

144145
## Task 3: Queue a Plan
145146

@@ -153,52 +154,11 @@ Go to the "Runs" tab, or "Latest Run". Find the most recent one (there will prob
153154

154155
Scroll down to where it shows the plan. Click the button to "View Plan." You’ll see the same kind of output that you are used to seeing on the command line.
155156

156-
We'll make another change from GitHub before running this plan, so click "Discard Plan."
157-
158-
## Task 4: Edit Code on GitHub to Upgrade the AWS Provider Version
159-
160-
Edit code on GitHub to upgrade the AWS provider version to `>= 1.20.0`.
161-
162-
You'll make a pull request with these changes and observe the status of the pull request on GitHub.
163-
164-
### Step 4.1
165-
166-
On GitHub, find the "Branch" pulldown and switch to the `after-tfe` branch.
167-
168-
Navigate to `main.tf`. Find the pencil icon. Click to edit this file directly in the browser.
169-
170-
![TFE](images/tfe-basics/09.png "TFE")
171-
172-
Edit the code to match the lines below.
173-
174-
```bash
175-
provider "aws" {
176-
# MODIFY this line to look for 1.20.0 or greater
177-
version = ">= 1.20.0"
178-
}
179-
```
180-
181-
Scroll to the bottom and select the option to "Create a new branch and start a pull request."
182-
183-
![TFE](images/tfe-basics/10.png "TFE")
184-
185-
You’ll be taken to a screen to create a pull request. Click the green "Propose file change" button. The page will be pre-populated with your commit message. Click "Create pull request."
186-
187157
After a few seconds, you'll see that Terraform Enterprise checked the plan and that it passed.
188158

189-
![TFE](images/tfe-basics/12.png "TFE")
190-
191-
To see what was checked, click "Show all checks" and click "Details" next to the line that says "Terraform plan has changes."
192-
193-
Merge the pull request to the `after-tfe` branch with the big green "Merge pull request" button. Click the "Confirm merge" button.
194-
195-
## Task 5: Confirm and Apply the Plan
196-
197-
### Step 5.1: Confirm and `apply`
198-
199-
Back at Terraform Enterprise, find the "Current Run" tab. Click it and you’ll see the merge commit has triggered a plan and it needs confirmation.
159+
## Task 4: Confirm and Apply the Plan
200160

201-
![TFE](images/tfe-basics/13.png "TFE")
161+
### Step 4.1: Confirm and `apply`
202162

203163
Scroll to the bottom of the run and confirm the `plan`. At the bottom of the page you’ll see a place to comment (optional) and click "Confirm & Apply."
204164

@@ -210,11 +170,11 @@ Examine the output of `apply` and find the IP address of the new instance. The o
210170

211171
![TFE](images/tfe-basics/15.png "TFE")
212172

213-
## Task 6: Destroy
173+
## Task 5: Destroy
214174

215175
To clean up, destroy the infrastructure you've just created.
216176

217-
### Step 6.1: Configure CONFIRM_DESTROY variable
177+
### Step 5.1: Configure CONFIRM_DESTROY variable
218178

219179
Go to the "Settings" tab in Terraform Enterprise and scroll to the bottom. Note the instructions under "Workspace Delete." We want to destroy the infrastructure but not necessarily the workspace.
220180

@@ -226,7 +186,7 @@ Go to the "Variables" tab and do that.
226186

227187
Click "Add" and "Save".
228188

229-
### Step 6.2: Queue destroy plan
189+
### Step 5.2: Queue destroy plan
230190

231191
It's sometimes necessary to queue a normal plan and then queue the destroy plan.
232192

lab01-gettingstarted/images/confirm-destroy.png

100755100644
-70.2 KB
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)