33% \teachermodetrue
44
55\usepackage {float }
6+ \usepackage {enumitem }
67\usepackage {languages }
78
89\title {Terraform Collaboration Guide}
1819 Each team should use one shared Terraform state file stored in S3.
1920}
2021
22+
2123\section {Overview }
2224
2325Terraform records the resources it manages in a state file.
@@ -33,34 +35,40 @@ \section{Overview}
3335 \texttt {.terraform/ }, AWS credentials, or Learner Lab tokens.
3436}
3537
38+
3639\section {Choose an Account, Region, and Bucket Name }
3740
3841Your team needs one S3 bucket for Terraform state.
3942Choose one AWS account, one AWS region, and one bucket name before configuring Terraform.
40- Every team member must use the same account, region, bucket, and state file path.
43+ Every team member must use the \textit { \textbf { same } } account, region, bucket, and state file path.
4144
4245\begin {code }[numbers=none]{}
4346AWS account ID: 123456789012
4447AWS region: us-east-1
4548S3 state bucket: csse6400-t00-123456789012-us-east-1-tfstate
46- State file path: taskoverflow /terraform.tfstate
49+ State file path: project-name /terraform.tfstate
4750\end {code }
4851
4952\noindent
50- Replace \texttt {123456789012 } with the AWS account ID from your team's assignment Learner Lab.
51- Replace \texttt {us-east-1 } with the AWS region your team is using.
52- Replace \texttt {t00 } with your team number.
53+ Replace the following values.
54+ \begin {itemize }[itemsep=2pt,parsep=2pt,topsep=2pt]
55+ \item \texttt {123456789012 } with the ID of the shared AWS account allocated to your team for the project.
56+ \item \texttt {us-east-1 } with the AWS region your team is using.
57+ \item \texttt {t00 } with your team number.
58+ \item \texttt {project-name } with the name of your project.
59+ \end {itemize }
5360
5461\info {
5562 S3 bucket names are globally unique.
5663 Including the team number, AWS account ID, and AWS region makes collisions unlikely
5764 and helps your team spot accidental account or region mismatches.
5865}
5966
67+
6068\section {Step 1: Create the Bucket }
6169
6270One team member should create the bucket.
63- Do this before running \texttt {terraform init } with the S3 backend.
71+ Do this \textit { \textbf { before } } running \texttt {terraform init } with the S3 backend.
6472First set your chosen values in the terminal.
6573
6674\begin {code }[language=shell,numbers=none]{}
@@ -71,8 +79,8 @@ \section{Step 1: Create the Bucket}
7179\end {code }
7280
7381\warning {
74- Use the AWS account ID from the shared assignment Learner Lab account that will host the project.
75- Do not create a separate state bucket in each team member's personal practical lab .
82+ Use the shared AWS account allocated to your team to host the project.
83+ Do \textit { \textbf { not } } create a separate state bucket in each team member's personal Learner Lab account .
7684}
7785
7886\noindent
@@ -107,18 +115,19 @@ \section{Step 1: Create the Bucket}
107115\end {code }
108116
109117\info {
110- Bucket versioning is recommended so that accidental state changes are easier to recover from.
118+ Bucket versioning is recommended so that it is easier to recover from accidental state changes .
111119}
112120
113121\warning {
114- The bucket that stores Terraform state should be created before the backend is configured.
115- Do not put this same bucket in the Terraform configuration that will use it as a backend.
122+ The bucket that stores Terraform state should be created \textit { \textbf { before } } the backend is configured.
123+ Do \textit { \textbf { not } } put this same bucket in the Terraform configuration that will use it as a backend.
116124}
117125
126+
118127\section {Step 2: Create Backend Files }
119128
120129In your Terraform directory, create \texttt {backend.tf }.
121-
130+ %
122131\begin {code }[language=terraform,numbers=none]{backend.tf}
123132terraform {
124133 backend "s3" {}
@@ -128,16 +137,17 @@ \section{Step 2: Create Backend Files}
128137\noindent
129138Create \texttt {backend.hcl }.
130139This file tells Terraform which S3 bucket should store the shared state.
131-
140+ %
132141\begin {code }[language=terraform,numbers=none]{backend.hcl}
133142bucket = "csse6400-t00-123456789012-us-east-1-tfstate"
134- key = "taskoverflow /terraform.tfstate"
143+ key = "project-name /terraform.tfstate"
135144region = "us-east-1"
136145encrypt = true
137146use_lockfile = true
138147\end {code }
139148
140149\noindent
150+ Replace \texttt {project-name } with the name of your project.
141151The \texttt {region } value must match the region where your team created the bucket.
142152
143153\info {
@@ -151,6 +161,7 @@ \section{Step 2: Create Backend Files}
151161 If Terraform rejects \texttt {use\_ lockfile }, update Terraform or ask a tutor.
152162}
153163
164+
154165\section {Step 3: Initialise Terraform }
155166
156167Run Terraform initialisation from the Terraform directory.
@@ -169,11 +180,11 @@ \section{Step 3: Initialise Terraform}
169180 stop and ask a tutor before migrating.
170181}
171182
172- \newpage
173- \section {Step 4: Ignore Local Files }
174183
175- Make sure your repository ignores generated Terraform files and local credentials.
184+ \section { Step 4: Ignore Local Files }
176185
186+ Make sure generated Terraform files and local credentials are included in your \texttt {.gitignore } file.
187+ %
177188\begin {code }[numbers=none]{.gitignore}
178189.terraform/
179190terraform.tfstate
@@ -186,9 +197,10 @@ \section{Step 4: Ignore Local Files}
186197
187198\noindent
188199Commit \texttt {backend.tf }.
189- You may commit \texttt {backend.hcl } if it only contains the team bucket name and no secrets.
190- If each student needs different local settings,
191- commit \texttt {backend.example.hcl } instead and keep \texttt {backend.hcl } ignored.
200+ You may commit \texttt {backend.hcl }, if it only contains the team bucket name and no secrets.
201+ If each student needs different local settings, commit \texttt {backend.example.hcl } instead,
202+ and add \texttt {backend.hcl } to \texttt {.gitignore }.
203+
192204
193205\section {Normal Team Workflow }
194206
@@ -227,6 +239,7 @@ \section{Normal Team Workflow}
227239 Do not use \texttt {-lock=false } during normal team work.
228240}
229241
242+
230243\section {Changing the Backend }
231244
232245If you change \texttt {backend.tf } or \texttt {backend.hcl },
0 commit comments