Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scraly/terraform-cheat-sheet
Terraform cheat sheet
https://github.com/scraly/terraform-cheat-sheet
Last synced: 2 days ago
JSON representation
Terraform cheat sheet
- Host: GitHub
- URL: https://github.com/scraly/terraform-cheat-sheet
- Owner: scraly
- Created: 2018-11-28T06:56:49.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-12-05T13:14:20.000Z (11 months ago)
- Last Synced: 2024-05-01T21:51:05.396Z (6 months ago)
- Language: HTML
- Size: 1.38 MB
- Stars: 215
- Watchers: 14
- Forks: 143
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Terraform cheat sheet
# Generate cheat sheet PDF
`$ ./bin/asciidoctorjs-pdf terraform-cheat-sheet.adoc --template-require ../examples/cheat-sheet/template/template.js`
# WIP
## Other useful commands
Inspect what is currently in the TF state (useful after an apply)
```
$ terraform show
```Set the log to DEBUG level and save the log in an output external file
```
$ TF_LOG_PATH=mylogfile.txt TF_LOG=debug terraform apply
```Refresh information. Compare the current real remote information and put it in the TF state
```
$ terraform refresh
```Get an element from a slice
(convert a set to a list and then get the first element in the list)```
https://developer.hashicorp.com/terraform/language/functions/tolistoutput "iam" {
value = data.ovh_iam_policies.my_policies.policies
}Outputs:
iam = toset([
"1a016c5f-bb43-4069-803d-daab0f22319b",
"d7daf48e-ba7e-4373-aa4b-b6a9dcace1f3",
])data "ovh_iam_policy" "my_policy" {
id = tolist(data.ovh_iam_policies.my_policies.policies)[0]
}
```Display all the available resources in your TF state
```
terraform state list
```Output:
```
data.ovh_iam_policies.my_policies
data.ovh_iam_policy.my_policy
data.ovh_iam_reference_actions.vps_actions
```