Terraform: Difference between revisions
Jump to navigation
Jump to search
Line 227: | Line 227: | ||
* [https://developer.hashicorp.com/terraform/language/expressions/type-constraints Terraform » EL » Type Constraints] | * [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/dynamic-blocks Terraform » EL » Dynamic Blocks] | ||
* [https://developer.hashicorp.com/terraform/language/ | * [https://developer.hashicorp.com/terraform/language/upgrade-guides Terraform » Upgrade » v1.9] | ||
* [https://developer.hashicorp.com/terraform/language/expressions/splat Terraform » EL » Splat] | * [https://developer.hashicorp.com/terraform/language/expressions/splat Terraform » EL » Splat] | ||
* [https://developer.hashicorp.com/terraform/language/expressions/for Terraform » EL » For] | * [https://developer.hashicorp.com/terraform/language/expressions/for Terraform » EL » For] | ||
Line 237: | Line 237: | ||
* [https://developer.hashicorp.com/terraform/language/functions/cidrhost Terraform » Lang » IP » <code>cidrhost</code>] | * [https://developer.hashicorp.com/terraform/language/functions/cidrhost Terraform » Lang » IP » <code>cidrhost</code>] | ||
* [https://developer.hashicorp.com/terraform/language/tests/mocking Terraform » Lang » Test » <code>Mocks</code>] | * [https://developer.hashicorp.com/terraform/language/tests/mocking Terraform » Lang » Test » <code>Mocks</code>] | ||
* [https://developer.hashicorp.com/terraform/language/functions/uuid Terraform » Lang » Hash » <code>uuid</code>] | |||
* [https://developer.hashicorp.com/terraform/language/functions/tostring Terraform » Lang » <code>tostring</code>] | * [https://developer.hashicorp.com/terraform/language/functions/tostring Terraform » Lang » <code>tostring</code>] | ||
* [https://developer.hashicorp.com/terraform/language/tests Terraform » Lang » Test] | * [https://developer.hashicorp.com/terraform/language/tests Terraform » Lang » Test] |
Revision as of 09:28, 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 |