Terraform: Difference between revisions
Jump to navigation
Jump to search
Line 208: | Line 208: | ||
|- | |- | ||
| valign="top" | | | valign="top" | | ||
* [https://spacelift.io/blog/terraform-tfvars Terraform » <code>terraform.tfvars</code> vs. <code>variable.tf</code>] | * [https://spacelift.io/blog/terraform-tfvars Terraform » <code>terraform.tfvars</code> vs. <code>variable.tf</code>] | ||
* [https://dev.to/leroykayanda/gitignore-ignore-terraform-files-40h6 Terraform » <code>.gitignore</code> & <code>.terraformignore</code>] | * [https://dev.to/leroykayanda/gitignore-ignore-terraform-files-40h6 Terraform » <code>.gitignore</code> & <code>.terraformignore</code>] | ||
* [https://developer.hashicorp.com/terraform/language/expressions/ | * [https://developer.hashicorp.com/terraform/language/expressions/operators Terraform » EL » Arithmetic & Logical Operators] | ||
* [https://developer.hashicorp.com/terraform/language/expressions/references Terraform » EL » References to Named Values] | |||
* [https://support.hashicorp.com/hc/en-us/articles/4409321668499-How-to-identify-issues-with-the-terraformignore-file-configuration Terraform » <code>.terraformignore</code> » Issues] | * [https://support.hashicorp.com/hc/en-us/articles/4409321668499-How-to-identify-issues-with-the-terraformignore-file-configuration Terraform » <code>.terraformignore</code> » Issues] | ||
* [https://developer.hashicorp.com/terraform/language/settings/backends/configuration Terraform » Backend » Configuration] | * [https://developer.hashicorp.com/terraform/language/settings/backends/configuration Terraform » Backend » Configuration] | ||
* [https://developer.hashicorp.com/terraform/language/expressions/strings Terraform » EL » Strings & Templates] | |||
* [https://developer.hashicorp.com/terraform/language/expressions/types Terraform » EL » Types & Values] | |||
* [https://developer.hashicorp.com/terraform/language/settings/backends/remote Terraform » Backend » Remote] | * [https://developer.hashicorp.com/terraform/language/settings/backends/remote Terraform » Backend » Remote] | ||
* [https://developer.hashicorp.com/terraform/language/expressions/function-calls Terraform » EL » Function Calls] | |||
| valign="top" | | | valign="top" | | ||
* [https://developer.hashicorp.com/terraform/language/expressions/conditionals Terraform » EL » Conditional Expressions] | |||
* [https://developer.hashicorp.com/terraform/language/functions Terraform » Lang » Built-in Functions] | |||
* [https://developer.hashicorp.com/terraform/language/expressions/version-constraints Terraform » EL » Version Constraints] | |||
* [https://developer.hashicorp.com/terraform/language/expressions/custom-conditions Terraform » EL » Custom Conditions] | |||
* [https://developer.hashicorp.com/terraform/language/expressions/type-constraints Terraform » EL » Type Constraints] | |||
* [https://developer.hashicorp.com/terraform/language/expressions/dynamic-blocks Terraform » EL » Dynamic Blocks] | |||
* [https://developer.hashicorp.com/terraform/language/expressions/splat Terraform » EL » Splat] | |||
* [https://developer.hashicorp.com/terraform/language/expressions/for Terraform » EL » For] | |||
| valign="top" | | | valign="top" | |
Revision as of 07:09, 19 July 2024
curl -fsSL https://apt.releases.hashicorp.com/gpg\
| sudo tee /etc/apt/keyrings/hashicorp.asc >/dev/null
cat << EOF | sudo tee /etc/apt/sources.list.d/hashicorp.list >/dev/null
deb [arch=$(dpkg --print-architecture)\
signed-by=/etc/apt/keyrings/hashicorp.asc]\
https://apt.releases.hashicorp.com $(lsb_release -cs) main
EOF
sudo apt update && sudo apt list --upgradeable
sudo apt upgrade && sudo apt install terraform
terraform version
Structure
sdlc/
├─ main.tf # Main Terraform config file
├─ variables.tf # Variable declarations
├─ terraform.tfvars # Variable assigned
├─ outputs.tf # Output definitions
├─ provider.tf # Provider-specific config
├─ terraform.tfstate # Terraform state file
├─ dev.tf # Dev Env config for development
├─ prod.tf # Prod Env config for production
├─ modules/ # Directory for custom modules
│ ├─ module1/ # Custom module 1
│ │ ├─ main.tf # Module-specific Terraform config
│ │ ├─ variables.tf # Module-specific variables
│ │ └─ outputs.tf # Module-specific outputs
│ └─ module2/ # Custom module 2
│ ├─ main.tf
│ ├─ variables.tf
│ └─ outputs.tf
├─ environments/ # Directory for env
│ ├─ dev/ # Development env
│ │ ├─ main.tf # Env specific Terraform config
│ │ ├─ variables.tf
│ │ └─ outputs.tf
│ └─ prod/ # Production env
│ ├─ main.tf
│ ├─ variables.tf
│ └─ outputs.tf
├─ scripts/ # Scripts or utility for IaC
└── README.md
Summary
Playground
References |