Terraform: Difference between revisions
Jump to navigation
Jump to search
Line 166: | Line 166: | ||
* [https://www.reddit.com/r/Terraform/comments/yt8hag/variablestf_vs_terraformtfvars_whats_the/ Terraform » reddit » <code>variable.tf</code> vs. <code>terraform.tfvars</code>] | * [https://www.reddit.com/r/Terraform/comments/yt8hag/variablestf_vs_terraformtfvars_whats_the/ Terraform » reddit » <code>variable.tf</code> vs. <code>terraform.tfvars</code>] | ||
* [https://medium.com/@biagolini/adding-untracked-resources-to-terraform-state-f056a6ab2adc Terraform » Adding Untracked Resources to TF State] | * [https://medium.com/@biagolini/adding-untracked-resources-to-terraform-state-f056a6ab2adc Terraform » Adding Untracked Resources to TF State] | ||
* [https://spacelift.io/blog/terraform | * [https://spacelift.io/blog/importing-exisiting-infrastructure-into-terraform Terraform » Importing Existing Infrastructure] | ||
* [https://www.terraform.io/cli/install/apt Terraform » CLI Packages for Ubuntu] | * [https://www.terraform.io/cli/install/apt Terraform » CLI Packages for Ubuntu] | ||
* [https://developer.hashicorp.com/terraform/language/values/variables Terraform » Input Variables] | * [https://developer.hashicorp.com/terraform/language/values/variables Terraform » Input Variables] | ||
Line 204: | Line 204: | ||
|- | |- | ||
| valign="top" | | | valign="top" | | ||
* [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/settings/backends/configuration Terraform » Backend » Configuration] | * [https://developer.hashicorp.com/terraform/language/settings/backends/configuration Terraform » Backend » Configuration] |
Revision as of 21:52, 18 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 |