You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: terraform-cheat-sheet.adoc
+31-41Lines changed: 31 additions & 41 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -172,8 +172,38 @@ Validate command is used to validate/check the syntax of the Terraform files. A
172
172
$ terraform validate
173
173
....
174
174
175
+
=== Providers
176
+
177
+
You can use a lot of providers/plugins in your terraform definition resources, so it can be useful to have a tree of providers used by modules in your project.
178
+
179
+
....
180
+
$ terraform providers
181
+
.
182
+
├── provider.aws ~> 1.24.0
183
+
├── module.my_module
184
+
│ ├── provider.aws (inherited)
185
+
│ ├── provider.null
186
+
│ └── provider.template
187
+
└── module.elastic
188
+
└── provider.aws (inherited)
189
+
....
190
+
175
191
== State
176
192
193
+
=== Pull remote state in a local copy
194
+
195
+
....
196
+
$ terraform state pull > terraform.tfstate
197
+
....
198
+
199
+
=== Push state in remote backend storage
200
+
201
+
....
202
+
$ terraform state push
203
+
....
204
+
205
+
This command is usefull if for example you riginally use a local tf state and then you define a backend storage, in S3 or Consul...
206
+
177
207
=== How to tell to Terraform you moved a ressource in a module?
178
208
179
209
If you moved an existing resource in a module, you need to update the state:
@@ -338,44 +368,4 @@ Example:
338
368
`$ terraforming s3 > aws_s3.tf`
339
369
340
370
Remarks: As you can see, terraforming can’t extract for the moment API gateway
341
-
resources so you need to write it manually.
342
-
343
-
== Known issues
344
-
345
-
=== Signature expired: xxxx is now earlier than xxx
346
-
347
-
If, suddently, you obtain an error message `Signature expired: xxx is now
348
-
earlier than xxx'`, like this:
349
-
350
-
Don’t worry it’s not an issue in the AWS account/user/credentials in terraform files
351
-
352
-
BUT it’s an issue in your local machine date and time!
353
-
354
-
So the solution is, simply: update your date and time to the good time ;-).
355
-
356
-
=== AWS was not able to validate the provided access credentials
357
-
358
-
If, suddently, you obtain an error message _AWS was not able to validate the provided access credentials_, like this:
359
-
360
-
....
361
-
* data.aws_vpc.vpc-titi: data.aws_vpc.vpc-titi:
362
-
AuthFailure: AWS was not able to validate the provided access credentials
363
-
status code: 401, request id: 9fbd5beb-e065-4933-ba67-2ceae9104c4c
364
-
....
365
-
366
-
No worries, it’s the same issue as above: your local/VM machine date and time is
367
-
not uptodate ;-).
368
-
369
-
=== Error configuring the backend s3: RequestError: send request failed
370
-
371
-
Again, you changed nothing but suddently you obtain a strange error message:
372
-
373
-
....
374
-
Initializing the backend...
375
-
376
-
Error configuring the backend "s3": RequestError: send request failed
377
-
caused by: Post https://sts.amazonaws.com/: Parent proxy unreacheable
378
-
...
379
-
....
380
-
381
-
It caused in reality by a proxy or a temporary issue between your network connectivity and AWS.
<pclass="">You can use a lot of providers/plugins in your terraform definition resources, so it can be useful to have a tree of providers used by modules in your project.</p>
191
+
<divclass="literalblock">
192
+
<divclass="content">
193
+
<pre>$ terraform providers
194
+
.
195
+
├── provider.aws ~> 1.24.0
196
+
├── module.my_module
197
+
│ ├── provider.aws (inherited)
198
+
│ ├── provider.null
199
+
│ └── provider.template
200
+
└── module.elastic
201
+
└── provider.aws (inherited)</pre>
202
+
</div>
203
+
</div>
204
+
</div>
188
205
</div>
189
206
</div>
190
207
<divclass="sect1">
191
208
<h2id="_state">State</h2>
192
209
<divclass="sectionbody">
193
210
<divclass="sect2">
211
+
<h3id="_pull_remote_state_in_a_local_copy">Pull remote state in a local copy</h3>
212
+
<divclass="literalblock">
213
+
<divclass="content">
214
+
<pre>$ terraform state pull > terraform.tfstate</pre>
215
+
</div>
216
+
</div>
217
+
</div>
218
+
<divclass="sect2">
219
+
<h3id="_push_state_in_remote_backend_storage">Push state in remote backend storage</h3>
220
+
<divclass="literalblock">
221
+
<divclass="content">
222
+
<pre>$ terraform state push</pre>
223
+
</div>
224
+
</div>
225
+
<pclass="">This command is usefull if for example you riginally use a local tf state and then you define a backend storage, in S3 or Consul…​</p>
226
+
</div>
227
+
<divclass="sect2">
194
228
<h3id="_how_to_tell_to_terraform_you_moved_a_ressource_in_a_module">How to tell to Terraform you moved a ressource in a module?</h3>
195
229
<pclass="">If you moved an existing resource in a module, you need to update the state:</p>
196
230
<divclass="literalblock">
@@ -362,46 +396,6 @@ <h4 id="_usage_3">Usage</h4>
362
396
</div>
363
397
</div>
364
398
</div>
365
-
<divclass="sect1">
366
-
<h2id="_known_issues">Known issues</h2>
367
-
<divclass="sectionbody">
368
-
<divclass="sect2">
369
-
<h3id="_signature_expired_xxxx_is_now_earlier_than_xxx">Signature expired: xxxx is now earlier than xxx</h3>
370
-
<pclass="">If, suddently, you obtain an error message <code>Signature expired: xxx is now
371
-
earlier than xxx'</code>, like this:</p>
372
-
<pclass="">Don’t worry it’s not an issue in the AWS account/user/credentials in terraform files</p>
373
-
<pclass="">BUT it’s an issue in your local machine date and time!</p>
374
-
<pclass="">So the solution is, simply: update your date and time to the good time ;-).</p>
375
-
</div>
376
-
<divclass="sect2">
377
-
<h3id="_aws_was_not_able_to_validate_the_provided_access_credentials">AWS was not able to validate the provided access credentials</h3>
378
-
<pclass="">If, suddently, you obtain an error message <em>AWS was not able to validate the provided access credentials</em>, like this:</p>
0 commit comments